O'Reilly logo

Linux Utilities Cookbook by James Kent Lewis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Examining processes using top

The top program is similar to ps except that it shows the state of the system in real time. You can control how it operates using command line switches and/or its interactive interface. It can also use a configuration file. You can do quite a bit with top. The following are some examples of what is possible.

Getting ready

No special setup is needed. These commands will be run as root.

To get help for top, you can run the following command line:

      top -h or -v

These are equivalent and show the library version and usage.

The general syntax for top is as follows:

      top -bcHisS -d delay -n iterations -p pid [,pid...]

The following is a screenshot of top running on Fedora 17:

How to do it...

Following are some examples using the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required