Tuesday 7 February 2012

The Linux top Command

top command is known as Process activity command, The top program provides a dynamic real-time view of a running system, In top first 5 lines are the following,

top: present time, uptime, logged in users, load average of cpu in last 1min,5min,15min.

Tasks(in number): total process, running process, sleeping process, stopped process, zombie process.

CPU(s)(usage in %): user related process, system related process,nice related process, ideal process, wait process, hardware IRQ, software IRQ, System still. Suppose you have more than one cpu then press '1' to see the details, to hide the second cpu press '1' again.

mom(usage in kilo bytes): total RAM, used, free, buffers.
swap(usage in kilo bytes): total swap memory, used, free, cached.

m    - displays memory information off and on.
t      - cpu and process information off and on.
l      - load average information off and on.

The 6th line is for entering command such as,

r     - to renice (give PID and new nice value)
k    - to kill a process (give PID of the process)

The 7th line can be explained as,

PID                    lists process identification number(for cpu communication)
USER                lists user of that particular process
NI                      shows priority value of each process (-20 to 19)
VIRT                 shows virtual memory used for each process
RES                  shows residance memory
SHR                  shows shared memory
S                      shows status of the process(s-sleeping, R-running, z-zombie)
%CPU              % of cpu used for each process
%MEM             % of memory used for each process
TIME+               prints how long the particular process is running in background
COMMAND        prints which command used to run the process

Hot keys of top

R     - to sort PID number off and on
u      - to fileter in username (give username then press enter key, no username for show all)
P      - to sort according to cpu
M    - to sort according to memory
c     - to get command information
A     - it sorts by top consumers of various system resources off and on.
f      - provides an interactive configuration screen for top. Helpful for setting up top for a specific task.
o     - to enable interactively select the ordering within top.
n     - the maximum task to be displayed(0 for display all)
d     - to change delay in updation (in sec)
z     - to turn on or off color/mono
w    - write to save
q    - quit or Crl+C
h    - show all threads

No comments:

Post a Comment