Skip to content

Linux Server Troubleshooting Guide: 14 Commands to Diagnose High CPU, Memory Leaks, and Disk Bottlenecks

Few moments test an engineer’s composure quite like a 3:00 AM monitoring alert announcing that a production server has become unresponsive. SSH sessions lag for ten seconds per keystroke, API response times spike from 40 milliseconds to 12 seconds, and customer-facing pages begin timing out. Without a disciplined Linux server troubleshooting workflow, the instinctive reaction is often to reboot the instance immediately—destroying the exact volatile telemetry needed to uncover the root cause.

Rebooting a misbehaving virtual private server treats the symptom while guaranteeing the outage will return. Whether your workload is suffering from runaway application threads, gradual memory leaks, saturated NVMe queues, or exhausted filesystem inodes, Linux exposes deep real-time kernel instrumentation directly from the command line.

This comprehensive Linux server troubleshooting guide walks you through 14 battle-tested CLI commands organized by subsystem. You will learn how to triage load spikes in under sixty seconds, distinguish genuine memory leaks from healthy disk caching, pinpoint storage latency bottlenecks, and trace failing network sockets across modern Debian, Ubuntu, AlmaLinux, and Rocky Linux servers.

Linux server troubleshooting diagnostic flowchart covering CPU load, memory leaks, disk I/O bottlenecks, and network sockets
A structured Linux server troubleshooting workflow isolates CPU, memory, disk I/O, and network bottlenecks before restarting services.

A Structured Framework for Linux Server Troubleshooting

Jumping randomly between diagnostic utilities wastes valuable minutes during a live incident. Experienced site reliability engineers anchor their Linux server troubleshooting methodology around the USE Method (Utilization, Saturation, and Errors), popularized by kernel performance engineer Brendan Gregg:

  • Utilization: The percentage of time a resource (CPU core, physical RAM, disk controller, or network interface) is actively busy servicing work.
  • Saturation: The degree to which extra work has to wait in a queue because the underlying resource is completely full (such as processes waiting in the CPU run queue or I/O requests queued on a block device).
  • Errors: Hardware faults, dropped network packets, failed disk sectors, or kernel Out-Of-Memory (OOM) kills recorded in system logs.

Before diving into reactive incident response, ensure your baseline environment is properly locked down using our Linux server hardening checklist and benchmarked against realistic traffic profiles with our VPS load testing guide so you know what healthy metrics look like on your hardware.

Quick-Reference Matrix: 14 Essential Linux Server Troubleshooting Commands

Keep the reference table below bookmarked during live incidents to match each symptom to the right Linux server troubleshooting tool and package.

# Command Target Subsystem Package Primary Red Flag Metric
01 uptime System Triage procps (built-in) 1-min load average exceeding total vCPU count
02 dmesg -T Kernel & Hardware util-linux (built-in) Out of memory: Killed process or I/O errors
03 vmstat 1 Global Overview procps (built-in) High r queue, non-zero si/so, or high wa/st
04 htop / top CPU & Processes htop / procps Single process pinned at 100%+ CPU or high st
05 pidstat 1 Per-Process History sysstat Recurring short-lived CPU or disk write bursts
06 mpstat -P ALL 1 Per-Core Balance sysstat One core at 100% %usr or high %soft IRQ load
07 free -h RAM & Swap procps (built-in) available memory near zero and swap filling
08 ps aux --sort=-%mem Process Memory procps (built-in) Steadily climbing RSS footprint over hours
09 slabtop Kernel Memory procps (built-in) Multi-gigabyte dentry or inode_cache slab
10 df -h & df -i Disk Capacity coreutils (built-in) Use% or IUse% (inodes) at 95–100%
11 ncdu & lsof +L1 Hidden Storage ncdu / lsof Large deleted files still held open by daemons
12 iostat -xz 1 Disk Latency sysstat r_await / w_await above 20 ms or high aqu-sz
13 iotop -oPa Process Disk I/O iotop Single daemon saturating MB/s disk throughput
14 ss -tulpan & journalctl Network & Services iproute2 / systemd CLOSE_WAIT floods or full Recv-Q queues

Phase 1: Rapid Triage and System Load Commands

During the first 60 seconds of a Linux server troubleshooting session, your goal is to identify which subsystem is bottlenecked—CPU, memory, storage, or network—before zooming in on individual applications.

1. uptime — Check Load Averages Against CPU Core Count

Running uptime (or inspecting /proc/loadavg as documented in the Linux Kernel /proc filesystem documentation) is the fastest first command in any Linux server troubleshooting routine. It prints the current system uptime alongside three exponentially damped moving averages representing system load over the past 1, 5, and 15 minutes:

