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 Configure ‘FirewallD’ in RHEL/CentOS 7 and Fedora 21
Viewed 11552 times since Wed, Oct 9, 2019
Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT
Viewed 12079 times since Fri, May 15, 2020
Linux Cluster Tutorial
Viewed 2803 times since Sat, Sep 29, 2018
Using Official Redhat DVD as repository
Viewed 12153 times since Mon, Oct 29, 2018
HowTo: Find Out Hard Disk Specs / Details on Linux
Viewed 4564 times since Mon, Jan 28, 2019
high swap space utilization in LINUX
Viewed 7304 times since Fri, Jul 13, 2018
How to use yum-cron to automatically update RHEL/CentOS Linux
Viewed 3490 times since Wed, Oct 17, 2018
How do I add ethtool settings to a network device permanently?
Viewed 7596 times since Mon, May 21, 2018
Moving SSL Certificate from IIS to Apache
Viewed 2649 times since Mon, Feb 18, 2019
debian How to Upgrade Debian 8 Jessie to Debian 9 Stretch
Viewed 3119 times since Sun, Sep 23, 2018