[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 15, 2023

How to use iostat command in Linux.

How To Use Iostat Command.

The iostat command in Linux is used for monitoring system input/output statistics for devices and partitions. It monitors system input/output by observing the time the devices are active in relation to their average transfer rates. The iostat produce reports may be used to change the system configuration to raised balance the input/output between the physical disks. iostat is being included in sysstat package. If you don’t have it, you need to install first. 

Command to install on different Distros:  

  • On RedHat / CentOS / Fedora 

yum install sysstat
  • On Debian / Ubuntu / Linux Mint 

apt-get install sysstat

Note: 10 Linux iostat Command to Report CPU and I/O Statistics are listed below: 

  • iostat: Get report and statistic.

  • iostat -x: Show more details statistics information.

  • iostat -c: Show only the cpu statistic.

  • iostat -d: Display only the device report.

  • iostat -xd: Show extended I/O statistic for device only.

  • iostat -k: Capture the statistics in kilobytes or megabytes.

  • iostat -k 2 3: Display cpu and device statistics with delay.

  • iostat -j ID mmcbkl0 sda6 -x -m 2 2: Display persistent device name statistics.

  • iostat -p: Display statistics for block devices.

  • iostat -N: Display lvm2 statistic information.

  1. iostat Command:

  2. The iostat command in linux is used to get report and statistic. 

  3. Syntax: 

  4. iostat
  1. iostat -x Command:

  2. This command shows more details statistics information. iostat command gives I/O devices report utilization as a result. So it’s possible to extend the statistic result for a diagnose in depth with the -x option. 

  3. Syntax: 

  4. iostat -x
  1. iostat -c Command: This command show only the CPU statistic. It is possible to show the statistic information and report of our cpu with -c option. 

  2. Syntax: 

  3. iostat -c
  1. iostat -d Command: This command displays only the device report. It is possible to only show the status of the device utilization with the help of -d option. It will be going to list information for each connected device. 

  2. Syntax: 

  3. iostat -d
  4. iostat -xd Command: This command shows us the extended I/O statistic for device only. We can display extended the statistic on one side and from the other side we can display the extended statistics. It means that we can display the extended statistics only for devices with the help of -xd option as below: 

  5. Syntax: 

iostat -xd

iostat -k Command: This command captures the statistics in kilobytes or megabytes. By default, iostat measure the I/O system with the bytes unit. To make it easier to read, we can convert the iostat to show us reports in kilobytes or megabytes unit. 

Syntax: 

iostat -k

iostat -m Command: Used to create a report with megabytes unit. 

Syntax: 

iostat -m

iostat -k 2 3 Command: This command displays CPU and device statistics with delay. Same with the vmstat, as a statistic tool is the best way to use it with delay parameter. With the delay, we can see that what’s the trend. Here are some of the samples to run iostat with delay. 

Syntax: 

iostat -k 2 3

iostat -c 2 2 Command: To show CPU only report with 2 seconds interval and 2 times reports. 

Syntax: 

iostat -c 2 2

iostat -d sda7 sda6 2 2 Command: To show sda6 and sda7 device only report with 2 seconds interval and 2 times reports. 

Syntax:  

iostat -d sda7 sda6 2 2

iostat -j ID mmcbkl0 sda6 -x -m 2 2 Command: This command Display’s persistent device name statistics. It is possible to print the report by device name. Instead of the standard /dev/sda name, it will be going to print the persistent device name with -j parameter and adding ID keyword (specify the type of the persistent name). 

Syntax: 

iostat -j ID mmcbkl0 sda6 -x -m 2 2

iostat -p Command: This command display statistics for block devices. With the help of this command, it is possible to directly show information for each block device automatically. No need to indicate each of the device names. It will display statistics for block devices and all their partitions that are being used by the system. If a device name is entered on the command line, then the statistics for it and all of its partitions are displayed. Just use this -p option. 

Syntax: 

iostat -p

iostat -N Command: Display lvm2 statistic information. It is possible to view the LVM statistic with -N option. This command displays the registered device mapper names for any of the device mapper devices. 

Syntax: 

iostat -N
Keep reading
How to Read a File Line By Line in Bash
May 5, 2023

How to Read a File Line By Line in Bash

How To Read A File Line By Line In Bash In this tutorial, we will discuss how to read a file line by line in Bash. When writing Bash scripts, you will sometimes find yourself in situations where you need to read a file line by line. For example, you may have a text file…

Read article
How to use Wc Command (Count Number of Lines, Words, and Characters)
May 5, 2023

How to use Wc Command (Count Number of Lines, Words, and Characters)

How To Use Wc Command (Count Number Of Lines, Words, And Characters) In this tutorial, we will show you how to use the wc command through simple and practical examples. How to Use the wc Command The syntax for the wc command is as follows: wc OPTION… [FILE]… The wc command can accept zero…

Read article
How to understand Bash if..else Statement
May 5, 2023

How to understand Bash if..else Statement

How To Understand Bash If..Else Statement This tutorial will walk you through the basics of the Bash if Statement and show you how to use it in your shell scripts. Decision-making is one of the most fundamental concepts of computer programming. Like in any other programming language, if, if..else,…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00