uptime
# Output:
# 03:42:18 up 48 days, 11:14, 1 user, load average: 9.42, 4.18, 1.65

To interpret those numbers accurately, compare them against your logical vCPU count using nproc:

nproc
# Output: 4
  • Trend Direction Matters Most: In the example above, the 15-minute load was 1.65, the 5-minute load rose to 4.18, and the 1-minute load jumped to 9.42 on a 4-vCPU server—confirming an actively worsening bottleneck.
  • Normalized Load Thresholds: Divide the load average by your nproc count. A normalized load below 0.70 indicates healthy headroom; 1.00 means every CPU core is fully utilized; values consistently above 1.50–2.00 per core indicate severe queuing.
  • The Uninterruptible Sleep Trap: Unlike other operating systems, Linux load averages count both runnable threads waiting for CPU time and threads blocked in uninterruptible sleep (D state)—typically waiting on slow disk or NFS I/O. A high load average with low CPU usage almost always points to storage saturation rather than compute exhaustion.

2. dmesg -T — Inspect Kernel Ring Buffer and OOM Killer Events

Another critical early check in Linux server troubleshooting is verifying whether the Linux kernel itself terminated a process or logged hardware errors before blaming application code. The dmesg command reads the kernel ring buffer, and adding the -T flag converts raw boot-offset timestamps into human-readable wall-clock times:

sudo dmesg -T --level=err,warn | tail -n 30

If a memory leak silently exhausted system RAM two minutes before you logged in, dmesg -T will immediately reveal the Linux Out-Of-Memory (OOM) killer in action:

[Tue Nov 17 03:39:11 2026] Out of memory: Killed process 18492 (node) total-vm:4891204kB, anon-rss:3612480kB, file-rss:1280kB

Beyond OOM kills, dmesg -T exposes NVMe controller resets, read-only filesystem remounts triggered by storage corruption, TCP SYN flood warnings, and network interface link flaps.

3. vmstat 1 — Get a Bird’s-Eye View of CPU, RAM, Swap, and I/O

Running vmstat 1 gives your Linux server troubleshooting workflow a once-per-second summary across processes, memory, swap, I/O blocks, and CPU time whenever uptime confirms high load and dmesg shows no sudden crashes. Ignore the very first output line (which represents averages since system boot) and watch lines two onward:

vmstat 1
# procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
#  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
# 11  0 245120 148200  42112 812440    0    0    12   140 4820 9110 86  9  5  0  0
# 14  2 248900 132100  41800 798120  420 1280  3420  8910 6120 14200 41 12  2 38  7

This single table tells you exactly where to focus next in your Linux server troubleshooting investigation:

  • r (Runnable Processes): When r consistently exceeds your vCPU count (e.g., 14 runnable threads competing for 4 cores), you have genuine CPU contention.
  • b (Blocked Processes): Threads stuck waiting on disk or network I/O. Sustained values above 2–3 signal storage latency.
  • si and so (Swap In / Swap Out): Occasional zeros are normal even when swpd is non-zero. Continuous non-zero values in si and so mean the server is actively thrashing swap space on disk, destroying application latency.
  • wa (I/O Wait): The percentage of CPU time spent sitting idle waiting for disk reads/writes to finish. Values above 15–20% indicate a disk bottleneck.
  • st (Steal Time): Critical on virtualized cloud instances. Steal time measures how long your VM’s virtual CPU waited for the physical hypervisor to schedule it because a “noisy neighbor” tenant on the same host was monopolizing physical cores. Sustained st above 10% means you should migrate to a dedicated CPU tier or bare-metal node.

Phase 2: Diagnosing High CPU Usage and Process Contention

When vmstat 1 reveals high user space (us), kernel space (sy), or runnable queue depth (r), move to the second phase of Linux server troubleshooting to identify which binary, thread, or CPU core is saturated.

4. htop (or top) — Pinpoint CPU-Hogging Threads and Steal Time

Interactive process inspection is a core skill in Linux server troubleshooting, and while classic top is installed everywhere, htop provides per-core color-coded bars, process tree hierarchies, and instant sorting without memorizing cryptic single-letter hotkeys. Launch htop (or install it via apt install -y htop / dnf install -y htop):

htop

