There are lots of terminal based real-time system reporting tools such as glances and htop that are prettier than classic top
.
However, sometimes you find yourself on systems that don’t have glances
or htop
installed so you’ve got to use top
. These tips will make top’s output a bit more useful.
Show CPU cores individually
The default output for top
is to summarize the system load of all cores. Here’s my laptop:
%Cpu(s): 0.4 us, 0.3 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.1 hi, 0.0 si, 0.0 st
You can make top
show every core’s current use by pressing 1 while it is open. This transforms the CPU line shown above to this:
top - 15:35:42 up 5:17, 1 user, load average: 0.42, 0.54, 0.68
Tasks: 245 total, 1 running, 244 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.7 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.7 us, 0.0 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.7 si, 0.0 st
%Cpu3 : 0.6 us, 3.2 sy, 0.0 ni, 95.5 id, 0.0 wa, 0.6 hi, 0.0 si, 0.0 st
%Cpu4 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu5 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu6 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu7 : 0.7 us, 0.0 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
GiB Mem : 15.1 total, 9.9 free, 2.9 used, 2.3 buff/cache
GiB Swap: 0.2 total, 0.2 free, 0.0 used. 11.1 avail Mem
Display use as bars
Even better, you can transform these numbers to bar charts by pressing t:
top - 15:34:09 up 5:15, 1 user, load average: 0.62, 0.62, 0.72
Tasks: 246 total, 1 running, 245 sleeping, 0 stopped, 0 zombie
%Cpu0 : 16.7/3.3 20[|||||||||||
%Cpu1 : 23.5/3.9 27[||||||||||||||
%Cpu2 : 28.8/3.3 32[|||||||||||||||||
%Cpu3 : 7.4/4.7 12[||||||
%Cpu4 : 48.4/3.9 52[||||||||||||||||||||||||||||
%Cpu5 : 13.6/3.2 17[|||||||||
%Cpu6 : 37.1/3.3 40[||||||||||||||||||||||
%Cpu7 : 13.2/4.6 18[|||||||||
GiB Mem : 15.1 total, 9.9 free, 2.9 used, 2.3 buff/cache
GiB Swap: 0.2 total, 0.2 free, 0.0 used. 11.2 avail Mem