What’s on top?

  • Display each CPU’s usage
  • Sort by memory
  • Batch mode
> top -b -n 1 | egrep '^[[:digit:]]|^[[:space:]]' | grep -v PID | awk '{ print $1 }' | sort -n > top_pids> ps aux | grep -v PID | awk '{ print $2 }' > ps_pids> diff top_pids ps_pids

Process States

Top provides an overview of process states. Here are the meaning of each state in simple English.

  1. Running (R): Running, not much ambiguity.
  2. Waiting(S/D): Interruptible sleep (S) or uninterruptible sleep (D)
  3. Stopped (T): Stopped, example below
  4. Zombie (Z): A finished process which is still in the process table.
> sleep 100

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store