Use these three diagnostic shortcuts inside htop during an active CPU spike:

  • Press F6 (Sort By): Select PERCENT_CPU to float the heaviest consumers to the top, or TIME+ to spot long-running background workers consuming cumulative CPU cycles.
  • Press H (Toggle User Threads): Multi-threaded runtimes like Java, Go, PostgreSQL, and Node.js worker pools hide individual thread behavior under a single parent PID. Toggling thread view reveals whether one specific worker thread is stuck in an infinite loop at 100% CPU.
  • Press F5 (Tree View): Displays parent-child relationships so you can tell whether 80 spawned PHP-FPM or Python workers belong to your web server or a runaway cron script.

If htop is unavailable on a locked-down minimal container or recovery shell, run standard top and press 1 to expand per-CPU core statistics, then press Shift + P to sort by CPU usage.

5. pidstat -u -r -d 1 — Track Per-Process Resource Spikes Over Time

Historical per-process telemetry strengthens any Linux server troubleshooting toolkit because interactive monitors like htop overwrite the screen every second, making it easy to miss intermittent 2-second CPU bursts caused by scheduled jobs, garbage collection pauses, or database checkpoints. The pidstat utility (part of the open-source sysstat performance monitoring suite) prints a scrolling chronological log of per-process CPU, memory, and disk activity:

# Install sysstat if not already present:
sudo apt install -y sysstat

# Monitor active processes every 2 seconds (5 iterations):
pidstat -u -r -d 2 5

Focus on the %usr vs. %system split for your top PIDs. High %usr indicates application logic, regex backtracking, JSON serialization, or encryption overhead; high %system indicates excessive system calls such as rapid file opens, fork storms, or context switching.

6. mpstat -P ALL 1 — Detect Single-Core Bottlenecks and IRQ Storms

A common blind spot in Linux server troubleshooting is assuming a 16-vCPU server has plenty of headroom because overall CPU utilization reads 12%. Single-threaded event loops (such as Node.js, Redis, or un-sharded Python workers) can only execute on one CPU core at a time. When that single core hits 100%, requests back up even while 15 other cores sit completely idle.

Run mpstat -P ALL 1 to inspect every logical core individually:

mpstat -P ALL 1
# CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal   %idle
# all   14.20    0.00    2.10    0.40    0.00    1.15    0.00   82.15
#   0   98.50    0.00    1.50    0.00    0.00    0.00    0.00    0.00
#   1    2.10    0.00    0.80    0.50    0.00    3.40    0.00   93.20

Also inspect the %soft (software interrupt) column across cores. If CPU 0 or CPU 1 shows %soft above 40–50% during high traffic, your network card’s packet processing (softirq) is pinned to a single core—a classic sign that you need Receive Packet Steering (RPS) or multi-queue NIC tuning.

Linux server troubleshooting CPU utilization breakdown showing single-core saturation and hypervisor steal time
Per-core inspection with mpstat is a vital Linux server troubleshooting technique for exposing single-threaded bottlenecks and hypervisor steal time.

Phase 3: Hunting Memory Leaks, Swap Thrashing, and Slab Bloat

Memory issues are among the trickiest problems in Linux server troubleshooting because Linux intentionally uses unallocated RAM to accelerate disk reads, leading administrators to misread normal caching as an imminent crash.

7. free -h — Understand available Memory vs. Linux Page Cache

Reading RAM metrics accurately is essential for effective Linux server troubleshooting; always run free -h (human-readable units) and look strictly at the available column—never the free column:

free -h
#               total        used        free      shared  buff/cache   available
# Mem:           15Gi       6.2Gi       420Mi       112Mi       8.9Gi       8.8Gi
# Swap:         2.0Gi       128Mi       1.9Gi

In the healthy output above, free is only 420Mi because Linux has cached 8.9Gi of recently read files in buff/cache. Because the kernel can immediately reclaim page cache whenever an application requests memory, true usable RAM is 8.8Gi (available). A genuine memory shortage exists only when available drops below 5–10% of total RAM and swap usage begins climbing rapidly.

8. ps aux --sort=-%mem — Rank Processes by Resident Set Size (RSS)

Isolating process memory footprints is the next step in Linux server troubleshooting once you confirm available memory is genuinely low. List your top memory consumers sorted by physical Resident Set Size (RSS):

ps aux --sort=-%mem | head -n 15

Pay close attention to the difference between VSZ (Virtual Memory Size) and RSS (Resident Set Size):

  • VSZ includes shared libraries, memory-mapped files, and allocated address space that has not actually been touched in physical RAM.
  • RSS measures the exact kilobytes of physical RAM currently occupied by that process.

To confirm a true application memory leak rather than normal peak caching, sample the suspected PID’s RSS every 15 minutes using ps -o pid,rss,vsz,comm -p PID. If RSS climbs monotonically even after traffic subsides, the application is failing to release heap allocations.

