Top

From Leo's Notes
(Redirected from Top Tips & Tricks)
Last edited on 30 December 2021, at 01:34.

The top utility is part of the procps-ng package and shows the system's workload and resource status. It is analogous to the task manager in windows.

Usage

Run top -d 1.

To quit, hit q or Ctrl c.

Toggle CPU header with t


CPU Fields Explained

The first few lines of the top command looks similar to this:

Tasks: 137 total, 1 running, 136 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 4.2%sy, 90.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 5.8%st
Mem: 786432k total, 715152k used, 71280k free, 61012k buffers
Swap: 2096472k total, 18304k used, 2078168k free, 168068k cached

The fields on the second line breaks down the CPU usage into 8 categories.

Field Name Description
us user CPU used by user processes
sy system CPU used by system/kernel processes
ni nice CPU used by processes that were reniced
id idle CPU not used
wa io wait Essentially idle CPU waiting on IO devices
hi hardware irq CPU used to service hardware IRQs
si software irq CPU used to service soft IRQs
st steal time CPU time which the hypervisor dedicated (or ‘stole’) for other guests in the system.