root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat guia-comandos-linux.md
// tools

Basic Linux Commands

22 Jul 2026 · 4 min read

A reference for basic Linux commands — navigation, file management, processes, and networking. Meant as a quick lookup, not a step-by-step tutorial, whether you're coming from Windows or just need to recall exact syntax for something.

TypeCommand reference
Shellbash / sh

Navigation and files

ActionCommandDescription
List folder contentslsLists files and folders in the current directory
Detailed listingls -lShows permissions, owner, size and date
Include hidden filesls -laIncludes hidden files (starting with .)
Change directorycd folderEnters a folder
Go up one levelcd ..Returns to the parent directory
Show current pathpwdDirectory you're in (print working directory)
Create a foldermkdir nameCreates a new folder
Create nested foldersmkdir -p path1/path2/path3Creates the whole path at once
Create an empty filetouch file.txtCreates an empty file
View a file's contentcat file.txtShows the full content
View with paginationless file.txtBrowse content page by page
Copy a file/foldercp source dest / cp -r source dest-r to copy whole folders
Move or renamemv source destMoves or renames files/folders
Delete a file/folderrm file / rm -r folder-r for non-empty folders

Permissions and users

ActionCommandDescription
Admin privilegessudo commandRuns a specific command as root
Persistent root sessionsudo suStays root so you don't repeat sudo
View current userwhoamiWho you are
View logged-in userswhoList of active sessions
Change passwordpasswdChanges the current user's password
View system userscat /etc/passwdLists all local accounts

Search and filtering

ActionCommandDescription
Search text in a filegrep "word" file.txtFinds text matches
Find files by namefind /path -name "file.txt"Searches by name in a path
Count lines/words/byteswc file.txtQuick file statistics
Count matchescurl -s https://site.com \| grep -o "word" \| wc -lTypical combo to count how many times a term appears

Processes, network and system

ActionCommandDescription
View active processesps auxLists every process on the system
Find a processps aux \| grep nameFilters the process list
Kill a processkill PIDStops a process by its ID
View the machine's IPip a / ifconfigInterfaces and IP addresses
Test connectivityping google.comChecks network connectivity
Disk spacedf -hFree/used space in human-readable form
Memory usagefree -hUsed and free RAM

Redirection and chaining

ActionCommandDescription
Save output to a filecommand > output.txtOverwrites the file
Append to a filecommand >> output.txtDoesn't overwrite, appends
Chain commandscommand1 && command2Runs the second only if the first succeeded

Bash scripts

#!/bin/bash

First line ("shebang") so the file is recognised as a bash script. Run it with:

chmod +x script.sh
./script.sh