O'Reilly logo

Linux Server Hacks by Rob Flickenger

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

Hack #58. Monitor System Resources with top

Use the top utility to get a better overview of what your system is up to

The top command can give you up-to-the-second reporting of system load, memory usage, and CPU utilization. It is distributed as part of the procps package. The simplest way to get started is to simply run top from the command line:

$ top

You'll be presented with a screenful of information updated every two seconds.

3:54pm up 1 day, 16 min, 2 users, load average: 0.00, 0.00, 0.00 38 processes: 37 sleeping, 1 running, 0 zombie, 0 stopped CPU states: 0.0% user, 0.7% system, 0.0% nice, 99.2% idle Mem: 189984K av, 155868K used, 34116K free, 0K shrd, 42444K buff Swap: 257032K av, 0K used, 257032K free 60028K cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND 6195 rob 14 0 1004 1004 800 R 0.5 0.5 0:00 top 1 root 8 0 212 212 180 S 0.0 0.1 0:13 init 2 root 9 0 0 0 0 SW 0.0 0.0 0:00 keventd 3 root 9 0 0 0 0 SW 0.0 0.0 0:00 kswapd 4 root 9 0 0 0 0 SW 0.0 0.0 0:00 kreclaimd 5 root 9 0 0 0 0 SW 0.0 0.0 0:00 bdflush 6 root 9 0 0 0 0 SW 0.0 0.0 0:00 kupdated 8 root -1 -20 0 0 0 SW< 0.0 0.0 0:00 mdrecoveryd 176 root 9 0 788 788 680 S 0.0 0.4 0:00 syslogd 179 root 9 0 1228 1228 444 S 0.0 0.6 0:00 klogd 182 root 8 0 1228 1228 1104 S 0.0 0.6 0:06 sshd 184 root 8 0 616 616 520 S 0.0 0.3 0:00 crond 186 daemon 9 0 652 652 560 S 0.0 0.3 0:00 atd 197 root 9 0 2544 2544 2396 S 0.0 1.3 0:00 httpd 200 root 9 0 3740 3740 1956 S 0.0 1.9 0:00 named 202 root 9 0 1004 1004 828 ...

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