Viewing system performance details with the top command
The Linux top command has been around since 1984, helping Linux admins gauge system performance and note which processes are using the most system resources. Since that time, a number of other “top” commands (e.g., atop and htop) have become available with their different takes on what sysadmins need to pay attention to. The top command, however, remains one of the most heavily used and easy to understand commands for viewing system performance.
The basic top command
The basic form of the top command — what you see when you simply type “top” — shows the most useful performance statistics you’re likely to find on a Unix system. The top command starts by supplying you with five lines that provide an important synopsis of what the system is doing: how long it’s been up, the current load average (displaying how busy it is), the number of processes being run, and memory and swap usage. Here’s an example:
$ top top - 12:15:36 up 5 days, 3:01, 3 users, load average: 0.07, 0.11, 0.06 Tasks: 244 total, 1 running, 243 sleeping, 0 stopped, 0 zombie %Cpu(s): 2.8 us, 5.6 sy, 0.0 ni, 91.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 3784.7 total, 403.9 free, 1066.8 used, 2314.0 buff/cache MiB Swap: 3784.0 total, 3756.0 free, 28.0 used. 2325.5 avail Mem
A few numbers to pay attention to when you use top are the three load averages in the upper right corner of the output. These describe the load average (how busy the system has been) over the last minute, the last five minutes, and the last 15 minutes. These numbers give you some idea about how heavily loaded the system is. Just keep in mind that they’re only looking at the last 15 minutes.