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

CommandWhat it does
pwdPrint the current working directory
ls -lahList files: long format, all (incl. hidden), human sizes
cd DIRChange directory (cd - = previous, cd ~ = home)
tree -L 2Show directory tree two levels deep
du -sh DIRTotal size of a directory
df -hFree space on mounted disks

Files & directories

CommandWhat it does
touch FILECreate an empty file / update its timestamp
mkdir -p a/b/cCreate directories, including parents
cp -r SRC DESTCopy files or directories (recursive)
mv SRC DESTMove or rename
rm -rf DIRDelete recursively, no prompt (dangerous)
ln -s TARGET LINKCreate a symbolic link

Viewing & editing text

CommandWhat it does
cat FILEPrint a whole file
less FILEScroll a file (q to quit, / to search)
head -n 20 FILEFirst 20 lines (tail for the last)
tail -f FILEFollow a file as it grows (logs)
grep -rin PATTERN .Search recursively, case-insensitive, with line numbers
sed -i 's/old/new/g' FILEFind & replace in place

Permissions & ownership

CommandWhat it does
chmod +x FILEMake a file executable
chmod 644 FILESet permissions (owner rw, group/other r)
chown user:group FILEChange owner and group
sudo CMDRun a command as the superuser

Processes & jobs

CommandWhat it does
ps auxList all running processes
top / htopLive process & resource monitor
kill -9 PIDForce-kill a process by ID
CMD &Run in the background
jobs / fgList background jobs / bring one to foreground

Networking, archives & pipes

CommandWhat it does
curl -O URLDownload a file (wget URL also works)
ssh user@hostConnect to a remote machine
tar -czf out.tar.gz DIRCreate a gzip archive (-xzf to extract)
CMD1 | CMD2Pipe output of one command into another
CMD > fileRedirect 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

  1. Browse by section.
  2. Find the command you need.
  3. Copy it with one tap.
  4. 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.