Ten command-line tools cover most of what a Linux sysadmin does in a day: finding what's eating CPU, keeping a session alive through an SSH drop, moving data, checking ports and DNS, testing an endpoint, and digging through logs. For each tool below you get what it's for, how to install it, and the commands worth memorizing.

Install all ten at once

# Ubuntu / Debian
sudo apt install htop tmux rsync iproute2 lsof dnsutils curl jq findutils gawk sed

# RHEL / Rocky / AlmaLinux (htop comes from EPEL)
sudo dnf install epel-release
sudo dnf install htop tmux rsync iproute lsof bind-utils curl jq findutils gawk sed
ToolUse it toReplaces
htopSee and manage processes interactivelytop
tmuxKeep sessions alive and split the terminalscreen, extra SSH windows
rsyncCopy and sync files efficientlycp, scp
ssList sockets and listening portsnetstat
lsofFind which process holds a file or portguesswork
digQuery DNS preciselynslookup
curlTest HTTP endpoints and APIsa browser
jqFilter and reshape JSONgrep on JSON
findLocate files by name, age, size, or permissionls -R | grep
awk / sedExtract columns and edit text in placemanual editing

1. htop: interactive process monitor

htop shows per-core CPU, memory, swap, and a sortable, searchable process list. You can kill or renice a process without typing its PID.

htop                 # start
htop -u www-data     # only one user's processes
htop -p 1234,5678    # watch specific PIDs
htop -d 20           # refresh every 2 seconds (units are tenths of a second)

Inside htop, F6 picks the sort column, F4 filters, F5 toggles the tree view (handy for runaway child processes), and F9 sends a signal.

2. tmux: sessions that survive disconnects

Start every long-running job, such as an upgrade, a migration, or a big rsync, inside tmux. If your SSH connection drops, the job keeps running and you reattach later.

tmux new -s maint      # new named session
# Ctrl-b d             detach (session keeps running)
tmux ls                # list sessions
tmux attach -t maint   # reattach
# Ctrl-b %             split side by side
# Ctrl-b "             split top/bottom
# Ctrl-b arrow keys    move between panes

3. rsync: fast, resumable file sync

rsync copies only what changed, preserves permissions and timestamps, and resumes cleanly, which makes it the right tool for migrations and simple backups.

# Preview first: -n (dry run) shows what would change
rsync -avhn --delete /srv/www/ backup@nas:/backups/www/

# Then run it for real, with progress and resume support
rsync -avh --delete --partial --info=progress2 /srv/www/ backup@nas:/backups/www/

# Non-standard SSH port
rsync -avh -e "ssh -p 2222" /etc/nginx/ admin@web02:/etc/nginx/

The trailing slash matters. /srv/www/ copies the contents of www; /srv/www copies the directory itself. Combined with --delete, the wrong one can wipe a destination. Always dry-run first.

4. ss: sockets and ports

ss is the modern replacement for netstat. It's faster and installed by default on current distributions.

sudo ss -tulpn                              # listening TCP/UDP ports + owning process
ss -tn state established '( dport = :443 )' # established connections to port 443
ss -s                                       # summary counts (spot connection floods)

5. lsof: what has this file or port open?

sudo lsof -i :8080        # which process is using port 8080
sudo lsof -u deploy       # everything one user has open
sudo lsof -p 1234         # every file a process has open
sudo lsof +L1             # deleted files still held open

That last one solves a classic mystery: df says the disk is full, but du can't find the space. A process is still holding a deleted log file. Restart or reload that process and the space comes back.

6. dig: DNS answers you can trust

dig +short example.com A        # just the answer
dig @1.1.1.1 example.com        # ask a specific resolver
dig example.com MX +noall +answer
dig +trace example.com          # follow delegation from the root
dig -x 203.0.113.10             # reverse lookup

When "DNS is broken", compare your internal resolver with a public one (dig @your-dns vs dig @1.1.1.1). That tells you within seconds whether the problem is your server or the record itself.

7. curl: test endpoints without a browser

curl -I https://example.com                       # headers only
curl -sS -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com
curl -v --resolve example.com:443:10.0.0.5 https://example.com/health
curl -X POST -H 'Content-Type: application/json' -d '{"ping":true}' https://api.example.com/v1/test

--resolve sends the request to a specific backend IP while keeping the right hostname and TLS certificate, so you can test one server behind a load balancer.

8. jq: make JSON readable

Cloud CLIs, APIs, and many logs speak JSON. jq filters and reshapes it.

curl -s https://api.github.com/repos/restic/restic | jq '{name, stars: .stargazers_count}'
az vm list -o json | jq -r '.[].name'
az vm list -d -o json | jq -r '.[] | select(.powerState=="VM running") | .name'
cat app.log.json | jq -r 'select(.level=="error") | "\(.time) \(.msg)"'

-r prints raw strings without quotes, ready to pipe into another command.

9. find: locate files by any attribute

sudo find / -xdev -type f -size +1G 2>/dev/null           # big files on the root filesystem
find /var/log -name '*.log' -mtime +14                    # logs older than 14 days
find /var/log -name '*.log' -mtime +14 -print -delete     # same, then delete them
sudo find / -xdev -perm -4000 -type f 2>/dev/null         # SUID binaries (security audit)
find /srv/www -type f -name '*.php' -exec grep -l 'eval(' {} +

Run any -delete command once without it first, and check the list.

10. awk and sed: text processing

awk pulls columns out of structured text. sed edits streams and files in place.

# Top 10 client IPs in an nginx access log
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

# Human users (UID 1000+) from /etc/passwd
awk -F: '$3 >= 1000 {print $1}' /etc/passwd

# Change a setting in place and keep a backup copy
sudo sed -i.bak 's/^#\?PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config

# Print lines 100-120 of a big file
sed -n '100,120p' /var/log/syslog

Windows admin? The PowerShell equivalents

If you manage both platforms: Get-Process for htop, Get-NetTCPConnection -State Listen for ss, Resolve-DnsName for dig, Invoke-RestMethod for curl and jq, and robocopy /MIR for rsync. See CMD vs PowerShell for the full mapping.

Ready to use these on a real server? Put them to work in automated Linux backups with Restic and the network troubleshooting tools guide.