With a lot of ‘top’ alternatives like htop or btop, you may think ‘top’ is a not-so-useful command, but you can customize its output in multiple ways.

Table of Contents

Command-line options

top admits several parameters:

  • top -d <seconds>: delay-time interval. You can use decimals: top -d 1.5.
  • top -p <PID>: monitor specific Process IDs (PID). You can add up to 20 PIDs.
  • top -U <user>: display processes from a user ID or user name.

Interactive commands

Inside top you can press these keys:

  • F: fields management window. Add, remove and move top columns using arrow keys (to navigate, select and move entries) and D or SPACE key to add or remove. To close this window, press Q or Esc.
  • D + <seconds>: you can change the delay inside top as well.
  • L: toggle load-average/uptime line.
  • T: toggle task/cpu-states lines (four modes).
  • M: toggle memory lines (four modes).
  • C: display command line or program name.
  • J: alternate between right-justified numbers (Shift + J) or names, and left-justified.
  • <: move sort column to the left.
  • >: move sort column to the right.
  • Shift + R: toggle reverse sorting.
  • 1: single/separate CPU-states toggle.
  • U + <username>: display processes from a user.
  • O + <fieldname>=<value>: filter processes by field value (e.g.: !USER=root excludes processes owned by root).
  • Shift + L: filter lines by a word.

More

Run man top for more info.

If you have any suggestion, feel free to contact me via social media or email.