Skip to content

Try “polymorphism”, “TCP handshake” or “git rebase”.

    Computer Basics / The Linux Command Line

    Quick Reference

    Glossary and cheat sheet for The Linux Command Line — the page to reread before an interview.

    Extra: Reference8 min read

    Glossary#

    TermPlain meaningChapter
    terminal / shellthe text window / the program interpreting commands (bash, zsh)1
    promptthe text before the cursor; $ normal user, # root1
    option / flag / argumentchanges behaviour (-l) / what to act on1
    man pagea command's built-in manual1
    working directorythe folder you're in now2
    home directory (~)your personal folder2
    hidden filea name starting with .2
    /etc, /var/log, /procconfig / logs / live kernel info2
    symbolic linka small file pointing to another path3
    owner / group / othersthe three permission classes4
    r / w / xread / write / execute (enter, for directories)4
    755 / 644 / 600scripts & dirs / normal files / secrets4
    root / sudothe superuser / run one command as root4
    umaskthe mask giving new files their default permissions4
    redirection (>, >>, 2>&1)sending streams to files5
    pipe (|)one command's output into the next command's input5
    /dev/nulldiscards everything written to it5
    && / ||run next only on success / only on failure5
    regular expression (regex)a pattern language for text6
    grep / sort / uniq / cut / awk / sed / find / xargs / jqfilter / order / count / columns / column scripts / replace / search files / build arguments / JSON6
    load averagerunnable + waiting processes over 1/5/15 minutes7
    background job (&) / nohup / tmuxruns without holding the prompt / survives logout / persistent terminal7
    environment variablenamed setting every process inherits a copy of8
    PATHfolders searched, in order, for a command8
    .zshrc / .bashrcshell startup files8
    .env filelocal file of configuration variables (never commit it)8
    shell script / shebanga file of commands / its first line saying which interpreter runs it9
    set -euo pipefailstop on errors, unset variables and pipeline failures9
    SSHencrypted remote terminal, port 2210
    authorized_keys / known_hostspublic keys allowed in / servers you've trusted10
    scp / rsynccopy files / sync only changes10
    SSH tunnel (-L)forward a local port through a server10
    bastion / jump hostthe single secure entry server into a private network10
    package managerapt / dnf / brew / apk — installs software11
    systemd / service / daemon / unit fileLinux service manager / long-running program / its definition11
    journalctlreads systemd's logs11
    cron / crontabtime-based job scheduler / its schedule11
    postmortema write-up of an incident and how to prevent it12

    Cheat Sheet#

    Moving and looking

    Output
      pwd · ls -lah · cd dir · cd .. · cd ~ · cd -        Tab to complete · Ctrl+R to search history

    Files

    Output
      less f · head -n 20 f · tail -f f · wc -l f
      mkdir -p a/b · cp -r src dst · mv old new · rm -r dir  (ls it first!) · ln -s target link

    Permissions

    Output
      r=4 w=2 x=1 · 755 scripts/dirs · 644 files · 600 secrets · chmod +x script.sh · chown user:group f

    Streams

    Output
      > overwrite · >> append · 2> errors · > f 2>&1 both · | pipe · > /dev/null discard · && on success · || on failure

    Text recipes

    Output
      top values of column N:   awk '{print $N}' f | sort | uniq -c | sort -rn | head
      search recursively:       grep -rn "text" .
      context around matches:   grep -C 3 "Traceback" app.log
      big old files:            find /var/log -name "*.log" -size +100M -mtime +7
      JSON field:               curl -s URL | jq '.field'

    Processes, services, schedules

    Output
      ps aux | grep x · pgrep -fl x · top · kill PID · kill -9 PID (last resort) · cmd & · nohup cmd &
      systemctl status|restart|enable svc · journalctl -u svc -f · crontab -e   (m h dom mon dow)

    Incident checklist

    Output
      systemctl status → journalctl → df -h → du -sh → free -h / dmesg → uptime / top
      → ss -tlnp / lsof -i :PORT → curl localhost/health → nc -vz dependency → dig

    Try This Yourself#

    1. Build the log pipeline. Create access.log from Chapter 6 (copy the 8 lines into a file with a text editor, or with cat > access.log, paste, then Ctrl+D). Run the top-IPs pipeline one stage at a time — add one | command at a time and look at the output after each — until you can predict every stage's output before pressing Enter.

    2. Permission drill. touch secret.txt, then ls -l secret.txt (note 644). Run chmod 600 secret.txt and check again. Make a script: echo 'echo hello' > hi.sh, try ./hi.sh (permission denied), then chmod +x hi.sh and run it.

    3. Write a script. Write check.sh that uses set -euo pipefail, runs df -h /, and prints DISK WARNING to stderr and exits with code 1 if usage is above 80%. Hint: df -P / | awk 'NR==2 {print $5}' | tr -d '%' prints just the number. Test the failure branch by temporarily changing 80 to 1.