Most useful commands used in TOP


Top is amongst the most comprehensive and informative process display command in Linux. There’s no reason for a seasoned Linux sysadmin like myself not to know it! Top can display all the information you need to know about processes and systems information in a sorted manner.

In this post I want myself to be reminded of only the MOST USEFUL and MOST FREQUENTLY USED commands used in TOP and the rest I’m going to forget them!

h – Help – Yes, use it if you’re as forgetful as me.
M – Sort by memory usage
P – Sort by CPU usage
c – Display path and exact command
z – Change colours – I hate Black & White
u – Display only processes owned by a specific user, enter nothing for All
q – Quit or you can crtl-c to kill it.
k – to kill a process based on PID without exiting from TOP!

PID to kill:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
4404 mysql 18 0 322m 45m 6716 S 0.0 1.5 1:41.52 /usr/libexec/mysqld --basedir=/usr --datadir=/var/
10973 apache 18 0 75932 40m 5928 S 0.0 1.3 1:45.42 /usr/sbin/httpd
21627 apache 18 0 75712 40m 5920 S 0.0 1.3 1:53.84 /usr/sbin/httpd
21623 apache 15 0 75708 39m 5956 S 0.0 1.3 1:56.99 /usr/sbin/httpd
10971 apache 18 0 75680 39m 5968 S 0.0 1.3 1:44.57 /usr/sbin/httpd

I think that’s really the minimum options a sysadmin should know on top of their head without looking at the MAN page.

Related Posts with Thumbnails

About the Author

Alfred Tong
Author and owner of this blog. A Networking enthusiast, full time networking and systems Engineer. Generally curious about all things IT.Certifications: GIAC GSEC, CCNP-S, CCNP, CCSP, CCDP, CCNA, RHCE, JNCIA - FWV