Operations 11 min read

Master Linux Performance: 5 Essential Monitoring Commands Explained

This article introduces five essential Linux performance monitoring commands—vmstat, iostat, free, df, and sar—detailing their purpose, key options, example usages, and the meaning of each output column to help you effectively track system resources.

Raymond Ops
Raymond Ops
Raymond Ops
Master Linux Performance: 5 Essential Monitoring Commands Explained

5 Linux Performance Monitoring Commands

1. vmstat – reports virtual memory statistics

vmstat prints detailed reports on memory, swap, I/O and CPU activity, including used/available memory, swap in/out, disk block reads/writes and CPU idle time.

Example: vmstat 5 Useful vmstat options:

-a – show active and inactive memory

-s – display event counters and memory statistics

-S – output in KB instead of blocks

5 – refresh output every 5 seconds

Each column meaning:

procs – process statistics

r: number of processes running or runnable

b: number of processes blocked

memory – memory statistics

swpd: used swap space (KB)

free: free memory (KB)

buff: memory used as buffers (KB)

cache: memory used as cache (KB)

swap – swap space statistics

si: KB/s swapped in from disk

so: KB/s swapped out to disk

io – I/O statistics

bi: blocks received per second

bo: blocks sent per second

system – system statistics

in: interrupts per second

cs: context switches per second

cpu – CPU statistics

us: % CPU time spent in user space

sy: % CPU time spent in kernel space

id: % CPU idle time

wa: % CPU time waiting for I/O

st: % stolen time in virtualized environments

2. iostat – reports CPU and I/O statistics

iostat monitors and displays CPU utilization and disk I/O metrics, including CPU load, IOPS, and read/write throughput.

Common iostat options:

c – display CPU usage information

t – print timestamp for each report

x – show extended statistics such as service time and wait counts

d – display detailed statistics for each disk/partition

p – display statistics for a specific disk device

Example (display detailed I/O for sda every 5 seconds): iostat -d -p sda 5 Sample output includes an avg‑cpu line (CPU usage percentages) and a Device line (tps, kB_read/s, kB_wrtn/s, etc.).

3. free – shows available and used memory

free displays total, used, and free amounts of physical and swap memory, providing an overview of memory availability.

Example: free -h Useful free options:

b – display output in bytes

k – display output in KB

m – display output in MB

h – display output in human‑readable format (GB, MB, etc.)

4. df – reports filesystem disk space usage

df shows filesystem name, total/used/available space and usage percentage.

Common df options:

-h – human‑readable format (K, M, G)

-T – display filesystem type

-i – show inode usage instead of space

-a – include all filesystems

-x type – exclude filesystems of the given type

-hT – combine -h and -T

--total – show total space usage in the last line

--help – display help

Example: df -h Columns meaning:

Filesystem – name of the filesystem

Type – filesystem type

1K-blocks – total number of 1‑KB blocks

Used – used blocks

Available – available blocks

Use% – percentage of space used

Mounted on – mount point

5. sar – collects and reports system activity

sar gathers and records CPU, memory, I/O, network and other system activity over time, enabling performance problem analysis.

Syntax: sar [options] [interval [count]] Common sar options:

-u – CPU utilization

-r – memory usage

-b – disk I/O

-n DEV – network interface statistics (DEV is interface name)

-q – run queue and load average

-A – all available statistics

-s HH:MM:SS – start time

-e HH:MM:SS – end time

-f FILE – specify sar data file to read

-o OUTPUT_FILE – write statistics to a file

Example (sample CPU usage every 5 seconds, 60 times):

sar -u 5 60
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Performance MonitoringLinuxFreesariostatvmstatdf
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.