Developer and Text Tools

Everyday Linux Terminal Commands, Organised by Task

The Linux and macOS terminal commands you use most, grouped by task: files, text search, processes, ports, archives and packages, with safety notes.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
Everyday Linux Terminal Commands, Organised by Task

Everyday Linux Terminal Commands, Organised by Task

The terminal is the fastest way to work with servers, containers and development machines, but nobody remembers every flag. Most of the time you need one of about sixty commands, and the hard part is recalling which one and how to phrase it. The free Linux Command Reference lists them by task with practical examples and warnings. This guide tours the most useful ones.

Finding files and space

  • find . -name "*.log" -mtime +7 finds log files changed more than a week ago.
  • find . -type f -size +100M finds files bigger than 100 MB.
  • du -sh * | sort -h shows how big each item in a folder is, smallest to largest.
  • df -h shows free space on each disk. A full disk is behind many mysterious failures.

Searching and changing text

  • grep -rni "text" . searches every file under the current folder, ignoring case, with line numbers.
  • grep -v pattern shows lines that do not match, handy for filtering noise out of logs.
  • sed -i 's/old/new/g' file replaces text in a file in place. Keep a backup, or use -i.bak to make one automatically.
  • awk -F, '{print $1, $3}' file.csv prints columns from a CSV.
  • sort | uniq -c | sort -rn counts how often each line appears and ranks them, a quick way to find the most common errors or visitors.
  • jq '.items[].name' file.json pulls values out of JSON.

Processes and services

  • ps aux | grep name finds a process; top or htop shows a live view.
  • kill PID asks a process to stop politely; kill -9 PID forces it without letting it clean up, so use it last.
  • systemctl status, start, stop, restart and enable manage services on systemd distributions.
  • journalctl -u service -f --since "1 hour ago" follows a service's logs.

Networking

  • ip a and ip r show addresses and routes.
  • ss -tulpn lists listening ports with the programs using them, the answer to "what is using port 8080?".
  • curl -I https://example.com shows a website's response headers; dig +short example.com shows DNS answers.
  • ssh -L 8080:localhost:80 user@host forwards a port through SSH.
  • rsync -avz src/ host:dest/ copies only what changed, far faster than scp for repeated transfers.

Archives

tar -czf out.tar.gz folder creates a compressed archive and tar -xzf file.tar.gz -C dest extracts it. zip and unzip handle .zip files for sharing with Windows users.

Shell habits that save time

  • Ctrl+R searches your command history as you type.
  • cmd > out.txt 2>&1 saves both output and errors to a file.
  • cmd1 && cmd2 runs the second command only if the first succeeded.
  • watch -n 2 cmd re-runs a command every two seconds, useful while waiting for something to change.
  • sudo !! repeats the last command with sudo.

Packages

Debian and Ubuntu use apt update followed by apt install, Fedora and RHEL use dnf install, and Alpine, common in containers, uses apk add. Update the package lists first so you install current versions with security fixes.

Commands to respect

rm -rf deletes without asking and cannot be undone; double-check the path, especially with variables in it. Redirecting with > replaces a file's contents. chmod -R 777 makes everything writable by everyone and is almost never the right fix. These are flagged in the reference.

macOS notes

macOS uses BSD versions of some tools, so a few flags differ: sed -i needs an empty argument, as in sed -i '' 's/a/b/' file. Installing GNU coreutils with Homebrew gives the Linux behaviour. Search the reference in plain words, pick a section, and download it as CSV for your notes.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages