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
Linux / UNIX: Run Command a Number of Times In a Row
Viewed 16106 times since Tue, Aug 6, 2019
RHCS: Configure an active/backup pacemaker cluster
Viewed 9289 times since Sun, Jun 3, 2018
Linux LVM recovery
Viewed 18057 times since Wed, Jan 23, 2019
20 IPtables Examples For New SysAdmins
Viewed 2385 times since Fri, May 15, 2020
RHEL: Adding a boot entry to GRUB/GRUB2 configuration
Viewed 4955 times since Sun, May 27, 2018
How to do a Filesystem Resize (ext3/ext4) on Redhat running on VMware
Viewed 11223 times since Wed, Jul 25, 2018
Odpalenie polecenia tylko na jedną godzinę
Viewed 3045 times since Thu, May 24, 2018
Using stunnel and TinyProxy to obfuscate HTTP traffic
Viewed 7226 times since Fri, Sep 28, 2018
Install Security Patches or Updates Automatically on CentOS and RHEL
Viewed 2014 times since Fri, Oct 26, 2018
LVM: Managing snapshots
Viewed 7991 times since Sat, Jun 2, 2018