Saturday, March 10, 2007

Top to the Top

I have used the top command many times to find out, for example, what errent process was eating up all my memory or CPU. Recently I configured fluxbox to start top in a transparent, borderless, bar-less window at startup, so I could always see what was up, no pun intended.

What I had not done before, however, was read man top. It turns out top is much more than a simple command. There is an entire interactive interface! Just to get a quick idea, type "top" in a terminal. Once it starts, press "f". Up comes a menu to pick which columns you want to see displayed! Just press the letter displayed by each item (its case toggles as you toggle each option), and it will display (or not) once you go back to top (press any non-mapped key, like Tab).

Another neat one: press "o" while top is running. This lets you order the columns that display. I found I liked to have them ordered thus: "Command, PID, S, User, %CPU, %MEM, TIME+". And those are all I really needed, so I disabled the rest. Now top is far less cluttered and much easier to read. Along this same line, press "B" (yes, capital). This bolds important fields and values. It also bolds processes when they are in a Running state, again very useful.

An additional informative note and two warnings: For those woefully uninformed of the coolness of top, it can do quite a bit more than I have mentioned here. You can do a lot with it interactively. But you must be careful as well. Pressing "k", for instance allows you to kill a process after specifying its PID. In addition, after you have configured the columns, order, and anything else to your liking, be sure to press "W". This will write your current setup to ~/.toprc. Otherwise, it's all lost once top is stopped.

For more information on top's abilities in a form shorter than the gargantuan man page for it, see here.


Post a Comment

Subscribe to Post Comments [Atom]

<< Home