Operations 11 min read

5 Essential Linux Commands for Real‑Time Performance Monitoring

This article introduces five Linux commands—vmstat, iostat, free, df, and sar—explaining their purpose, common options, example usages, and the meaning of each column in their output to help you monitor memory, CPU, I/O, and filesystem performance in real time.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
5 Essential Linux Commands for Real‑Time Performance Monitoring

The article introduces five Linux commands useful for monitoring system performance: vmstat, iostat, free, df, and sar. It explains what each command reports, common options, example usages, and the meaning of the columns in their output.

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 reads/writes, and CPU idle time.

Example: vmstat 5 Useful options:

-a – show active and inactive memory

-s – display event counters and memory statistics

-S – output in KB instead of blocks

5 – refresh every 5 seconds

Each column meaning:

procs: process statistics

r – processes running or ready to run

b – processes waiting for I/O

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 statistics

si – KB/s read from swap

so – KB/s written to swap

io: I/O statistics

bi – blocks received from a block device (blocks/s)

bo – blocks sent to a block device (blocks/s)

system: system statistics

in – interrupts per second

cs – context switches per second

cpu: CPU statistics

us – user CPU time %

sy – system CPU time %

id – idle CPU %

wa – I/O wait %

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 such as CPU load, IOPS, and read/write throughput.

Common options:

c – show CPU usage

t – add timestamps

x – extended statistics (service time, wait count)

d – detailed per‑disk/partition statistics

p – statistics for a specific device

Example (refresh every 5 seconds for device sda): iostat -d -p sda 5 Sample output includes average CPU usage line (avg‑cpu) and per‑device statistics (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 a quick overview of memory availability.

Example: free -h Useful options:

b – display in bytes

k – display in KB

m – display in MB

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

4. df – reports filesystem disk space usage

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

Common 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 a given type

-total – show total space at the end

Example: df -hT Columns: Filesystem, Type, 1K‑blocks, Used, Available, Use%, Mounted on.

5. sar – collects and reports system activity

sar gathers statistics on CPU, memory, I/O, network, and more over a period of time, useful for identifying performance issues.

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

-u – CPU utilization

-r – memory usage

-b – disk I/O

-n DEV – network interface statistics

-q – run queue and load average

-A – all available statistics

-s HH:MM:SS – start time

-e HH:MM:SS – end time

-f FILE – read from a sar data file

-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 MonitoringFreesystem commandssariostatvmstatdf
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.