top command is one of the tools used to monitor system usage and make changes to improve system performance in linux/unix. The top command displays a dynamic, real-time view of a system in use. It can show system summary information as well as a list of tasks that the Linux kernel is currently managing. The types of system summary information displayed, as well as the types, order, and size of information displayed for tasks, are all user configurable, and that configuration can be saved across restarts.
Normal Output of top Command:
top - 17:38:53 up 1:42, 0 users, load average: 0.05, 0.02, 0.00 Tasks: 72 total, 1 running, 71 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24654.1 free, 239.8 used, 283.1 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24607.5 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 39 root 20 0 1868052 27808 10188 S 0.7 0.1 0:00.61 fail2ban-server 1 root 20 0 168024 12008 9584 S 0.0 0.0 0:00.20 systemd 21 root 20 0 26192 13480 12128 S 0.0 0.1 0:00.25 systemd-journal 31 root 20 0 173356 24260 18040 S 0.0 0.1 0:00.03 php-fpm 34 root 20 0 163896 5704 4988 S 0.0 0.0 0:00.20 rsyslogd 35 root 20 0 16084 8548 7048 S 0.0 0.0 0:00.00 sshd 41 root 20 0 23656 15872 12552 S 0.0 0.1 0:00.05 httpd 42 root 20 0 6012 3544 2696 S 0.0 0.0 0:00.00 crond 49 root 20 0 11972 1244 68 S 0.0 0.0 0:00.00 sw-cp-serverd {altered}
Generally, we use top without any arguments, but the magic is mostly done from the top command line, which most of us skip. Well, before I take you to that part, let me explain the various system-related features that are shown by top command.
NOTE: We can enable or disable the marked red line by pressing “l” once top is running.
top - 17:38:53 up 1:42, 0 users, load average: 0.05, 0.02, 0.00 Tasks: 72 total, 1 running, 71 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.2 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24654.1 free, 239.8 used, 283.1 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24607.5 avail Mem
Explanation: This line provides information about system’s uptime as well as the load average.
NOTE:We can enable/disable the marked red line by pressing “t“.
top - 17:59:01 up 2:02, 0 users, load average: 0.03, 0.03, 0.00 Tasks: 49 total, 1 running, 48 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24674.6 free, 208.7 used, 293.7 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24630.5 avail Mem
Explanation: This line provides us with a brief summary of all the jobs that are now active, inactive, or stopped in the system, as well as the CPU usage.
Value | Meaning |
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 irq (or) % CPU time spent servicing/handling hardware interrupts |
si | software irq (or) % CPU time spent servicing/handling software interrupts |
st | steal time – – % CPU time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) % CPU time stolen from a virtual machine |
NOTE: We can enable/disable the marked red line by pressing “m“.
top - 17:59:01 up 2:02, 0 users, load average: 0.03, 0.03, 0.00 Tasks: 49 total, 1 running, 48 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24674.6 free, 208.7 used, 293.7 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24630.5 avail Mem
Explanation:The next line shows memory(RAM and swap) usage and capacity.
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 21 root 20 0 42576 27236 25884 S 0.3 0.1 0:03.23 systemd-journal 39 root 20 0 1868052 29916 10188 S 0.3 0.1 0:14.00 fail2ban-server 380 postfix 20 0 45364 7352 6384 S 0.3 0.0 0:00.62 qmgr 383 postfix 20 0 45332 8560 7492 S 0.3 0.0 0:00.08 trivial-rewrite 2671 root 20 0 7872 3764 3164 R 0.3 0.0 0:00.28 top 1 root 20 0 167904 11996 9584 S 0.0 0.0 0:02.57 systemd 31 root 20 0 173356 24260 18040 S 0.0 0.1 0:00.18 php-fpm 34 root 20 0 180276 12500 11708 S 0.0 0.0 0:02.53 rsyslogd 35 root 20 0 16084 8548 7048 S 0.0 0.0 0:00.00 sshd 41 root 20 0 23656 15872 12552 S 0.0 0.1 0:00.19 httpd 42 root 20 0 6012 3560 2696 S 0.0 0.0 0:00.00 crond 49 root 20 0 11972 1244 68 S 0.0 0.0 0:00.00 sw-cp-serverd 50 sw-cp-s+ 20 0 14824 4932 3384 S 0.0 0.0 0:00.00 sw-cp-serverd 64 apache 20 0 175132 10732 4400 S 0.0 0.0 0:00.00 php-fpm
The left sections shows the details of the process running along with the below details.
Fields | Description |
PID | Process Id |
USER | The effective user name of the task’s owner |
PR | The priority of the task |
NI | The nice value of the task. A negative nice value means higher priority, whereas a positive nice value means lower priority. Zero in this field simply means priority will not be adjusted in determining a task’s dispatchability |
%CPU | The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. |
%MEM | A task’s currently used share of available physical memory |
TIME+ | Total CPU time the task has used since it started |
S | The status of the task which can be one of: ‘D’ = uninterruptible sleep ‘R’ = running ‘S’ = sleeping ‘T’ = traced or stopped ‘Z’ = zombie |
RES | The non-swapped physical memory a task has used |
SHR | The amount of shared memory used by a task |
Command | Display the command line used to start a task or the name of the associated program |
Arrange Tasks with High to Low CPU Usage:
Press “P” or shift+p” once top is running to arrange all the tasks with High to Low CPU Usage as shown below.
[root@TechArticles:~]# top top - 18:29:08 up 2:33, 0 users, load average: 1.34, 0.49, 0.17 Tasks: 49 total, 5 running, 44 sleeping, 0 stopped, 0 zombie %Cpu(s): 49.6 us, 0.1 sy, 0.0 ni, 49.2 id, 0.0 wa, 0.0 hi, 1.0 si, 0.0 st MiB Mem : 25177.0 total, 24597.9 free, 214.0 used, 365.2 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24624.3 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4027 jay 20 0 6020 1844 0 R 100.0 0.0 0:07.64 bash 4028 jay 20 0 6020 1844 0 R 100.0 0.0 0:07.64 bash 4029 jay 20 0 6020 1844 0 R 100.0 0.0 0:07.64 bash 4030 jay 20 0 6020 1844 0 R 100.0 0.0 0:07.64 bash 1 root 20 0 168052 12016 9584 S 0.3 0.0 0:03.16 systemd 21 root 20 0 42576 30040 28688 S 0.3 0.1 0:03.96 systemd-journal 39 root 20 0 1868052 29916 10188 S 0.3 0.1 0:17.15 fail2ban-server 31 root 20 0 173356 24260 18040 S 0.0 0.1 0:00.21 php-fpm
Arrange Tasks with High to Low Memory Usage:
Press “M” or “shift+m“once top is running to arrange all the tasks with High to Low Memory Usage as shown below.
[root@TechArticles:~]# top top - 18:35:02 up 2:38, 0 users, load average: 1.43, 2.17, 1.13 Tasks: 46 total, 2 running, 44 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.5 us, 11.7 sy, 0.0 ni, 87.5 id, 0.0 wa, 0.0 hi, 0.4 si, 0.0 st MiB Mem : 25177.0 total, 7031.2 free, 17779.9 used, 365.9 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 7058.3 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 4406 jay 20 0 17.1g 17.1g 1860 R 100.0 69.6 0:10.09 tail 21 root 20 0 42576 31104 29752 S 0.0 0.1 0:04.39 systemd-journal 39 root 20 0 1868052 29916 10188 S 0.3 0.1 0:18.83 fail2ban-server 31 root 20 0 173356 24260 18040 S 0.0 0.1 0:00.23 php-fpm 74 apache 20 0 2524676 17992 5832 S 0.0 0.1 0:01.12 httpd 75 apache 20 0 2327872 15940 5836 S 0.0 0.1 0:01.06 httpd 78 apache 20 0 2262336 15940 5836 S 0.0 0.1 0:01.06 httpd 41 root 20 0 23656 15872 12552 S 0.0 0.1 0:00.25 httpd 34 root 20 0 180276 14880 14064 S 0.3 0.1 0:03.39 rsyslogd 1 root 20 0 168052 12016 9584 S 0.0 0.0 0:03.53 systemd
How to Change the nice value (priority) of any task:
Press “r” when top is running on the terminal. You should get a prompt as shown below in red color.
[root@TechArticles:~]# top top - 18:42:37 up 2:46, 0 users, load average: 0.03, 0.53, 0.72 Tasks: 46 total, 1 running, 45 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24586.9 free, 215.3 used, 374.9 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24614.9 avail Mem PID to renice [default pid = 3896] PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3896 jay 20 0 6536 5824 3452 S 0.0 0.0 0:00.02 bash 4706 jay 20 0 7872 3888 3292 S 0.0 0.0 0:00.07 top
Give the PID which nice value has to be changed and hit “Enter”. Then give the nice value for the PID
top - 18:45:20 up 2:49, 0 users, load average: 0.00, 0.31, 0.60 Tasks: 46 total, 1 running, 45 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24586.1 free, 215.7 used, 375.2 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24614.5 avail Mem Renice PID 4706 to value -9 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3896 jay 20 0 6536 5824 3452 S 0.0 0.0 0:00.02 bash 4706 jay 20 0 7872 3888 3292 S 0.0 0.0 0:00.16 top
Renice PID 4706 to value: -9 [Hit Enter]
Verify the changes:
[root@TechArticles:~]# top top - 18:48:22 up 2:52, 0 users, load average: 0.00, 0.16, 0.49 Tasks: 77 total, 1 running, 76 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24549.1 free, 251.8 used, 376.1 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24578.1 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3896 jay 20 0 6536 5824 3452 S 0.0 0.0 0:00.02 bash 4706 jay 11 -9 7980 4000 3292 S 0.1 0.0 0:00.27 top
Killing a task without exiting from top:
Press “k” on the terminal when top is running. We should get a prompt as shown below in red color
[root@TechArticles:~]# top top - 18:50:36 up 2:54, 0 users, load average: 0.04, 0.12, 0.43 Tasks: 55 total, 1 running, 54 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24581.2 free, 219.5 used, 376.3 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24610.4 avail Mem PID to signal/kill [default pid = 3896] PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3896 jay 20 0 6536 5824 3452 S 0.0 0.0 0:00.02 bash 4706 jay 20 0 7980 4000 3292 S 0.1 0.0 0:00.35 top
Type the PID you want to kill and Hit Enter as shown below. It will kill instantly relevent PID processes
[root@TechArticles:~]# top top - 18:50:36 up 2:54, 0 users, load average: 0.04, 0.12, 0.43 Tasks: 55 total, 1 running, 54 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24581.2 free, 219.5 used, 376.3 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 24610.4 avail Mem Send pid 4706 signal [15/sigterm] PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3896 jay 20 0 6536 5824 3452 S 0.0 0.0 0:00.02 bash 4706 jay 20 0 7980 4000 3292 S 0.1 0.0 0:00.35 top
View all the processes running by a user:
Press “u” on the terminal when top is running. We should get a prompt as shown below in red color
[root@TechArticles:~]# top top - 18:56:33 up 3:00, 0 users, load average: 0.50, 0.20, 0.35 Tasks: 61 total, 2 running, 59 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 1.0 sy, 0.0 ni, 98.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 385.8 free, 24414.1 used, 377.1 buff/cache MiB Swap: 7168.0 total, 7168.0 free, 0.0 used. 415.8 avail Mem Which user (blank for all) PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6170 jay 20 0 23.6g 23.6g 1752 R 91.7 95.9 0:33.84 tail 21 root 20 0 50768 38112 36732 S 0.3 0.1 0:06.08 systemd-journal 39 root 20 0 1868052 29928 10188 S 0.3 0.1 0:25.52 fail2ban-server 78 apache 20 0 2262336 15940 5836 S 0.3 0.1 0:01.48 httpd 1 root 20 0 168052 12032 9584 S 0.0 0.0 0:04.84 systemd 31 root 20 0 173356 24260 18040 S 0.0 0.1 0:00.30 php-fpm 34 root 20 0 188468 18460 17604 S 0.0 0.1 0:04.65 rsyslogd
Type the username that you want to show processes for.
[root@TechArticles:~]# top top - 18:59:24 up 3:03, 0 users, load average: 0.62, 0.39, 0.40 Tasks: 61 total, 3 running, 58 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.7 us, 14.9 sy, 0.0 ni, 79.5 id, 3.5 wa, 0.0 hi, 1.4 si, 0.0 st MiB Mem : 25177.0 total, 168.7 free, 24961.8 used, 46.5 buff/cache MiB Swap: 7168.0 total, 6683.9 free, 484.1 used. 100.6 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 6448 jay 20 0 24.6g 24.2g 428 R 81.8 98.3 0:12.45 tail 6211 jay 20 0 7872 368 0 S 3.9 0.0 0:00.27 top 3896 jay 20 0 6536 8 4 S 0.0 0.0 0:00.02 bash 5959 jay 20 0 6020 180 180 S 0.0 0.0 0:00.02 bash
Change delay between terminal refresh:
By default the top terminal is set for auto refresh after every 3 seconds but if you want you can change it as per your requirement.
Press “d” when top is running. We should get a prompt as shown below in red color.
[jay@TechArticles ~]$ top top - 19:02:21 up 3:06, 0 users, load average: 0.35, 0.69, 0.55 Tasks: 59 total, 1 running, 58 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24805.2 free, 277.6 used, 94.2 buff/cache MiB Swap: 7168.0 total, 6959.3 free, 208.7 used. 24629.4 avail Mem Change delay from 3.0 to 2 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 34 root 20 0 196660 15064 14444 S 0.3 0.1 0:05.02 rsyslogd 39 root 20 0 1868052 9316 0 S 0.3 0.0 0:27.84 fail2ban-server 378 root 20 0 38112 108 0 S 0.3 0.0 0:01.88 master 380 postfix 20 0 45364 164 0 S 0.3 0.0 0:01.30 qmgr
Verify the changes. You must see the screen buffer getting refresh much earlier or just to verify you can provide a higher value of delay and observer the refresh rate on the terminal
No. of task to be displayed:
By default this option is set to unlimited that is the reason your terminal is fully covered with list of tasks when you run the top command. Any how you can list the no of tasks to be visible once you run top command.
Press “n“when top is running. You should get a prompt as shown below in red color
[root@TechArticles:~]# top top - 19:05:23 up 3:09, 0 users, load average: 0.13, 0.41, 0.46 Tasks: 60 total, 1 running, 59 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24803.1 free, 278.6 used, 95.3 buff/cache MiB Swap: 7168.0 total, 6960.3 free, 207.7 used. 24627.5 avail Mem Maximum tasks = 0, change to (0 is unlimited) PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 167924 5524 4388 S 0.0 0.0 0:05.53 systemd 21 root 20 0 58960 33164 32692 S 0.0 0.1 0:06.97 systemd-journal 31 root 20 0 173356 3048 148 S 0.0 0.0 0:00.37 php-fpm 34 root 20 0 196660 15444 14820 S 0.0 0.1 0:05.19 rsyslogd 35 root 20 0 16084 664 0 S 0.0 0.0 0:00.00 sshd 39 root 20 0 1868052 9316 0 S 0.0 0.0 0:28.67 fail2ban-server 41 root 20 0 23656 2044 1004 S 0.0 0.0 0:00.38 httpd 42 root 20 0 6012 1716 1160 S 0.0 0.0 0:00.01 crond [Output truncated]
Type the number of process you want to dispaly on top and hit enter. i.e I choose 3.
[jay@TechArticles:~]# top top - 19:07:30 up 3:11, 0 users, load average: 0.07, 0.29, 0.40 Tasks: 59 total, 1 running, 58 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.1 us, 0.2 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st MiB Mem : 25177.0 total, 24797.3 free, 280.9 used, 98.9 buff/cache MiB Swap: 7168.0 total, 6960.8 free, 207.2 used. 24623.2 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 39 root 20 0 1868052 10572 0 S 0.3 0.0 0:29.23 fail2ban-server 380 postfix 20 0 45364 164 0 S 0.3 0.0 0:01.37 qmgr 6950 root 20 0 7872 3832 3236 R 0.3 0.0 0:00.01 top
View live individual CPU processor performance::
By default top command shows the average of all the available CPUs in the machine.
In case if you want to see report of all the individual CPUs press “1” once you are running top command and you will get to see something like below
[root@TechArticles:~]# top top - 19:09:59 up 3:13, 0 users, load average: 0.04, 0.20, 0.35 Tasks: 60 total, 1 running, 59 sleeping, 0 stopped, 0 zombie %Cpu0 : 0.3 us, 0.3 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu1 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu2 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu3 : 0.7 us, 0.0 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu4 : 0.3 us, 0.3 sy, 0.0 ni, 99.3 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.3 us, 0.0 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu7 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24796.4 free, 281.0 used, 99.7 buff/cache MiB Swap: 7168.0 total, 6961.3 free, 206.7 used. 24622.5 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 39 root 20 0 1868052 10572 0 S 0.7 0.0 0:29.91 fail2ban-server 1 root 20 0 167924 5728 4548 S 0.0 0.0 0:05.80 systemd 41 root 20 0 23656 2044 1004 S 0.0 0.0 0:00.39 httpd
Add a new field in top output::
By default we see limited set of output when use the top command. But apart from those there are a other list of field which can be added to the top output. To view all the list of field which can be added, Follow the below steps.
- Run top command
- then Press “f” which will take you the list of available fields under top command.
- All the field initials stated in BLOCK letters are visible by default when you issue top command. To add a new field press the field initial as shown in the first column.
Fields Management for window 1:Def, whose current sort field is %CPU Navigate with Up/Dn, Right selects for move then <Enter> or Left commits, 'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end! * PID = Process Id DATA = Data+Stack (KiB) * USER = Effective User Name nMaj = Major Page Faults * PR = Priority nMin = Minor Page Faults * NI = Nice Value nDRT = Dirty Pages Count * VIRT = Virtual Image (KiB) WCHAN = Sleeping in Function * RES = Resident Size (KiB) Flags = Task Flags <sched.h> * SHR = Shared Memory (KiB) CGROUPS = Control Groups * S = Process Status SUPGIDS = Supp Groups IDs * %CPU = CPU Usage SUPGRPS = Supp Groups Names * %MEM = Memory Usage (RES) TGID = Thread Group Id * TIME+ = CPU Time, hundredths OOMa = OOMEM Adjustment * COMMAND = Command Name/Line OOMs = OOMEM Score current PPID = Parent Process pid ENVIRON = Environment vars UID = Effective User Id vMj = Major Faults delta RUID = Real User Id vMn = Minor Faults delta RUSER = Real User Name USED = Res+Swap Size (KiB) SUID = Saved User Id nsIPC = IPC namespace Inode SUSER = Saved User Name nsMNT = MNT namespace Inode GID = Group Id nsNET = NET namespace Inode GROUP = Group Name nsPID = PID namespace Inode PGRP = Process Group Id nsUSER = USER namespace Inode TTY = Controlling Tty nsUTS = UTS namespace Inode TPGID = Tty Process Grp Id LXC = LXC container name SID = Session Id RSan = RES Anonymous (KiB) nTH = Number of Threads RSfd = RES File-based (KiB) P = Last Used Cpu (SMP) RSlk = RES Locked (KiB) TIME = CPU Time RSsh = RES Shared (KiB) SWAP = Swapped Size (KiB) CGNAME = Control Group name CODE = Code Size (KiB) NU = Last Used NUMA node
- Fields Management for window 1:Def, whose current sort field is %CPU
- Navigate with Up/Dn, Right selects for move then <Enter> or Left commits,
- ‘d’ or <Space> toggles display, ‘s’ sets sort. Use ‘q’ or <Esc> to end!
To add the “swap” field, for example, user “down arrow key and highlight swap then press space key to select and Press “q” or esc to return to the top output. You will see something similar to the image below.
top - 19:37:09 up 3:41, 0 users, load average: 0.02, 0.01, 0.06 Tasks: 50 total, 1 running, 49 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.2 us, 0.3 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 25177.0 total, 24782.9 free, 279.1 used, 115.1 buff/cache MiB Swap: 7168.0 total, 6965.3 free, 202.7 used. 24611.9 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM COMMAND SWAP TIME+ 21 root 20 0 75344 43552 43080 S 0.3 0.2 systemd-journal 908 0:09.49 39 root 20 0 1868052 10836 0 S 0.3 0.0 fail2ban-server 9152 0:38.79 78 apache 20 0 2262336 612 92 S 0.3 0.0 httpd 9588 0:02.28 378 root 20 0 38112 832 720 S 0.3 0.0 master 356 0:02.64 1 root 20 0 167924 5732 4548 S 0.0 0.0 systemd 1244 0:07.53 31 root 20 0 173356 3048 148 S 0.0 0.0 php-fpm 3324 0:00.49 34 root 20 0 213044 20884 20188 S 0.0 0.1 rsyslogd 240 0:07.08 35 root 20 0 16084 664 0 S 0.0 0.0 sshd 836 0:00.00 41 root 20 0 23656 2044 1004 S 0.0 0.0 httpd 2280 0:00.49 42 root 20 0 6012 1904 1344 S 0.0 0.0 crond 304 0:00.01 [Output Trancated]