Here is the video version, if you prefer it:
Let’s look at the output produced by top
and explain what does it all mean:
mislav@mislavovo-racunalo:~/Linux_folder$ top
top - 13:15:58 up 101 days, 19:37, 1 user, load average: 0.44, 0.42, 0.44
Tasks: 241 total, 1 running, 239 sleeping, 0 stopped, 1 zombie
%Cpu(s): 0.2 us, 0.1 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7853.8 total, 127.8 free, 4300.2 used, 3425.8 buff/cache
MiB Swap: 8066.0 total, 6694.0 free, 1372.0 used. 2891.4 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8770 mislav 20 0 3002016 320192 111444 S 1.0 4.0 5:46.85 Web Content
8357 mislav 20 0 3524552 369556 151704 S 0.3 4.6 5:26.81 firefox-esr
14417 mislav 20 0 4222052 321880 168376 S 0.3 4.0 0:31.67 anki
...
- First we have some information about current time, how long my machine has been running and how many users are logged in (Shotts, 2019)
load average
– how many processes is your computer executing in the last minute, last 5 minutes, last 15 minutesTasks
– how many tasks are there on the computer – 1 is running (meaning being actively executed), 239 are sleeping (meaning waiting for something to happen (such as data from a device) to resume their execution), 0 stopped (meaning no processes whose execution was paused manually) and 1 zombie process (zombie process is a process whose parent process doesn’t exist anymore)%Cpu(s)
tells us what percentage of the CPU is being used on what kinds of processes:us
is for user processes,sy
is for system (kernel) processes,ni
is for nice (low-priority) processes,id
is for the percentage of the CPU that is idle,wa
is for percentage of the CPU waiting for some input/output tasks,hi
is the time spent processing hardware interrupts,si
is the time processing software interrupts andst
is relevant to virtual environments – if you don’t know what virtual environments are, that needn’t concern you (“Linux ‘top’ command: What are us, sy, ni, id, wa, hi, si and st (for CPU usage)?,” n.d.)MiB Mem
andMiB swap
tell you how much RAM and how much swap space is being used (measured in mebibytes (“Mebibyte,” n.d.))
Let’s now look at the columns available for each process: (“A Guide to the Linux ‘Top’ Command,” n.d.)
PID
– proces IDUSER
– user who owns the processPR
– process priorityNI
– niceness (nice value) of a processVIRT
– total amount of memory consumed by the process (permanent storage device + RAM – the basic idea is that if the operating system runs out of RAM, it can use some memory available on the permanent storage device in addition to the RAM; this concept is called virtual memory – look it up on Google if you are interested)RES
– memory consumed by the process in RAMSHR
– amount of memory shared with other processes (processes can share memory)S
– process state (is the process running, is it sleeping, …)%CPU
– how much CPU is the process using (in percentages)%MEM
– how much memory is the process using (in percentages)TIME+
– total time used by the process since it startedCOMMAND
– the name of the process
Hope you understand the output of top in detail now and hope you refreshed your memory!
References
A Guide to the Linux “Top” Command. (n.d.). Retrieved February 19, 2020, from https://www.booleanworld.com/guide-linux-top-command/#Understanding_top8217s_interface_the_task_area
Linux “top” command: What are us, sy, ni, id, wa, hi, si and st (for CPU usage)? (n.d.). Retrieved February 19, 2020, from https://unix.stackexchange.com/questions/18918/linux-top-command-what-are-us-sy-ni-id-wa-hi-si-and-st-for-cpu-usage
Mebibyte. (n.d.). Retrieved February 19, 2020, from https://en.wikipedia.org/wiki/Mebibyte
Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from http://linuxcommand.org/tlcl.php. Pages 137-139
Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.