Top command in CentOS/RHEL

Share It!

Top shows the main 30 processes on the system and periodically updates this information. It can show system summary information as well as a list of task presently being managed by the Linux kernal. It can sort the taks by CPU utilization, memory use and runtime.

# top

Output:

top - 03:21:01 up 33 days, 13:49,  1 user,  load average: 0.07, 0.03, 0.01
Tasks:  50 total,   1 running,  49 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
Mem:   4194304k total,  3791040k used,   403264k free,        0k buffers
Swap:  2097152k total,        0k used,  2097152k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 9967 apache    17   0  733m 147m  50m S  0.3  3.6   0:01.07 httpd
    1 root      18   0 19232 1436 1208 S  0.0  0.0   0:01.50 init
 1181 root      14  -4 10644  580  324 S  0.0  0.0   0:00.00 udevd
 1662 root      15   0  179m 3868 1116 S  0.0  0.1  58:16.08 rsyslogd
 1703 sw-cp-se  18   0 62596 4536 1928 S  0.0  0.1   0:06.83 sw-cp-serverd
....

How about we see now each and every column of this yield to clarify all the information found inside of the screen:

Uptime and Load Averages

top - 03:21:01 up 33 days, 13:49,  1 user,  load average: 0.07, 0.03, 0.01

Understanding the output of TOP command:

  • server current time (03:21:01)
  • the time your system is been up (33 days, 13:49)
  • number of users logged in (1 user)
  • load average of 5, 10 and 15 minutes respectively (0.07, 0.03, 0.01)

Tasks:

Tasks:  50 total,   1 running,  49 sleeping,   0 stopped,   0 zombie

Understanding the output of TOP command:

  • Processes are running in totals (50 total)
  • Processes are running (1 running)
  • Processes are sleeping (49 sleeping)
  • Processes has been stopped (0 stopped)
  • Processes are waiting to be stop from the parent process (0 zombie)

CPU States:

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

Understanding the output of TOP command:

  • %us: CPU utilization of user processes
  • %sy: CPU utilization of system processes
  • %ni: CPU utilization of niced user processes
  • %id: CPU not used
  • %wa: CPU time waiting for IO completion
  • %hi: CPU serving hardware interrupts
  • %si: CPU serving software interrupts
  • %st: CPU ‘stolen’ from this virtual machine by the hypervisor for other tasks

Memory Usage:

Mem:   4194304k total,  3791040k used,   403264k free,        0k buffers
Swap:  2097152k total,        0k used,  2097152k free,        0k cached

Above lines show memory utilization. 1st of these lines is for physical memory and the second for virtual memory.
The physical memory is shown as: total available memory, used memory, free memory, and memory used for buffers
Essentially, swap reflects: total, used, free and cached swap space.

Fields/Columns:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 9967 apache    17   0  733m 147m  50m S  0.3  3.6   0:01.07 httpd
    1 root      18   0 19232 1436 1208 S  0.0  0.0   0:01.50 init
 1181 root      14  -4 10644  580  324 S  0.0  0.0   0:00.00 udevd
 1662 root      15   0  179m 3868 1116 S  0.0  0.1  58:16.08 rsyslogd
 1703 sw-cp-se  18   0 62596 4536 1928 S  0.0  0.1   0:06.83 sw-cp-serverd

Let’s see what information we can get in the different columns:

  • PID: I’d of the process.
  • USER: Owner of the process.
  • PR: Priority of the process.
  • NI: Nice value of the process.
  • VIRT: Virtual memory used by the process.
  • RES: Process physical memory.
  • SHR: Process shared memory.
  • S: Status of the process
  • S: Sleep
  • R: Running
  • Z: Zombie
  • T: traced or stopped
  • D: uninterruptible sleep
  • %CPU: CPU using by the process in percentage .
  • %MEM: RAM using by the process in percentage .
  • TIME: total time of activity of this process.
  • COMMAND: command which was used to start the process.

Leave a Reply

Your email address will not be published.