The TOP command

February 27, 2010 at 3:57 pm (commands, linux, terminal, tips)

So I found a nice little command the other day called ‘top’. Essentially what it does is show the top processes in your system in the terminal.  It’s simply run by issuing the following command:

$ top

A neat little thing about it though, is that it also shows the process ID. Which can then be ‘killed’. So for instance, I’ve got a program that’s misbehaving. I simply run top and find it’s process ID (pid…or to the far left). I can then run a command to kill it.

$ kill pid xxxx

Where xxxx is replaced by the actual number. So for instance if I want to kill Chromium, I simply run $ kill pid 8925.

There are also various hot keys that can be pressed while in top:

a or w- Sorts the processes in various modes. Cycles through all four windows.
k – Kills a command by entering it’s process ID. Easier than using $ kill pid xxxx.
q – Quits the program.
t – Turns on/off the summary information.
z – Turns on/off color.
A – Yes it’s ‘a’ that capitalized. It sorts your processes a bit differently and allows for an easier view of memory hogs.

2 Comments

  1. Randy said,

    try htop also. It like top but even cooler.

  2. Nathan said,

    Thanks for that tip. I’ve heard of htop, but never used it. Just tried it out today and yeah, much better. I’ll post that tip in a bit.

Leave a reply to Nathan Cancel reply