Linux VPS

Monitor CPU, memory, disk and logs on a Linux server

A practical toolkit for checking load, CPU, memory, disk, network and logs on a Linux VPS, with what each number means and when it is a problem.

BeginnerLinux server3 min read

When a site slows down or a service stops, a few built-in commands usually show why within a minute. Here is what to run and how to read it.

Load and CPU

Bash
uptime
nproc

uptime shows the load average over 1, 5 and 15 minutes. Compare it with the number of vCPUs from nproc: a load that stays above that number means work is queuing.

For a live view, install htop:

Bash
sudo apt install -y htop      # Ubuntu / Debian
sudo dnf install -y htop      # AlmaLinux / Rocky (needs epel-release)
htop

Press F6 to sort by CPU or memory and F10 to quit. In top, the st (steal) value shows time the virtual CPU waited for the host; the wa value shows time waiting for disk.

Memory

Bash
free -h

Read the available column, not free. Linux uses spare RAM as disk cache and gives it back when programs need it. Low available memory plus heavy swap use means the server needs more RAM or a lighter workload.

Find the biggest users:

Bash
ps aux --sort=-%mem | head -n 10

Check whether the kernel killed something for lack of memory:

Bash
sudo journalctl -k | grep -i "out of memory"

Disk space and disk activity

Bash
df -h
df -i
sudo du -xh --max-depth=1 /var | sort -h

df -h shows space per filesystem; df -i shows inodes, which can run out when there are millions of tiny files. du shows which folders are largest. For disk activity, vmstat 1 5 prints five one-second samples; a high wa column means processes are waiting on disk.

Network and open ports

Bash
sudo ss -tulpn
ss -s

The first lists every listening port and the program behind it. The second summarises connections. For traffic totals over time see Understanding bandwidth.

Services and logs

Bash
systemctl --failed
sudo journalctl -p err -b
sudo journalctl -u nginx --since "1 hour ago"
sudo journalctl -f

These show failed services, errors since the last boot, recent logs for one service and a live stream of new log lines.

Tip: Save a quick snapshot before you change anything, for example { uptime; free -h; df -h; } > ~/health-$(date +%F).txt. Comparing before and after makes it obvious whether a fix helped.

Troubleshooting

  • High load but low CPU use: processes are waiting on disk (wa in top). Look for heavy backups, database queries or swap use.
  • Memory keeps creeping up: an app may leak memory. Restart it, then watch ps over a day. See Add a swap file for a short-term cushion.
  • Disk at 100%: follow Free up disk space on Linux.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.