The top command can be used to monitor the performance of Linux Server which gives crucial performance statistics like CPU utilization, memory usage, load average, uptime and processes that are running on the system.
Following is a screenshot of the output of the top command, which gives the statistics like system uptime, running processes along with details, CPU and memory utilization.
Let’s see the detailed descriptions of each and every line that it represents.
Uptime & Load average
Let’s start with the first line. It contains the current time, system uptime duration, number of active user sessions and load average on the system for the last one minute, five minutes and fifteen minutes respectively in that order.
Load is a measure of the amount of computational work a system performs. On Linux, the load is the number of processes in the R and D states at any given moment. The load average value gives you a relative measure of how long you must wait for things to get done.
The second line contains information about total number processes (or tasks), number of running processes, number of sleeping processes, number of processes that have stopped, and number of processes in the zombie state (dead/killed state) in that order.
The third line contains CPU-usage information, the following is the detailed explanation along with %Cpu(s) abbreviations
us – user CPU time or % CPU time spent in user space
sy – system CPU time or % CPU time spent in kernel space
ni – user nice CPU time or % CPU time spent on low priority processes
id – idle CPU time or % CPU time spent idle
wa – io wait CPU time or % CPU time spent in wait (on disk)
hi – hardware interrupt request (IRQ) or % CPU time spent servicing/handling hardware interrupts
si – software interrupt request (IRQ) or % CPU time spent servicing/handling software interrupts
st – steal time % CPU time in involuntary wait by virtual CPU while the hypervisor is servicing another processor or % CPU time stolen from a virtual machine
The fourth line contains the Memory usage information, the following is a detailed explanation.
The lines marked Mem and Swap show information about RAM and swap space respectively.
swap space is a part of the hard disk that is used as RAM. When the RAM usage gets nearly full, infrequently used regions of the RAM are written into the swap space, ready to be retrieved later when needed. However, because accessing disks are slow, relying too much on swapping can harm system performance.
total – is the total amount of memory available (RAM)
free – is the total amount of free memory available at that moment
used – is the total amount of used memory at that moment
buff/cache – The Linux kernel tries to reduce disk access times in various ways. It maintains a disk cache in RAM, where frequently used regions of the disk are stored. In addition, disk writes are stored to a disk buffer, and the kernel eventually writes them out to the disk. The total memory consumed by them is the buff/cache value. It might sound like a bad thing, but it really isn’t — memory used by the cache will be allocated to processes if needed.
Let’s look at the process details and all other information that the top command provides in the next series of posts.