Linux Command Cheat Sheet
The essential Linux terminal commands on one page, files and navigation, permissions, processes, networking, and package managers. A quick reference for the bash shell.
A quick reference to the most-used Linux/Unix shell commands (bash/zsh). Square
brackets mark optional parts; replace FILE, DIR, and
PATTERN with your own values.
Navigating & listing
| Command | What it does |
|---|---|
pwd | Print the current working directory |
ls -lah | List files: long format, all (incl. hidden), human sizes |
cd DIR | Change directory (cd - = previous, cd ~ = home) |
tree -L 2 | Show directory tree two levels deep |
du -sh DIR | Total size of a directory |
df -h | Free space on mounted disks |
Files & directories
| Command | What it does |
|---|---|
touch FILE | Create an empty file / update its timestamp |
mkdir -p a/b/c | Create directories, including parents |
cp -r SRC DEST | Copy files or directories (recursive) |
mv SRC DEST | Move or rename |
rm -rf DIR | Delete recursively, no prompt (dangerous) |
ln -s TARGET LINK | Create a symbolic link |
Viewing & editing text
| Command | What it does |
|---|---|
cat FILE | Print a whole file |
less FILE | Scroll a file (q to quit, / to search) |
head -n 20 FILE | First 20 lines (tail for the last) |
tail -f FILE | Follow a file as it grows (logs) |
grep -rin PATTERN . | Search recursively, case-insensitive, with line numbers |
sed -i 's/old/new/g' FILE | Find & replace in place |
Permissions & ownership
| Command | What it does |
|---|---|
chmod +x FILE | Make a file executable |
chmod 644 FILE | Set permissions (owner rw, group/other r) |
chown user:group FILE | Change owner and group |
sudo CMD | Run a command as the superuser |
Processes & jobs
| Command | What it does |
|---|---|
ps aux | List all running processes |
top / htop | Live process & resource monitor |
kill -9 PID | Force-kill a process by ID |
CMD & | Run in the background |
jobs / fg | List background jobs / bring one to foreground |
Networking, archives & pipes
| Command | What it does |
|---|---|
curl -O URL | Download a file (wget URL also works) |
ssh user@host | Connect to a remote machine |
tar -czf out.tar.gz DIR | Create a gzip archive (-xzf to extract) |
CMD1 | CMD2 | Pipe output of one command into another |
CMD > file | Redirect output to a file (>> appends) |
Tip: press Tab to autocomplete, Ctrl+R
to search your command history, and Ctrl+C to cancel a running
command. Run man COMMAND for the full manual of any command.
What this does
A Linux command cheat sheet puts the essential bash terminal commands on one page — files and navigation, permissions, processes, networking, and package managers.
How to use it
- Browse by section.
- Find the command you need.
- Copy it with one tap.
- Swap in your own paths or options.
Example
ls -la lists every file, including hidden ones, in long form.
Sources & methodology
Last updated .
Frequently asked questions
Which shell do these commands assume?
They target bash, the default on most Linux distributions, but the vast majority work identically in zsh and other POSIX shells.
How do I see help for a command?
Run man COMMAND for the full manual, or COMMAND --help for a quick summary of options.
Why do some commands need sudo?
Commands that change system files or other users’ data require administrator rights. Prefixing with sudo runs them as the superuser, use it carefully.
Related tools
Windows CMD Cheat Sheet
A quick reference for the Windows Command Prompt, file and folder commands, networking, disk and system tools, plus handy keyboard shortcuts.
PowerShell Cheat Sheet
A reference for Windows PowerShell, discovering cmdlets, the object pipeline, filtering and formatting, managing files, processes and services, plus variables and flow control.
macOS Terminal Cheat Sheet
A reference for the macOS Terminal, the Mac-only commands (open, pbcopy, mdfind), system and defaults tools, Homebrew, core Unix commands, and keyboard shortcuts.
IBM AS/400 (IBM i) Cheat Sheet
A reference for the IBM i (AS/400, OS/400) command line, the work-with commands, libraries and objects, spooled files and output queues, messages, and 5250 function-key shortcuts.