DEV Community

Thesius Code
Thesius Code

Posted on • Originally published at datanest-stores.pages.dev

Linux Command Line Reference

Linux Command Line Reference

The terminal companion every developer and sysadmin needs. This pack organizes hundreds of Linux commands by category — file operations, process management, networking, permissions, text processing, disk management, and systemd — with flags you'll actually use, piping patterns, and real-world one-liners. Goes beyond man pages by showing the combinations and patterns that solve actual problems.

What's Included

  • File & Directory Operations — find, ls, cp, mv, ln, tar, zip, rsync, tree
  • Process Management — ps, top, htop, kill, nice, nohup, systemctl, journalctl
  • Networking — curl, wget, ss, netstat, ip, dig, nslookup, iptables, tcpdump
  • Permissions & Users — chmod, chown, useradd, groups, sudo, ACLs, umask
  • Text Processing — grep, sed, awk, cut, sort, uniq, tr, jq, xargs
  • Disk & Storage — df, du, mount, lsblk, fdisk, mkfs, LVM commands
  • Systemd Reference — Unit files, service management, timers, journald
  • One-Liner Recipes — 50+ practical command combinations for daily tasks

Preview / Sample Content

File Operations — Beyond the Basics

# Find files modified in the last 24 hours
find /var/log -type f -mtime -1

# Find and delete files older than 30 days
find /tmp -type f -mtime +30 -delete

# Find large files (>100MB) sorted by size
find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5 -h

# Recursive search-and-replace in files
find . -name "*.py" -exec sed -i 's/old_func/new_func/g' {} +

# Rsync with progress, compression, and exclude patterns
rsync -avz --progress --exclude='node_modules' --exclude='.git' \
  ./project/ user@example.com:/deploy/project/

# Create tar.gz preserving permissions
tar czf backup-$(date +%Y%m%d).tar.gz --exclude='.git' ./project/

# Compare two directories
diff -rq dir1/ dir2/

# Watch a directory for changes
inotifywait -m -r -e create,modify,delete ./src/
Enter fullscreen mode Exit fullscreen mode

Process Management — Essential Commands

# Find process by name (with full command line)
ps aux | grep '[n]ginx'

# Top 10 memory-consuming processes
ps aux --sort=-%mem | head -11

# Top 10 CPU-consuming processes
ps aux --sort=-%cpu | head -11

# Kill all processes matching a name
pkill -f "python worker.py"

# Run process immune to hangups (survives SSH disconnect)
nohup python long_task.py > output.log 2>&1 &

# Limit CPU usage of a running process
cpulimit -p 12345 -l 50

# Monitor system resources in real-time
watch -n 2 'free -h && echo "---" && df -h /'

# Trace system calls of a running process
strace -p 12345 -e trace=network -f

# List all open files by a process
lsof -p 12345

# Find which process is using a port
lsof -i :8080
ss -tlnp | grep 8080
Enter fullscreen mode Exit fullscreen mode

Text Processing — Power Combinations

# Extract unique IPs from a log file, sorted by frequency
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20

# CSV column extraction (3rd column)
cut -d',' -f3 data.csv

# JSON processing with jq
cat response.json | jq '.users[] | {name: .name, email: .email}'

# Multi-line sed replacement
sed -n '/START_MARKER/,/END_MARKER/p' config.yaml

# AWK: sum a numeric column
awk -F',' '{sum += $4} END {print "Total:", sum}' sales.csv

# Replace text across multiple files
grep -rl 'old_string' ./src/ | xargs sed -i 's/old_string/new_string/g'

# Count lines of code by file type
find . -name '*.py' | xargs wc -l | sort -n | tail -20

# Extract and decode base64 from a file
grep -oP 'data:.*?;base64,\K[^"]+' file.html | base64 -d
Enter fullscreen mode Exit fullscreen mode

Quick Reference Table

Command Purpose Most Useful Flags
find Search for files -name, -type, -mtime, -size, -exec
grep Search file contents -r, -i, -l, -n, -P (PCRE), -v (invert)
sed Stream editor -i (in-place), -n (suppress), -e (multi-cmd)
awk Pattern processing -F (delimiter), NR, NF, $0, END{}
xargs Build commands from stdin -I{}, -P (parallel), -0 (null delimiter)
rsync Sync files/dirs -avz, --delete, --exclude, --dry-run
curl HTTP client -s, -o, -H, -d, -X, -L, -w
ss Socket statistics -t (TCP), -l (listening), -n (numeric), -p (process)
journalctl Systemd logs -u (unit), -f (follow), --since, -p (priority)
systemctl Service manager start, stop, restart, enable, status, list-units

Comparison: Text Search Tools

Feature grep ripgrep (rg) ag (Silver Searcher) ack
Speed Moderate Fastest Fast Moderate
Regex POSIX/PCRE Rust regex PCRE Perl
Git-aware No Yes (.gitignore) Yes Yes
Unicode Basic Full Full Full
Binary Skip -I flag Default Default Default
Installed By Default Yes No No No
Replace sed pipeline --replace No No

Usage Tips

  1. Master the pipe | — Linux power comes from combining small commands. The text processing page shows 20+ pipe patterns.
  2. Learn xargs — it's the bridge between "find things" and "do things to them." The -P flag enables parallel execution.
  3. Bookmark the find examplesfind with -exec replaces entire scripts.
  4. Use systemctl and journalctl together — the systemd page shows the workflow for debugging failed services.
  5. Print the permissions pagechmod numeric notation becomes second nature after one day with the reference table.

This is 1 of 11 resources in the Cheatsheet Reference Pro toolkit. Get the complete [Linux Command Line Reference] with all files, templates, and documentation for $12.

Get the Full Kit →

Or grab the entire Cheatsheet Reference Pro bundle (11 products) for $79 — save 30%.

Get the Complete Bundle →


Related Articles

Top comments (0)