MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Linux Tutorials: mpstat commands examples

 mpstat - Report processors related statistics.

The mpstat command writes to standard output activities for each available processor, processor 0 being the first one.  Global average activities among all processors are also reported. 

How to install mpstat?


$ sudo apt install sysstat         [On Debian, Ubuntu and Mint]
$ sudo yum install sysstat         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a app-admin/sysstat [On Gentoo Linux]
$ sudo pacman -S sysstat           [On Arch Linux]
$ sudo zypper install sysstat      [On OpenSUSE] 

mpstat command output

Terminal output of mpstat, mpstat 1 1 and mpstat 1 5 showing CPU usage, with idle near 100%

Understanding mpstat output

  • CPU : Processor number. The keyword all statistics are calculated as averages among all processors.
  • % usr : Show the percentage of CPU utilization that occurred while executing at the user level (application).
  • % nice : Show the percentage of CPU utilization that occurred while executing at the user level with nice priority.
  • % sys : Show the percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this does not include time-consuming servicing hardware and software interrupts.
  • % iowait : The CPU or CPUs were idle during which the system had an outstanding disk I / O request.
  • % irq : Show the percentage of time spent by the CPU or CPUs to service hardware interrupts.
  • % soft : Show the percentage of time spent by the CPU or CPUs to service software interrupts.
  • % steal : Show the percentage of time spent waiting for the CPU or CPUs while the hypervisor is servicing another virtual processor.
  • % guest : Show the percentage of time used by the CPU or CPUs to run a virtual processor.
  • % idle : The CPU or CPUs were idle and the system did not have an outstanding disk I / O request.

mstat commands example

1. To report the processor stats:

# mpstat 2 10 

2. To report all processor stats:

# mpstat -A 2 10 

3. To get the processor number for which the stats are displaying:

# mpstat -P 2 10 

4. To report the CPU utilization stats:

# mpstat -u 2 10 

5. To get the version info:

# mpstat -V 

To see the default set of utilization metrics, enter the following command:
mpstat 1 1

To see the default set of utilization metrics in wide display mode, enter the following command:
mpstat โ€“w 1 1

To see the detailed dispatch & affinity metrics, enter the following command:
 mpstat โ€“d 1 1

To see the detailed interrupts report, enter the following command:
mpstat โ€“i 1 1

To see all the statistics, enter the following command:
mpstat โ€“a 1 1

To see simultaneous multithreading utilization, enter the following command:
mpstat โ€“s 1 1

To see all the processor metrics of a WPAR, enter the following command:
mpstat -@ wparname

Note: To see all the processor metrics of a WPAR inside the WPAR, enter the following command:
mpstat -@

To see the sorted output for the column cs, enter the following command:
mpstat -d -O sortcolumn=cs

To see the list of the top 10 CPUs, enter the following command:
mpstat -a -O sortcolumn=min,sortorder=desc,topcount=10

To see metrics based on the virtual processor, enter the following command:
mpstat โ€“v

Context

Table of correlation coefficients between Ubuntu host and guest top tool readings for 1 and 2 vCPUs by load

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to install Ansible in Centos 7/RHEL 7?

On CentOS 7 or RHEL 7 you can install Ansible in two ways: with yum from the EPEL repository, which gives you Ansible 2.9, or with pip…

Read More

Kibana 7.2 Install and configuration in RHEL 7/Centos

This guide covers installing Kibana 7.2 on RHEL 7 or CentOS 7 from the tar.gz archive, pointing it at an Elasticsearch cluster in kibana.yml, and starting it….

Read More

How to login linux server using ssh?

You log in to a Linux server over SSH by running ssh username@server-ip from an SSH client, then proving who you are with either a password or…

Read More

How to Install Oracle Database 19c on centos 7

This guide covers installing Oracle Database 19c on CentOS 7. You prepare the host with packages, kernel parameters, limits, an oracle user and directories, unzip the 19c…

Read More

Wetty – How to Install & Access Wetty (Web-based SSH) on AWS EC2 linux to access using browser

Wetty is a web-based terminal. It runs a small Node.js server that opens an SSH session and streams it to your browser over WebSockets, so you can…

Read More

Linux + MySQL/MariaDB: โ€œWhoโ€™s eating CPU/RAM?

When a Linux database server slows down, start with the OS to find the busy process, user or service. If that turns out to be mysqld or…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x