Chapter 2. Resource Monitoring
21
Tip
A better solution than using free s would be to run free using the watch command. For example,
to display memory utilization every two seconds (the default display interval), use this command:
watch free
The watch command issues the free command every two seconds, after first clearing the screen.
This makes it much easier to see how memory utilization changes over time, as it is not necessary to
scan continually scrolling output. You can control the delay between updates by using the n option,
and can cause any changes between updates to be highlighted by using the d option, as in the
following command:
watch n 1 d free
For more information, refer to the watch man page.
The watch command runs until interrupted with [Ctrl] [C]. The watch command is something to keep
in mind; it can come in handy in many situations.
2.5.2.
top
While
free
displays only memory related information, the
top
command does a little bit of every
thing. CPU utilization, process statistics, memory utilization
top
does it all. In addition, unlike
the
free
command,
top
's default behavior is to run continuously; there is no need to use the
watch
command. Here is a sample display:
11:13am
up 1 day, 31 min,
5 users,
load average: 0.00, 0.05, 0.07
89 processes: 85 sleeping, 3 running, 1 zombie, 0 stopped
CPU states:
0.5% user,
0.7% system,
0.0% nice, 98.6% idle
Mem:
255508K av, 241204K used,
14304K free,
0K shrd,
16604K buff
Swap: 530136K av,
56964K used, 473172K free
64724K cached
PID USER
PRI
NI
SIZE
RSS SHARE STAT %CPU %MEM
TIME COMMAND
8532 ed
16
0
1156 1156
912 R
0.5
0.4
0:11 top
1520 ed
15
0
4084 3524
2752 S
0.3
1.3
0:00 gnome terminal
1481 ed
15
0
3716 3280
2736 R
0.1
1.2
0:01 gnome terminal
1560 ed
15
0 11216
10M
4256 S
0.1
4.2
0:18 emacs
1 root
15
0
472
432
416 S
0.0
0.1
0:04 init
2 root
15
0
0
0
0 SW
0.0
0.0
0:00 keventd
3 root
15
0
0
0
0 SW
0.0
0.0
0:00 kapmd
4 root
34
19
0
0
0 SWN
0.0
0.0
0:00 ksoftirqd_CPU0
5 root
15
0
0
0
0 SW
0.0
0.0
0:00 kswapd
6 root
25
0
0
0
0 SW
0.0
0.0
0:00 bdflush
7 root
15
0
0
0
0 SW
0.0
0.0
0:00 kupdated
8 root
25
0
0
0
0 SW
0.0
0.0
0:00 mdrecoveryd
12 root
15
0
0
0
0 SW
0.0
0.0
0:00 kjournald
91 root
16
0
0
0
0 SW
0.0
0.0
0:00 khubd
185 root
15
0
0
0
0 SW
0.0
0.0
0:00 kjournald
186 root
15
0
0
0
0 SW
0.0
0.0
0:00 kjournald
576 root
15
0
712
632
612 S
0.0
0.2
0:00 dhcpcd
The display is divided into two sections. The top section contains information related to overall system
status uptime, load average, process counts, CPU status, and utilization statistics for both memory
and swap space. The lower section displays process level statistics, the exact nature of which can be
controlled while
top
is running.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved