Command Line Basics: Monitor Processes With Top

February 28, 2010 by
Filed under: command line, HowTo, linux 

There are many different GUI based process monitors available for Linux systems. It seems that each desktop environment or window manager has its own solution. The one common process monitor is the command line terminal based top command.

Give it a try. To run top, simply open a terminal window and enter:

top

By default, top displays your running processes sorted by CPU usage. The display will get updated every three seconds (again, by default). Here are some basic interactive commands to get you started.

  • q - this is used to Quit using top.
  • z - this toggles color mode.
  • k - this is used to Kill a process. Invoking this command will open a field to enter the PID of the process you want to kill. After that, a field will display asking for the signal you want to send to the process. Simply hit <Enter> at this prompt unless you want to send a different signal to the process.
  • M - change the sort to %MEM.
  • P - change the sort back to %CPU.

There are several more command line parameters and interactive commands that can be used with top. To learn more, check out the top man page.

Affiliate Link
man top

Comments

3 Responses to “Command Line Basics: Monitor Processes With Top”

  1. Guys,
    You can try the new htop, it's a good utility. It's a good and useful tool for linux admins.
    http://innovationframes.com/phpbb/viewtopic.php?f=13&t=112

    Thanks,
    Jay

  2. Also try the followings in "top" console.

    Window 1:Def: Cumulative mode Off. System: Delay 3.0 secs; Secure mode Off.

    Z,B Global: 'Z' change color mappings; 'B' disable/enable bold
    l,t,m Toggle Summaries: 'l' load avg; 't' task/cpu stats; 'm' mem info
    1,I Toggle SMP view: '1' single/separate states; 'I' Irix/Solaris mode

    Thanks,
    Jai
    f,o . Fields/Columns: 'f' add or remove; 'o' change display order
    F or O . Select sort field
    . Move sort field: '' next col right
    R,H . Toggle: 'R' normal/reverse sort; 'H' show threads
    c,i,S . Toggle: 'c' cmd name/line; 'i' idle tasks; 'S' cumulative time
    x,y . Toggle highlights: 'x' sort field; 'y' running tasks
    z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
    u . Show specific user only
    n or # . Set maximum tasks displayed

    k,r Manipulate tasks: 'k' kill; 'r' renice
    d or s Set update interval
    W Write configuration file
    q Quit

  3. Story added...

    This story has been submitted to fsdaily.com! If you think this story should be read by the free software community, come vote it up and discuss it here:

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>