Linux Commands Cheat Sheet
Essential Linux shell commands, file management, and system administration.
2 PagesBeginnerMay 6, 2026
File & Directory Commands
Navigate and manage the filesystem.
bash
ls -la # List all files, long formatcd /path/to/dir # Change directorypwd # Print working directorymkdir new_folder # Create directoryrm -rf folder # Remove directory recursivelycp src dest # Copy filemv src dest # Move/rename file
Permissions
View and change file permissions.
bash
chmod 755 script.sh # rwxr-xr-xchmod +x script.sh # Add execute permissionchown user:group file # Change owner
Process Management
Inspect and control running processes.
bash
ps aux # List all processestop # Live process monitorkill -9 <pid> # Force kill a processgrep -r "text" . # Search recursively
Text Processing
grep, sed, awk, and cut for filtering and transforming text.
bash
grep -rn "TODO" src/ # recursive, line numbersgrep -i -E "warn|error" log # case-insensitive regexsed -i 's/foo/bar/g' file.txt # in-place replace allawk -F',' '{print $1, $3}' data.csv # fields 1 and 3awk '$3 > 100' data.csv # rows where col3 > 100cut -d':' -f1 /etc/passwd # first colon-fieldsort file | uniq -c | sort -rn # frequency count
Networking
Inspect connections, transfer files, and test endpoints.
bash
ss -tulpn # listening sockets + PIDsip addr show # interface addressescurl -fsSL https://url # silent, fail on error, follow redirectscurl -X POST -d @body.json -H "Content-Type: application/json" urlwget -c https://file # resume interrupted downloadnc -zv host 22 # test if a port is opendig +short example.com # DNS lookup
Archives & Disk Usage
Compress, extract, and inspect disk consumption.
bash
tar -czf out.tar.gz dir/ # create gzip archivetar -xzf out.tar.gz # extracttar -tzf out.tar.gz # list contentszip -r out.zip dir/ # zip a folderdu -sh * # size of each item heredu -h --max-depth=1 | sort -hdf -h # free space per mountfind . -type f -size +100M # files larger than 100MB
Shell Shortcuts & Redirection
I/O redirection and keyboard shortcuts that speed up the terminal.
- cmd > f 2>&1- redirect stdout and stderr to file f
- cmd &>> f- append both streams to file f (bash)
- cmd1 | tee f- pipe to next command and also write to file f
- Ctrl+R- reverse-search command history incrementally
- !$ / !!- last argument of / entire previous command
- cmd & then disown- run in background and detach from the shell
Pro Tip
Use man <command> or <command> --help whenever you’re unsure of a flag — it’s faster and more accurate than guessing.
Was this cheat sheet helpful?
Explore Topics
#LinuxCommands#LinuxCommandsCheatSheet#DevOps#Beginner#FileDirectoryCommands#Permissions#ProcessManagement#TextProcessing#CommandLine#CheatSheet#SkillVeris