9. slabtop and /proc/meminfo — Uncover Kernel Slab and File Descriptor Leaks

Deep kernel memory inspection separates advanced Linux server troubleshooting from guesswork when free -h shows less than 300 MB of available memory on a 32 GB server, yet summing every process in ps aux accounts for only 10 GB. Where did the missing 21 GB go? In almost every case, the culprit is kernel slab cache bloat.

Inspect /proc/meminfo and run slabtop -o to view kernel-level memory allocations:

grep -E 'MemTotal|MemAvailable|Slab|SReclaimable|SUnreclaim|PageTables' /proc/meminfo
sudo slabtop -o -s c | head -n 20

If dentry (directory entry cache) or inode_cache consumes tens of gigabytes—often triggered by backup tools, antivirus scanners, or containers stat-ing millions of tiny files—and SUnreclaim is high, you can safely reclaim clean page and slab caches without rebooting:

sudo sh -c "sync; echo 2 > /proc/sys/vm/drop_caches"

Note that drop_caches only frees clean, reclaimable kernel caches; if SUnreclaim continues growing afterward, check for leaked file descriptors across running processes via sudo lsof | awk '{print $2}' | sort | uniq -c | sort -rn | head.

Phase 4: Resolving Disk I/O Bottlenecks and Full Filesystems

Storage bottlenecks silently paralyze databases, container runtimes, and logging daemons. Phase 4 of our Linux server troubleshooting guide isolates both capacity exhaustion and latency saturation.

10. df -h and df -i — Catch Disk Space and Inode Exhaustion

Checking both block capacity and inode tables prevents a classic Linux server troubleshooting blind spot whenever applications throw No space left on device errors:

df -hT -x tmpfs -x devtmpfs
df -i -x tmpfs -x devtmpfs

On ext4 and XFS filesystems, every file and directory consumes one inode metadata record. Applications that generate millions of tiny session files, mail queue entries, or unpruned cache objects can hit 100% IUse% even while df -h reports 50 GB of free disk space. Checking both commands prevents hours of misdiagnosis.

11. ncdu and lsof +L1 — Locate Runaway Logs and Deleted-But-Open Files

Once df -h confirms a full partition, avoid running slow recursive du scans manually. Install ncdu (NCurses Disk Usage) to interactively drill down into the largest directories in seconds:

sudo ncdu -x /

What if df -h reports that your 100 GB root partition is 99% full, yet ncdu -x / accounts for only 35 GB of files? That classic Linux server troubleshooting mystery occurs when a massive log file (such as an Nginx access log or MySQL slow query log) was deleted via rm while the running daemon still held an open file descriptor to it. Linux does not reclaim disk blocks until the last open file handle closes.

Locate deleted-but-open files immediately with lsof +L1:

sudo lsof +L1 | grep -i deleted

Reloading or gracefully restarting the PID listed in the second column releases the file descriptor and instantly restores the missing gigabytes of disk space.

12. iostat -xz 1 — Measure Storage Latency (await), Queue Depth, and Saturation

Measuring queue depth and await times is crucial in Linux server troubleshooting because a disk does not need to be full to bring a production server to its knees. High read/write latency stalls database commits and spikes system load averages. Run iostat -xz 1 (from the sysstat package) to inspect device-level I/O performance:

iostat -xz 1
# Device            r/s     w/s     rkB/s     wkB/s  r_await  w_await  aqu-sz  %util
# nvme0n1         42.00  318.00    840.00  18420.00     1.20    48.60   16.40  98.20

Focus on these three metrics rather than %util alone (modern NVMe drives handle parallel queues, so %util can approach 100% long before throughput saturates):

  • r_await and w_await (Average Wait Time in Milliseconds): Includes both queue time and physical service time. Healthy local NVMe latency sits under 1–3 ms; network-attached cloud block volumes typically sit between 2–10 ms. Values above 20–50 ms indicate severe storage congestion.
  • aqu-sz (Average Queue Size): The average number of I/O requests waiting in the device queue. Rising aqu-sz paired with rising await confirms storage saturation.
  • IOPS Burst Credit Exhaustion: On cloud VPS platforms with burstable storage tiers, sudden jumps in w_await without a traffic surge often mean your volume exhausted its baseline IOPS credits.

13. iotop -oPa — Identify Which Process Is Saturating Disk Bandwidth

Pinpointing per-process disk throughput completes the storage phase of Linux server troubleshooting once iostat confirms high disk latency. Using the -oPa flags filters out idle threads (-o), shows processes instead of individual threads (-P), and accumulates total bytes transferred since launch (-a):

sudo iotop -oPa

