Google+

Friday 29 November 2013

Top command in Linux

The top command in Linux used to display the real time process activity of a running system. By default it list the high CPU intensive task processes. Process values are changed every 3 sec by default.
Top command displays the system uptime, Memory/CPU/Swap usage, no of users logged in and total no of processes running.
Load average shows the running/runnable or uninterruptible processes on the Linux server. The three values show the load averages for the last 01, 05, 15 minutes. 

top-command-explained

Explanation:


PID      – process id of the process

USER  – process owner
PR       – priority of the process
NI        – nice value of the process
VIRT   – total amount of virtual memory used by process
RES    – total amount of non-swapped physical memory used by the process
SHR    – total amount of shared memory used by the process.

Below are the options available in top command, give these options at the time of running the top command.


M   – To arrange the processes by RAM utilization.

P    – To arrange the processes by CPU utilization.
c    – To display or hide command/process full path.
r    – To renice a process. Press r and then give the PID (process id) to be reniced. Then give the        renice  value and press ENTER.
R    – To arrange the processes by PID number.
h    – To display other options available for top command.
1    – To display or hide the number of CPUs present on the Linux server.
k    – To kill a process in server. Press k and then enter the PID of the process to be killed. Press ENTER finally.
q    – To exit the top command.
s     - To change the display time interval results of top command. Time interval is given in seconds.
W   – To save the modified top command configuration.