Operations 6 min read

Essential Linux Commands for Real‑Time System Troubleshooting

This guide walks you through key Linux commands such as top, free, iostat, netstat, df, and du, explaining each output field, how to interpret system load, memory usage, CPU statistics, network connections, and disk space to quickly diagnose production issues.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Essential Linux Commands for Real‑Time System Troubleshooting

top – System Overview

The top command provides a snapshot similar to Windows Task Manager. The first line shows current time, uptime, logged‑in users, and load averages for the past 1, 5, and 15 minutes (e.g.,

18:14:58 up 112 days, 1:35, 1 user, load average: 0.00, 0.10, 0.11

). A load average above 1 indicates the system is overloaded.

The second line (

Tasks: 225 total, 1 running, 224 sleeping, 0 stopped, 0 zombie

) details process counts, helping you see how many processes are active, sleeping, stopped, or zombie.

CPU Usage (Cpu line)

The

Cpu(s): 1.8%us, 0.9%sy, 0.0%ni, 97.1%id, 0.1%wa, 0.0%hi, 0.1%si, 0.0%st

line breaks down CPU time:

us : user‑space processes

sy : kernel‑space processes

ni : processes with altered priority

id : idle CPU

wa : I/O wait

hi : hardware interrupts

si : software interrupts

st : stolen time (virtualized environments)

Memory Usage (Mem line)

Mem: 32879852k total, 23633040k used, 9246812k free, 311552k buffers

shows total, used, free memory and kernel buffers. Available memory can be calculated as free + buffers + cached.

Swap Usage (Swap line)

Swap: 4194300k total, 255104k used, 3939196k free, 10422508k cached

reports virtual memory statistics.

free -m – Memory Summary

The free -m command displays memory usage in megabytes, summarizing total, used, and free memory for both RAM and swap.

iostat – I/O Statistics

Usage: iostat [options] [interval] [count]. Example commands:

iostat -d
iostat -d 2 2
iostat -x 1 2

These commands report device‑level I/O statistics and extended metrics.

netstat – Network Connections

Run netstat to view socket states. Pay special attention to the number of ESTABLISHED connections; a persistently high count may indicate resource exhaustion.

Common usages:

Show IPs with the most connections:

netstat -na | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c

Count TCP connections by state:

netstat -na | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

df -h – Disk Space

df -h

displays filesystem usage in a human‑readable format, helping you locate partitions that are near capacity.

du -sh – Directory Size

Use du -sh to get the total size of a directory. Variations such as du --max-depth=2 --block-size=M or ll --block-size=M provide more granular size breakdowns.

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.

Linuxsystem-monitoringtop commandnetstatiostatdudf
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

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.