Skip to content

Linux Tools Cheat Sheet: The Only Reference You Need

A concise, printable Linux command cheat sheet covering file ops, networking, permissions, processes, and more. Print it or bookmark it.

8 min read

This cheat sheet is designed to be a quick-scan reference for the Linux commands you reach for most often. Each section is compact enough to fit on a printed page — use your browser's print function (Ctrl+P or Cmd+P) to save it as a PDF or send it to your printer.

For detailed explanations and examples, see the full Essential Linux Tools List article.

File Operations

ls -lah List all files with details + human sizes

find / -name "*.conf" Find files by name pattern

find . -mtime -7 Files modified in last 7 days

cp -r src/ dst/ Copy directory recursively

mv old new Move or rename

rm -rf dir/ Remove directory (careful!)

ln -s target link Create symbolic link

du -sh /var/* Directory sizes (human-readable)

df -h Filesystem disk usage

tree -L 2 Directory tree (2 levels deep)

Text Processing

grep -rn "pattern" dir/ Recursive search with line numbers

grep -i "error" file Case-insensitive search

awk '{print $1}' file Print first column

sed 's/old/new/g' file Find and replace

sort file | uniq -c Count unique lines

cut -d: -f1 /etc/passwd Extract field by delimiter

wc -l file Count lines

head -20 / tail -20 First/last 20 lines

tail -f /var/log/syslog Follow log in real time

jq '.key' data.json Parse JSON

Networking

ping -c 4 host Test connectivity (4 packets)

traceroute host Trace packet route

dig +short A domain DNS A record lookup

curl -I url Fetch HTTP headers only

curl -sS url | jq . Fetch + parse JSON API

wget -q url Download file quietly

ss -tulnp Listening ports + process names

ip addr show Show network interfaces

ip route show Show routing table

tcpdump -i eth0 port 80 Capture HTTP packets

Permissions & Ownership

chmod 755 file rwxr-xr-x (owner full, others read+exec)

chmod 644 file rw-r--r-- (owner rw, others read)

chmod +x script.sh Add execute permission

chown user:group file Change owner and group

chown -R www-data: dir/ Recursive ownership change

Permission reference:

NumberPermissionSymbol
7read + write + executerwx
6read + writerw-
5read + executer-x
4read onlyr--
0no permission---

Process Management

ps aux List all running processes

ps aux --sort=-%mem Processes sorted by memory usage

top / htop Interactive process monitor

kill PID Graceful terminate (SIGTERM)

kill -9 PID Force kill (SIGKILL)

pgrep -f "pattern" Find PID by name pattern

lsof -i :8080 What process is using port 8080

nohup cmd & Run in background, survive logout

Services (systemd)

systemctl start svc Start a service

systemctl stop svc Stop a service

systemctl restart svc Restart a service

systemctl status svc Check service status

systemctl enable svc Start on boot

systemctl list-units List all active units

journalctl -u svc -f Follow service logs

journalctl --since "1h ago" Logs from last hour

Archives & Compression

tar -czf a.tar.gz dir/ Create gzip tarball

tar -xzf a.tar.gz Extract gzip tarball

tar -cjf a.tar.bz2 dir/ Create bzip2 tarball

tar -xf a.tar.* Extract (auto-detect format)

zip -r a.zip dir/ Create zip archive

unzip a.zip Extract zip archive

gzip file / gunzip file.gz Compress / decompress single file

Package Managers

# Debian / Ubuntu (apt)

apt update && apt upgrade     Update + upgrade all

apt install pkg                   Install package

apt search keyword                Search packages

# RHEL / Fedora (dnf)

dnf upgrade                        Update + upgrade all

dnf install pkg                   Install package

dnf search keyword                Search packages

# Arch (pacman)

pacman -Syu                        Sync + upgrade

pacman -S pkg                      Install package

SSH Quick Reference

ssh user@host Connect to remote server

ssh -i key.pem user@host Connect with specific key

ssh -L 8080:localhost:80 host Local port forward

ssh -R 8080:localhost:80 host Remote port forward

scp file user@host:/path Copy file to remote

scp -r dir/ user@host:/path Copy directory to remote

ssh-keygen -t ed25519 Generate modern SSH key

ssh-copy-id user@host Install public key on server

Cron Scheduling

crontab -e Edit your crontab

crontab -l List your crontab

# Cron field format:

MIN HOUR DOM MON DOW command

Common patterns:

0 2 * * *       Daily at 2:00 AM

*/15 * * * *    Every 15 minutes

0 9 * * 1-5    Weekdays at 9:00 AM

0 0 1 * *      First of month at midnight

0 4 * * 0      Sundays at 4:00 AM

Disk & Storage

lsblk List block devices

fdisk -l List partition tables

mount /dev/sdb1 /mnt Mount a partition

umount /mnt Unmount

mkfs.ext4 /dev/sdb1 Format as ext4

blkid Show UUIDs for /etc/fstab

Save as PDF

Press Ctrl+P (Linux/Windows) orCmd+P (Mac) and select "Save as PDF" as the destination. This page is designed to print cleanly on A4 or Letter paper. For a deeper dive into each category, read the full Essential Linux Tools List.

Related Tools