Linux interview question · Most asked

What do top, htop, vmstat, iostat, ss and lsof each tell you?

Definition Asked in DevOps Engineer · Site Reliability Engineer (SRE) interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

top/htop show live per-process CPU and memory; vmstat shows system-wide CPU, memory, swap and run queue over time; iostat -x shows per-disk throughput, latency and utilisation; ss lists sockets and connection states; lsof lists open files, including sockets, per process.

Longer Answer

Tool Use it for Look at
top / htop Which process uses CPU or memory %CPU, RES, load average, us/sy/wa/st
vmstat 1 Whole-system trend r (run queue), si/so (swapping), wa
iostat -x 1 Disk bottlenecks await (latency), %util, r/s and w/s
ss -tulpn / ss -s Listening ports, connection counts LISTEN, ESTAB, TIME_WAIT, owning process
lsof -p PID / lsof -i :443 Files and sockets a process holds deleted-but-open files, too many fds
netstat Older equivalent of ss replaced by ss on modern systems

Together they answer "is it CPU, memory, disk or network?" quickly; that's Brendan Gregg's USE method (utilisation, saturation, errors) applied with standard tools.

Key Points

  • top/htop: per process.
  • vmstat: system-wide trend and run queue.
  • iostat -x: disk latency and utilisation.
  • ss: sockets and states; lsof: open files per process.

Explanation

What interviewers look for

Knowing which tool answers which question, and the key column in each.

More Linux questions

← All Linux questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake