How to Track System Activity With top Command on Linux CentOS 5/CentOS 6/RHEL 5/ RHEL 6 server – System Performance

Top command is utility to monitor system activity interactively. When you run top from shell window, it will display all the activity processes and updates the screen. In this post i will show the usage of top command on CentOS 5/CentOS 6/RHEL 5/ RHEL 6 server to keep track system activity and to optimize the system performance.

Display top command on RHEL 6 :

[root@rhel6 ~]# top
top - 18:54:19 up 13:29,  2 users,  load average: 0.00, 0.00, 0.00
Tasks:  93 total,   1 running,  90 sleeping,   2 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:   1031320k total,   225804k used,   805516k free,    31120k buffers
Swap:  2064376k total,        0k used,  2064376k free,   116716k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1375 root      20   0 97768 9796 5768 S  0.3  0.9   0:03.43 httpd
 3974 root      20   0  2632 1076  868 R  0.3  0.1   0:00.08 top
    1 root      20   0  2828 1392 1196 S  0.0  0.1   0:01.81 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0
    4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    6 root      20   0     0    0    0 S  0.0  0.0   0:00.25 events/0
    7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 cpuset
    8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper
    9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 netns
   10 root      20   0     0    0    0 S  0.0  0.0   0:00.00 async/mgr
   11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pm
   12 root      20   0     0    0    0 S  0.0  0.0   0:00.00 sync_supers
   13 root      20   0     0    0    0 S  0.0  0.0   0:00.00 bdi-default
   14 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kintegrityd/0
   15 root      20   0     0    0    0 S  0.0  0.0   0:00.02 kblockd/0
   16 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kacpid
   17 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kacpi_notify
   18 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kacpi_hotplug
   19 root      20   0     0    0    0 S  0.0  0.0   0:00.01 ata/0
   20 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ata_aux
   21 root      20   0     0    0    0 S  0.0  0.0   0:00.00 ksuspend_usbd
   22 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khubd
   23 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kseriod
   25 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khungtaskd
   26 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kswapd0
   27 root      25   5     0    0    0 S  0.0  0.0   0:00.00 ksmd
   28 root      20   0     0    0    0 S  0.0  0.0   0:00.00 aio/0
   29 root      20   0     0    0    0 S  0.0  0.0   0:00.00 crypto/0
   34 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pciehpd
   36 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kpsmoused
   37 root      20   0     0    0    0 S  0.0  0.0   0:00.00 usbhid_resumer
   67 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kstriped
  267 root      20   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
  268 root      20   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_1
  279 root      20   0     0    0    0 S  0.0  0.0   0:00.20 mpt_poll_0

Display top command on CentOS 5.7 :

[root@CentOS57 ~]# top
top - 18:57:39 up 10:04,  2 users,  load average: 0.00, 0.00, 0.00
Tasks:  73 total,   1 running,  70 sleeping,   2 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1034700k total,    86916k used,   947784k free,     7292k buffers
Swap:  2096472k total,        0k used,  2096472k free,    36104k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0  2160  676  584 S  0.0  0.1   0:00.93 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    4 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 events/0
    5 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper
    6 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
    9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
   10 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid
  173 root      17  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0
  176 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khubd
  178 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kseriod
  244 root      21   0     0    0    0 S  0.0  0.0   0:00.00 khungtaskd
  245 root      22   0     0    0    0 S  0.0  0.0   0:00.00 pdflush
  246 root      15   0     0    0    0 S  0.0  0.0   0:00.01 pdflush
  247 root      17  -5     0    0    0 S  0.0  0.0   0:00.00 kswapd0
  248 root      17  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
  466 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kpsmoused
  492 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 mpt_poll_0
  493 root      19  -5     0    0    0 S  0.0  0.0   0:00.00 mpt/0
  494 root      19  -5     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
  497 root      19  -5     0    0    0 S  0.0  0.0   0:00.00 ata/0
  498 root      19  -5     0    0    0 S  0.0  0.0   0:00.00 ata_aux
  505 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kstriped
  514 root      10  -5     0    0    0 S  0.0  0.0   0:00.17 kjournald
  544 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kauditd
  577 root      21  -4  3004 1468  504 S  0.0  0.1   0:00.62 udevd
 1730 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kmpathd/0
 1731 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kmpath_handlerd
 1790 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kjournald
 1868 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 iscsi_eh
 1896 root      18  -5     0    0    0 S  0.0  0.0   0:00.00 cnic_wq
 1911 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 ib_addr
 1918 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 ib_mcast
 1919 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 ib_inform
 1920 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 local_sa
 1923 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 iw_cm_wq

By default, top will update its screen in every seconds. You can change this interval by using d seconds options as below :

See also  How to Fix "Your host needs to use PHP 5.2.4 or higher to run this version of Joomla!"

To update the screen every 5 seconds, run the “top d 5” command :

[root@rhel6 ~]# top d 5
top - 18:56:51 up 13:32,  2 users,  load average: 0.00, 0.00, 0.00
Tasks:  94 total,   1 running,  90 sleeping,   3 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.7%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1031320k total,   226064k used,   805256k free,    31136k buffers
Swap:  2064376k total,        0k used,  2064376k free,   116716k cached

To update the screen every 10 seconds, run the “top d 10” command :

[root@rhel6 ~]# top d 10
top - 18:57:21 up 13:32,  2 users,  load average: 0.00, 0.00, 0.00
Tasks:  95 total,   1 running,  90 sleeping,   4 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.7%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1031320k total,   226448k used,   804872k free,    31144k buffers
Swap:  2064376k total,        0k used,  2064376k free,   116716k cached

The screen updates every 5 to 20 seconds interval is more usefull tha the default setting, 1 second. This because update every 1 second will lists itself in its own output as the main resource consumer. If you press the h key while top is running, you will see the following output screen :

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7

This short howto will explain the steps to reset a lost root password or to reset a forgotten root password on Linux RHEL 7 or CentOS 7. Basically, we will...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

Leave a Reply

Your email address will not be published. Required fields are marked *