mpstat Command in Linux with Examples

mpstat is a command that is used to report processor related statistics. It accurately displays the statistics of the CPU usage of the system. It displays information about CPU utilization and performance. It initializes the first processor with CPU 0, the second one with CPU 1, and so on.

Installing mpstat command in linux

In Red Hat based Linux

sudo yum install sysstat

In ubuntu based Linux

 sudo apt install sysstat

Working with mpstat Command

1. To display processor and CPU statistics.

mpstat

To-display-processor-and-CPU-statistics



This will display all the processor and CPU stats.

2. To display processor number of all CPUs.

mpstat -P ALL

To-display-processor-number-of-all-CPU

This command will display the processor numbers of all the CPUs working.

3. To get all the information which the tool may collect.

mpstat -A

To-get-all-the-information-which-the-tool-may-collect

This will display each and every detail of CPU usage.

4. To display CPU utilization by a specific processor.



mpstat -P 0

To-display-CPU-utilization-by-a-specific-processor

This will display the CPU utilization by the 0th processor.

5. To display CPU usage with a time interval.

mpstat 1 5

CPU-utilization-in-interval

This command will print 5 reports with 1 second time interval.

6. To display mpstat version

mpstat -V

to-display-mpstat-version

This will display the version of the mpstat command installed in your system.

7. To display mpstat help

mpstat -h

mpstat-help

This command will display mpstat help section

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



Improved By : christopher2