The commands in this section are your tools for monitoring the physical resources (disk space, swap space, memory) and performance of your system.
Frequently, an executing program is too large for the entire program to be contained in your system RAM. In such a case, the system writes a portion of the program that is not currently executing out to disk temporarily. This process is known as paging, because the programs are broken up into units called pages. When an executing process needs a page not currently stored in the RAM, that is a page fault. Lots of page faults are bad; they can slow the system to a crawl. The portion of disk space used for paging is called the swap partition.
Disk space is cheap. Don't skimp on the size of your swap partition. It should be at least as large as your physical memory, and potentially much larger. |
The most complete picture of your system's memory use is obtained via the vmstat command. Learn how to read it and use it regularly; it will give you a clear picture of how well your system resources are being utilized.
If you have an immediate and acute problem, the top command will give you a quick highlight of what your system is doing.
Shared memory is allocated memory that is accessible by more than one process.
A semaphore is anything (e.g., system file, program variable) used to indicate that a resource is in use.
df | Display filesystem information. |
dmesg | Display bootup messages. |
free | Display snapshot of system memory. |
ipcs | Display shared memory, semaphores, message queues. |
ps | Get process information. (See Chapter 3.) |
pstree | Display process family tree. |
runlevel | Display system runlevel information. |
tload | Display graph CPU usage information. |
top | Display system usage information. |
vmstat | Display memory information. |
who | Display user information. |