Tuesday, October 23, 2012

Linux “TOP” Command options

Linux “TOP” Command options


# top :  top command displays processor activity of your Linux box and also displays tasks managed by kernel in real-time.

Keys for more options with “TOP” Command


Command
Specification
Description
Shift+O
Sort
To Sort field via field letter, for example press ‘a‘ letter to 
sort process with Process ID. Type any key to return to main
 top window.
u
Filter with user
Use top command with ‘u‘ option will display specific User
process details.
Ex : # top -u tecmint 
z
Color window
Press ‘z‘ option in running top command will display running process
in color  which may help you to identified running process easily
c
Path
Press ‘c‘ option in running top command, it will display absolute path
 of running  process.
d
Refresh time
By default screen refresh interval is 3.0 seconds, same can be change
pressing   ‘d‘ option in running top command and change it as desired
as shown below.
k
kill
You can kill a process after finding PID of process by pressing ‘k‘ 
option in running top command without exiting from top window
as shown below.
Shift+P
CPU
To sort processes as per CPU utilization. See screenshot below
r
Priority
You can use ‘r‘ option to change the priority of the process also
called Renice.
Shift+W
Save to file
To save the running top command results under /root/.toprc.
h
Help
Press ‘h‘ option to obtain the top command help.
q
quit
Top output keep refreshing until you press ‘q‘. With below command 
top command will automatically exit after 10 number of repetition.