To check a Linux server’s health, use uptime and top (or htop) for CPU and load, free -h for memory, df -h and iostat for disk space and speed, and ss and ip -s link for network traffic. Add sar from the sysstat package to see what happened in the past. Those few commands answer most “why is the server slow?” questions in a couple of minutes.
This guide walks through each resource: which command to run, how to read its output, and what numbers should worry you. It ends with a small health-check script, alerting, and when to move up to a full monitoring tool. The commands work on any modern distribution; package names are for Ubuntu and Debian, with Fedora and RHEL notes where they differ.
New to running a server? Start with Linux Server: A Beginner’s Guide to Server Administration.
The 60-Second Health Check
When something feels wrong, run these in order:
uptime # load average
free -h # memory and swap
df -h # disk space
top # what's using CPU and memory right now (q to quit)
systemctl --failed # services that crashed
sudo journalctl -p err -b --no-pager | tail -20 # recent errors
Most problems show up right away: a full disk, a process eating all the memory, a crashed service, or a load far above the number of CPU cores.
CPU and Load
Load Average
uptime
09:42:10 up 21 days, 3:05, 1 user, load average: 0.42, 0.61, 0.58
The three numbers are the average number of processes running or waiting over the last 1, 5, and 15 minutes. Compare them with the number of CPU cores:
nproc
On a 4-core server, a load of 4.0 means fully busy. Consistently above the core count means work is queuing. On Linux the load also counts processes waiting for disk, so high load with low CPU use often points to slow storage.
top and htop
top
The header shows overall CPU use. The fields worth knowing:
| Field | Meaning | Worry when |
|---|---|---|
us | User programs (your apps) | Steadily near 100% |
sy | The kernel | High for long periods |
id | Idle | Close to 0 |
wa | Waiting for disk I/O | Above 10–20%: storage is the bottleneck |
st | “Steal”: time the hypervisor gave to other virtual machines | Above a few percent on a VPS: the host is overloaded |
Useful keys inside top: P sorts by CPU, M by memory, 1 shows each core, c shows full commands, and q quits.
htop is easier to read, with colored bars and mouse support:
sudo apt install htop # Fedora/RHEL: sudo dnf install htop
htop
Top CPU Processes Without an Interactive Screen
ps aux --sort=-%cpu | head -10
This prints one snapshot, which is handy in scripts or over a slow connection. For per-core numbers every second, mpstat -P ALL 1 (from the sysstat package) works well.
Memory
free -h
total used free shared buff/cache available
Mem: 3.8Gi 1.2Gi 410Mi 45Mi 2.3Gi 2.4Gi
Swap: 2.0Gi 0B 2.0Gi
Read the available column, not free. Linux uses spare memory as a disk cache (buff/cache) and gives it back as soon as programs need it. A low free number is normal; a low available number is a problem.
Watch for:
availablebelow about 10% oftotal.- Swap in use and growing. Some swap use is fine; constant swapping is slow.
vmstat shows whether the server is actively swapping:
vmstat 1 5
The si and so columns (swap in, swap out) should be at or near 0. Steady non-zero values mean the server needs more memory or a process is using too much.
Find the biggest memory users:
ps aux --sort=-%mem | head -10
When memory runs out completely, the kernel’s OOM killer stops a process to save the system. Check whether that happened:
sudo journalctl -k | grep -i "out of memory"
Disk Space
df -h
Look at the Use% column for each file system, especially /. Above 85–90% is time to act, because a full disk stops databases, logging, and updates.
A disk can also run out of inodes (file entries) with plenty of space left, usually because of millions of tiny files:
df -i
Find What’s Using the Space
sudo du -xh --max-depth=1 / 2>/dev/null | sort -h
Run it again on the biggest folder (for example /var) to narrow it down. ncdu (sudo apt install ncdu) does the same job interactively.
Find large files directly:
sudo find / -xdev -type f -size +500M -exec ls -lh {} + 2>/dev/null
Common culprits and fixes:
| Culprit | Check | Fix |
|---|---|---|
| systemd journal | journalctl --disk-usage | sudo journalctl --vacuum-size=500M |
| Old package files | du -sh /var/cache/apt | sudo apt clean (Fedora: sudo dnf clean all) |
| Application logs | sudo du -sh /var/log/* | Configure logrotate |
| Docker images | docker system df | docker system prune (read what it removes first) |
| Deleted files still open | sudo lsof +L1 | Restart the program holding them |
The last one confuses people: if df shows a full disk but du can’t find the files, a running program still has a deleted file open. The space comes back when that program restarts.
Disk Speed (I/O)
Full disks are easy to spot; slow disks are harder. Install sysstat, which provides iostat, mpstat, and sar:
sudo apt install sysstat # Fedora/RHEL: sudo dnf install sysstat
iostat -xz 1 5
The columns that matter:
| Column | Meaning | Worry when |
|---|---|---|
r/s, w/s | Reads and writes per second | Compare with your normal baseline |
r_await, w_await | Average wait per request, in milliseconds | Well above a few ms on SSDs |
%util | How busy the device is | Near 100% for long periods |
To see which process is doing the reading and writing, use sudo iotop (install the iotop package).
Network
Interfaces and Traffic
ip -br addr # interfaces and IP addresses
ip -s link # bytes, packets, errors, and drops per interface
Rising errors or dropped counters point to a bad cable, driver, or an overloaded interface.
For live traffic per second:
sar -n DEV 1 5 # from sysstat
Interactive tools give a clearer picture (each is a separate package):
nload: incoming and outgoing bandwidth graphs per interfaceiftop: bandwidth per connection (sudo iftop -i eth0; use your interface name)nethogs: bandwidth per processvnstat: daily and monthly totals, handy for bandwidth limits on a VPS
Connections and Listening Ports
sudo ss -tulpn # what's listening, and which program
ss -s # connection totals by state
ss -tn state established | wc -l # rough count of open connections
ss -tulpn doubles as a security check: every listening port should be one you expect. For what the port numbers mean, see What Are the Well-Known Port Numbers?
Reachability and Latency
ping -c 5 1.1.1.1
mtr example.com # ping and traceroute combined
See What Happened Earlier with sar
Most tools above show the present. When users say “the site was slow at 3 a.m.,” you need history. The sysstat package can record CPU, memory, disk, and network every 10 minutes.
On Debian and Ubuntu, turn collection on:
sudo sed -i 's/^ENABLED="false"/ENABLED="true"/' /etc/default/sysstat
sudo systemctl enable --now sysstat
On Fedora and RHEL, sudo systemctl enable --now sysstat is enough.
Then, after it has collected some data:
sar -u # CPU today
sar -r # memory
sar -d # disks
sar -n DEV # network
sar -q # load average
sar -u -s 02:00:00 -e 04:00:00 # CPU between 2 and 4 a.m.
Older days are kept in /var/log/sysstat/ (Debian, Ubuntu) or /var/log/sa/ (Fedora, RHEL); read one with sar -u -f /var/log/sysstat/sa15 for the 15th.
Services and Logs
Resource numbers tell you that something is wrong; logs usually tell you why.
systemctl --failed # crashed services
sudo systemctl status nginx # one service, with its last log lines
sudo journalctl -u nginx --since "1 hour ago" # a service's log
sudo journalctl -p warning -b # warnings and errors since boot
sudo journalctl -f # follow new entries live
A Simple Health-Check Script
This script warns when the root disk, memory, or load crosses a limit. Save it as /usr/local/bin/health-check.sh:
#!/usr/bin/env bash
# Warn when disk, memory, or load is too high.
DISK_LIMIT=85 # percent of / used
MEM_LIMIT=90 # percent of memory used
disk=$(df --output=pcent / | tail -1 | tr -dc '0-9')
mem=$(free | awk '/^Mem:/ {printf "%d", ($2 - $7) / $2 * 100}')
load=$(cut -d ' ' -f1 /proc/loadavg)
cores=$(nproc)
if [ "$disk" -ge "$DISK_LIMIT" ]; then
echo "WARNING: root disk is ${disk}% full"
fi
if [ "$mem" -ge "$MEM_LIMIT" ]; then
echo "WARNING: memory is ${mem}% used"
fi
if awk -v l="$load" -v c="$cores" 'BEGIN { exit !(l > c) }'; then
echo "WARNING: load ${load} is above ${cores} cores"
fi
Make it executable and run it every 15 minutes with cron (sudo crontab -e), sending any warnings to the system log:
sudo chmod +x /usr/local/bin/health-check.sh
*/15 * * * * /usr/local/bin/health-check.sh | logger -t health-check
Read the warnings with sudo journalctl -t health-check. To get them by email or chat instead, pipe the output to your mail command or a webhook.
When to Use a Monitoring Tool
Commands and scripts are fine for one or two servers. Beyond that, or when you need graphs and alerts, use a tool:
| Tool | Good for |
|---|---|
| Uptime Kuma | Is the site or service up? Alerts by email, Slack, Telegram, and more |
| Netdata | Detailed real-time dashboards on one server, quick to install |
| Prometheus + node_exporter + Grafana | Metrics and dashboards for many servers, with flexible alerts |
| Zabbix | Traditional all-in-one monitoring for larger networks |
| Your cloud provider’s metrics | Basic CPU, disk, and network graphs with no setup |
A good starting combination is an uptime monitor for “is it down?” plus one metrics tool for “why is it slow?”.
Quick Reference
| Resource | First command | Deeper look |
|---|---|---|
| CPU and load | uptime, top | htop, mpstat -P ALL 1, ps aux --sort=-%cpu |
| Memory | free -h | vmstat 1 5, ps aux --sort=-%mem |
| Disk space | df -h | du -xh --max-depth=1, ncdu, df -i |
| Disk speed | iostat -xz 1 | iotop |
| Network | ip -s link, ss -tulpn | sar -n DEV 1, nload, iftop, nethogs |
| History | sar -u, sar -r | sar -f /var/log/sysstat/saDD |
| Services | systemctl --failed | journalctl -u <service> |
Conclusion
Monitoring a Linux server starts with five questions: Is the CPU busy? Is memory available? Is the disk full or slow? Is the network healthy? Did a service fail? top, free, df, iostat, ss, and journalctl answer them in minutes, and sar shows you the past. Learn what normal looks like on your server, so the odd numbers stand out, and add alerts before you need them. Unexpected spikes and unknown listening ports can also be signs of an attack; see Linux Server Security: 10 Best Practices to Protect Your Server.
Frequently Asked Questions
How do I check CPU usage in Linux?
Run top or htop for a live view, or mpstat 1 for per-second numbers. ps aux --sort=-%cpu | head lists the processes using the most CPU.
Why does Linux show almost no free memory?
Linux uses spare memory as a disk cache to speed things up and frees it when programs need it. Check the available column of free -h; that’s the memory programs can actually use.
What is a good load average?
Compare it with the number of CPU cores (nproc). A load below the core count means the server keeps up; a load that stays above it means processes are waiting.
How do I find what’s filling up my disk?
Run sudo du -xh --max-depth=1 / | sort -h, then repeat on the largest folder. Check the systemd journal (journalctl --disk-usage) and application logs first; they’re the usual cause.
How do I monitor network bandwidth on Linux?
sar -n DEV 1 shows traffic per interface each second, nload graphs it, iftop breaks it down by connection, and nethogs by process.
Related Reading
Want to keep learning? These related guides pair well with this post:
