Linux - How to monitor CPU usage

Linux - How to monitor CPU usage

 
In Linux, top can be used to monitor CPU usage of the system. Top is similar to topas in AIX though both are not the same.

Question : How to monitor CPU usage in Linux?
Answer : ps command can be used to report a snapshot of the current processes in Linux. Use option aux and sort based on the column to get the top usage based on the parameter you need. If you need to get CPU then you will need to sort column 3.
Example :
[root@server ~]# watch -n 2 'echo `ps aux |head -1`;ps aux |sort -nrk 3| head -10'
Note : Above command will output top 10 processes with highest %CPU in an interval of 2 seconds. Press "Crtl C" to stop.


Question : How to monitor CPU usage in Linux?
Answer : Besides using method above, top command can be used to monitor %CPU in Linux.
Example :
[root@server ~]# top


Question : How to monitor CPU usage in Linux?
Answer : sar command can be used to monitor %CPU in Linux. Use sar with option "u" and specific the interval and numintervals needed.
Example :
[root@server ~]# sar -u 3 3
Note : Above command with execute sar -u in an interval of 3 seconds for 3 times.
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
How to automate SSH login with password? ssh autologin
Viewed 3512 times since Fri, Jun 8, 2018
Telnet – Send GET/HEAD HTTP Request
Viewed 4516 times since Mon, Feb 18, 2019
KONTO SFTP Z CHROOTEM Z UŻYCIEM OPENSSH-SERVER NA CENTOS/RHEL6
Viewed 2553 times since Fri, Nov 30, 2018
RHEL: Displaying system info (firmware, serial numbers... )
Viewed 13101 times since Sun, May 27, 2018
LVM: Extend an existing Volume Group by adding a new disk
Viewed 2701 times since Sat, Jun 2, 2018
Red Hat Enterprise Linux - Allow Root Login From a Specific IP Address Only
Viewed 3564 times since Wed, Oct 3, 2018
Learn how to align an SSD on Linux
Viewed 13887 times since Fri, May 15, 2020
RHCS6: Debug and test multicast traffic between two hosts
Viewed 7606 times since Sun, Jun 3, 2018
ZPOOL: Detach a submirror from a mirrored zpool
Viewed 3427 times since Sun, Jun 3, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 8232 times since Fri, Sep 28, 2018