Within seconds, iotop -oPa reveals whether the disk storm is caused by an unindexed PostgreSQL sequential scan, a runaway application debug logger, an aggressive backup compression job, or systemd journal rotation.

Linux server troubleshooting disk latency and I/O bottleneck diagnosis using iostat and iotop
Pairing device-level latency metrics from iostat with process-level throughput from iotop accelerates Linux server troubleshooting.

Phase 5: Tracing Network Sockets and Service Failures

When CPU, RAM, and disk metrics all look healthy yet users still experience connection resets or 502 Bad Gateway errors, finish your Linux server troubleshooting sweep at the network socket and service-manager layers.

14. ss -tulpan and journalctl -xeu — Audit Stuck Connections and Service Crashes

Socket state inspection is a cornerstone of network-level Linux server troubleshooting, and modern Linux distributions deprecate netstat in favor of ss (as detailed in the Linux ss socket statistics manual), which reads socket state directly from kernel netlink interfaces in milliseconds even when tens of thousands of connections are open:

# Count sockets by TCP state (ESTAB, TIME-WAIT, CLOSE-WAIT, SYN-RECV):
ss -tan | awk 'NR>1 {print $1}' | sort | uniq -c | sort -rn

# Inspect listening sockets and receive/send queue backlogs:
ss -tulpan

Watch for two classic network failure signatures in ss output:

  • High CLOSE-WAIT Counts: Unlike TIME-WAIT (which is a normal kernel cleanup state), sockets stuck in CLOSE-WAIT mean the remote client closed the connection, but your local application failed to call close() on the socket—indicating an application connection-pool leak.
  • Non-Zero Recv-Q on Listening Sockets: If a listening port (such as port 80, 443, or 5432) shows Recv-Q approaching Send-Q (the maximum somaxconn backlog), incoming connections are arriving faster than your application’s worker processes can accept() them.

Structured service log queries round out this Linux server troubleshooting workflow whenever a systemd-managed daemon crashes, restarts repeatedly, or refuses to bind to a port—use journalctl (see the systemd journalctl documentation) to inspect its logs:

sudo journalctl -u nginx.service --since "30 minutes ago" --no-pager
sudo systemctl --failed

Filtering by unit name (-u) and time window (--since) strips away unrelated system noise so you can read the exact configuration syntax error, permission denial, or port-binding conflict immediately.

Frequently Asked Questions About Linux Server Troubleshooting

What is considered a high load average in Linux server troubleshooting?

In practical Linux server troubleshooting, a load average is only meaningful relative to your server’s logical CPU core count (nproc). On a 4-vCPU VPS, a sustained load average of 3.00 (0.75 per core) represents healthy utilization, whereas a load average of 8.00 (2.00 per core) indicates significant queuing. Always cross-check high load averages with vmstat 1 to determine whether the queue is driven by CPU contention (r) or slow disk I/O (b and wa).

Why does free -h show almost zero free RAM even when my server is idle?

Linux follows the philosophy that unused RAM is wasted RAM. The kernel aggressively caches disk blocks and filesystem metadata inside buff/cache to speed up future reads, automatically releasing that memory the instant an application needs it. When performing Linux server troubleshooting, always check the available column in free -h rather than the free column.

Should I reboot a slow server during Linux server troubleshooting?

Effective Linux server troubleshooting avoids blind reboots unless the kernel has completely locked up and refuses SSH or serial console access. Rebooting clears kernel ring buffers (dmesg), resets socket tables, erases process RSS growth history, and clears /proc counters—making root-cause analysis nearly impossible. Spend three to five minutes capturing outputs from uptime, dmesg -T, vmstat 1, free -h, iostat -xz 1, and ss -tan before restarting failing services.

Which diagnostic packages should I pre-install on every production Linux VPS?

Install essential Linux server troubleshooting tools during initial server provisioning so you never have to run package updates over a degraded network during an outage. On every new server, pre-install sysstat (provides vmstat, iostat, mpstat, and pidstat), htop, iotop, ncdu, lsof, curl, mtr-tiny, and tcpdump.

Turning Reactive Firefighting into Proactive Reliability

Mastering these 14 CLI commands transforms high-stress Linux server troubleshooting from guesswork into methodical, repeatable diagnostics. By progressing systematically from top-level triage (uptime, dmesg, vmstat) into targeted CPU, memory, storage, and socket inspection, you can isolate bottlenecks in minutes without resorting to blind reboots.

Keep this Linux server troubleshooting guide in your engineering team’s incident response runbook, pre-install these diagnostic utilities on your golden server images, and pair reactive CLI checks with continuous metrics alerting so anomalies are caught long before users notice.