The Top Command

You now the command top? The one you use when you want to see if there is one process hogging all the CPU?

But there is also a gazillion other columns with useful info, but the interface is very….. linuxy.  The only command I can remember is q which means exit…

So here is a list of the most useful ones:

h is of course HELP

COMMAND

k is for K-K-K-KILLING the selected processs

TOGGLE

c will change the COMMAND column to show the full  command, with arguments, for each process

E will switch memory unit in top area

e will switch memory unit for processes

Zm Toggles memory fields in top between three different display modes

t Toggles CPU fields in top between three differetn display modes

H toggles between processes (default) and threads

V Toggles tree view

z will turn everything red and also highlight the active process.

Z will go into color config mode!

FILTER

o/O Filter argument. Example COMMAND=Chrome  or !COMMAND=/sbin  or %CPU>5.0

= Clears all filters

SORTING

M Sort by memory

P Sort by CPU usage

N Sort by ID

T Sort by running time

SAVE

W Saves your config to .toprc in your home directory

EXPERT

A Alternate display

 

the STATUS column (or S) shows the proecss status:

  • Runnable (R): A process in this state is either executing on the CPU, or it is present on the run queue, ready to be executed.
  • Interruptible sleep (S): Processes in this state are waiting for an event to complete.
  • Uninterruptible sleep (D): In this case, a process is waiting for an I/O operation to complete.
  • Stopped (T): These processes have been stopped by a job control signal (such as by pressing Ctrl+Z) or because they are being traced.
  • Zombie (Z): The kernel maintains various data structures in memory to keep track of processes. A process may create a number of child processes, and they may exit while the parent is still around. However, these data structures must be kept around until the parent obtains the status of the child processes. Such terminated processes whose data structures are still around are called zombies.

Also check the PR (PRIO) and NI (NICE) columns. Lower value (like -20) has higher prio, Higher value (nicer) gets lower prio.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.