Bash QuickRef
The Ultimate
Bash Shell Cheat Sheet
Master the command line with this comprehensive, interactive reference guide. File operations, permissions, scripting variables, and keyboard shortcuts at your fingertips.
List all files including hidden ones with detailed info.
Copy a directory recursively.
Rename or move a file.
Force remove a directory and its contents (Careful!).
Create an empty file or update timestamp.
Create nested directories.
Output the contents of a file.
Watch a log file in real-time.
Compress a folder into tar.gz.
Change directory.
Go up one directory level.
Go to home directory.
Go to the previous directory.
Print working directory path.
Search for text in a file.
Recursive search for text in current dir.
Find files by name pattern.
Find files larger than 10MB.
Quickly find file by name (indexed).
Set rwx for owner, rx for others.
Make a file executable.
Change file owner and group.
Set default file permissions.
Check network connectivity.
Download file from URL.
Download file from URL.
Display network interfaces (Legacy).
Display network interfaces (Modern).
Secure shell login.
List listening ports.
List all running processes.
Real-time system monitor.
Interactive process viewer (if installed).
Terminate process by PID.
Kill all processes by name.
Show disk usage (human readable).
Show directory size.
Show memory usage in MB.
Count lines in a file.
Sort lines alphabetically.
Filter adjacent duplicate lines.
Show first 5 lines.
Replace "foo" with "bar".
Print the first column.
keyboard Keyboard Shortcuts
Emacs Mode (Default)| Key Combo | Action | Category |
|---|---|---|
| Ctrl + A | Go to beginning of line | Navigation |
| Ctrl + E | Go to end of line | Navigation |
| Ctrl + R | Search history backwards | History |
| Ctrl + L | Clear screen | Control |
| Ctrl + C | Kill current process | Control |
| Ctrl + Z | Suspend current process | Control |
| Alt + . | Insert last argument of previous command | Editing |
compare_arrows I/O Redirection
| > | Redirect stdout to file (overwrite) |
| >> | Redirect stdout to file (append) |
| 2> | Redirect stderr to file |
| 2>&1 | Redirect stderr to stdout |
| &> | Redirect both stdout and stderr |
| | | Pipe stdout of left to stdin of right |
attach_money Special Variables
| $0 | Name of the script |
| $1 - $9 | Script arguments |
| $# | Number of arguments |
| $@ | All arguments (as separate strings) |
| $? | Exit status of last command |
| $$ | PID of current shell |