Linux Command Line
Linux command line cheat sheet: navigation, pipes, text tools (grep, sed, awk, cut, xargs, jq), file permissions and chmod, redirects, processes and signals, systemd services, ssh and rsync, and a checklist before you run anything as root.
Cheat sheet · Offered as a template
In this diagram
- Linux Command Line
- The commands, pipes and permissions you reach for every day, on one page.
- ① Find your way
- navigate
- ② Pipes: small tools, joined
- cat access.log
- Read
- grep " 500 "
- Filter
- awk '{print $1}'
- Pick a column
- sort | uniq -c
- Count
- sort -rn | head
- Top 10
- ③ Text tools
- ④ Permissions
- -rwxr-xr-- = 754
- change them
- ⑤ Redirects
- Streams
- ⑥ Processes
- shell
- ⑦ Signals
- ⑧ Where things live
- /etc: configuration
- /var/log: logs
- /home: user files
- /tmp: scratch space, cleared on boot
- /proc and /sys: the kernel, as files
- /usr/bin: programs
- ⑨ Services (systemd)
- ⑩ Remote machines
- ⑪ Before you run it as root
- Read the whole command
- Is the rm -rf path right?
- Dry run first (--dry-run, echo)
- Is this the right host?
- ⑫ Habits
- ✓ man and --help before the search engine
- ✓ Ctrl-R searches your history
- ✓ set -euo pipefail at the top of every script
- ✓ Quote your "$variables"
- ✓ tmux keeps a session alive after you disconnect