The Wayback Machine - https://web.archive.org/web/20240731003631/https://www.geeksforgeeks.org/mpstat-command-in-linux-with-examples/
Open In App

mpstat Command in Linux with Examples

Last Updated : 26 Aug, 2020
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

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


Previous Article
Next Article

Similar Reads

Ccat – Colorize Cat Command Output command in Linux with Examples
ccat is a command-line tool for Linux and OSX, which is similar to the cat command in Linux. But the difference between cat and ccat is that the ccat shows the content of the file with the syntax highlighted. Currently, ccat supports the following programming languages. JavaScriptJavaRubyPythonGoCJSONInstallation of Ccat First, we are going to see
2 min read
How to Display Command History in Linux | history Command
The command-line interface in Linux provides powerful tools for users, and mastering command history is essential for efficient navigation and retrieval of previously executed commands. The history command is a valuable utility that allows users to view and search through their command history. In this comprehensive guide, we will explore the vario
4 min read
select command in Linux with examples
select command in Linux is used to create a numbered menu from which a user can select an option. If the user enters a valid option then it executes the set of command written in select block and then ask again to enter a number, if a wrong option is entered it does nothing. If user enters nothing and simply press 'enter' the option menu gets print
1 min read
atrm command in Linux with examples
atrm command is used to remove the specified jobs. To remove a job, its job number is passed in the command. A user can only delete jobs that belong to him. Only superuser can delete any job even if that belongs to another user. Syntax: atrm [-V] job [job...] Options: -V : Used to print the version number atrm -V job : Job number of the job which i
1 min read
comm command in Linux with examples
comm compare two sorted files line by line and write to standard output; the lines that are common and the lines that are unique. Suppose you have two lists of people and you are asked to find out the names available in one and not in the other, or even those common to both. comm is the command that will help you to achieve this. It requires two so
5 min read
cmp Command in Linux with examples
cmp command in Linux/UNIX is used to compare the two files byte by byte and helps you to find out whether the two files are identical or not. When cmp is used for comparison between two files, it reports the location of the first mismatch to the screen if difference is found and if no difference is found i.e the files compared are identical.cmp dis
5 min read
expand Command in LINUX with examples
Whenever you work with files in LINUX there can be a situation when you are stuck with a file containing many tabs and whatever you need to do with a file requires that file with no tabs but with spaces. In this situation, the task looks quite simple if you are dealing with a small file but what if the file you are dealing with is very big or you n
3 min read
df Command in Linux with examples
There might come a situation while using Linux when you want to know the amount of space consumed by a particular file system on your LINUX system or how much space is available on a particular file system. LINUX being command friendly provides a command line utility for this i.e df command that displays the amount of disk space available on the fi
8 min read
help Command in Linux with examples
If you are new to LINUX operating system and having trouble dealing with the command-line utilities provided by LINUX then you really need to know first of all about the help command which as its name says help you to learn about any built-in command. help command as told before just displays information about shell built-in commands. Here's the sy
3 min read
fgrep command in Linux with examples
The fgrep filter is used to search for the fixed-character strings in a file. There can be multiple files also to be searched. This command is useful when you need to search for strings which contain lots of regular expression metacharacters, such as "^", "$", etc. Syntax: fgrep [options] [ -e pattern_list] [pattern] [file] Options with Description
3 min read
three90RightbarBannerImg