How to Check VPS Resource Usage: htop, df and free Explained

Your site loads slowly, SSH feels sluggish, or a deploy fails for no clear reason. Before you blame your code or pay for a bigger plan, check VPS resource usage with three commands that ship on every Linux server: htop, free -h, and df -h. Together they answer the three questions that matter: is the CPU busy, is RAM full, and is the disk out of space? This guide shows you how to read each output line by line, so the numbers mean something the next time you run them.

The 60-Second Check: Three Commands

If you only have a minute, run this trio over SSH and read what comes back:

htop      # live CPU, memory and process view
free -h   # RAM and swap, human-readable
df -h     # disk space per filesystem, human-readable

All three are read-only and safe to run on a live site.

htop: Watch CPU and Processes Live

htop is an interactive process viewer. It is friendlier than the classic top: color-coded bars, mouse support, and process killing without typing a PID by hand. If it is not installed:

# Debian / Ubuntu
sudo apt install htop

# RHEL / AlmaLinux / Rocky
sudo dnf install htop

Reading the htop header

Run htop and read the header first. Example on a 2-vCPU server:

1  [||||||||||||||||||||||||||||||25.0%]     Tasks: 63, 118 thr; 1 running
2  [|||||                                     7.0%]     Load average: 0.35 0.41 0.52
Mem[|||||||||||||||||||||        1.2G/3.8G]              Uptime: 14 days, 03:22:11
Swp[                                     0K/2.0G]

CPU bars. One bar per core. Two bars here means two vCPUs. Short bars and low percentages mean the CPU is mostly idle.

Mem bar. 1.2G/3.8G means 1.2 GB in use out of 3.8 GB. This is the simple view; free -h below gives the precise breakdown.

Swp bar. Swap is emergency disk space used as overflow RAM. 0K/2.0G means swap is untouched, which is what you want. Swap in use means RAM is under pressure.

Load average: 0.35 0.41 0.52. This is the part most people misread. These are the average number of processes waiting for CPU time over the last 1, 5, and 15 minutes. Compare the first number to your core count: on a 2-core VPS, a load of 2.0 means both cores are fully busy. Load well above your core count means processes are queueing. If the numbers fall from left to right (like here), pressure is easing; if they rise, it is building.

Reading the process list

Below the header, each row is a process. The columns that matter:

  • PID – the process ID.
  • USER – who owns it. root is normal for system processes; a compromised account often shows up as an unfamiliar user.
  • CPU% and MEM% – what the process is eating right now.
  • RES – actual physical RAM the process holds (ignore VIRT, which includes shared and swapped memory).
  • COMMAND – what is running. php-fpm, mysqld, and nginx are the usual suspects on a WordPress VPS.

Sorting and stopping a runaway process

A few keys do most of the work:

  • P sorts by CPU, M sorts by memory, T sorts by time.
  • F5 toggles tree view, so you can see which parent spawned which children.
  • k kills the highlighted process (htop asks which signal; the default SIGTERM is the polite one).
  • q or F10 quits.

Sorting by CPU during a spike usually reveals the culprit: a single php-fpm pool or a stuck backup script. Kill or restart it, then recheck.

free -h: Read Memory and Swap Honestly

free -h prints memory in human-readable units. Example output on a 4 GB VPS:

               total        used        free      shared  buff/cache   available
Mem:           3.8Gi       1.4Gi       380Mi       120Mi       2.0Gi       2.1Gi
Swap:          2.0Gi          0B       2.0Gi

Here is what each column actually means:

  • total – installed RAM the OS can use.
  • used – memory applications hold right now.
  • free – completely unused memory. This number is supposed to be small and it tells you almost nothing on its own.
  • shared – memory shared between processes (tmpfs mounts live here).
  • buff/cache – RAM Linux borrowed to cache files and disk writes. This is the source of most confusion: a high number here is healthy. Linux gives it back the moment an application needs it.
  • available – the number to watch. It estimates how much memory new applications can take without touching swap. If available is near zero, you have a real memory problem.

Always judge by available, never by free. A server with 380 MB free but 2.1 GB available is fine. That 2.0 GB of cache is the kernel doing its job.

Swap. used 0B means the system never needed emergency overflow. When the swap row starts showing real numbers, the kernel is paging memory to disk, and disk is far slower than RAM. Occasional small swap use is not a disaster; steady, growing swap use means you need more RAM or lighter processes.

When RAM truly runs out, Linux invokes the OOM killer, which force-kills processes to survive, often your database or PHP pool. If your site dies at random and the logs mention “Out of memory”, this is where you confirm it.

df -h: Check Disk Space Before It Bites

A full disk breaks things in strange ways: package installs fail, logs stop writing, and databases refuse to start. df -h shows free space per filesystem:

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        78G   12G   63G  16% /
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           773M  1.2M  772M   1% /run
/dev/vda15      105M  6.1M   99M   6% /boot/efi

Read it this way:

  • Filesystem and Mounted on – which disk partition serves which path. Your site lives under / here.
  • Size / Used / Avail – total, taken, and remaining space in gigabytes.
  • Use% – the warning line. Many admins treat 90% as the point where cleanup or an upgrade goes on the to-do list. At 100%, expect services to fail.

Ignore the tmpfs lines; those are memory-backed temporary filesystems, not your disk. The row that matters is the one mounted on /.

When disk usage climbs, find what is eating it before you act:

# size of each top-level directory, biggest last
du -sh /* 2>/dev/null | sort -h

# inside a suspected directory, e.g. logs
du -sh /var/log/* | sort -rh | head

On a WordPress VPS, the usual culprits are /var/log (unrotated logs), /var/lib/mysql (growing database or binary logs), and backup archives someone left in /root.

Don’t forget inodes: df -i

Disk space is only half the story. Every file also consumes an inode, and a filesystem can run out of inodes while gigabytes of space remain. Sites with aggressive caching or millions of session files hit this on small VPS plans:

df -i

Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/vda1      5120000 412005  4707995    8% /

If IUse% approaches 100%, you cannot create new files even with free space. The fix is deleting the small files (old cache, old sessions, mail queues), not buying more gigabytes.

What the Numbers Mean: A 60-Second Diagnosis

Combine the three commands into a quick reading:

Symptom Likely cause What to do
Load average above core count, one process at 100% CPU Runaway script or busy PHP pool Find it in htop, kill or restart it
available near zero, swap growing RAM exhaustion Restart heavy services, cut workers, or upgrade RAM
Use% above 90% on / Disk filling up du to find the hog, rotate logs, clean backups
IUse% near 100% with free space left Inode exhaustion Delete masses of small files (cache, sessions)
Everything low but site still slow Not a resource problem Check the application: slow queries, DNS, upstream CDN

The last row matters more than people think. If CPU, memory, and disk all look fine, adding a bigger plan changes nothing. Measure first, spend later. And if you are still weighing shared hosting vs a VPS vs a dedicated server, do that comparison before paying to upgrade the wrong thing.

Make It a Habit: Baselines Beat Panic

A single reading tells you today’s state. A baseline tells you what “normal” looks like on your server, which is what makes tomorrow’s spike obvious. Run the trio once when the server is healthy and write down the load average, available memory, and disk Use%. Then schedule the readings into a log; this cron entry appends a compact snapshot every 30 minutes:

*/30 * * * * echo "$(date): load=$(cut -d' ' -f1 /proc/loadavg) avail=$(free -m | awk '/^Mem:/{print $7}')MB disk=$(df -h / | awk 'NR==2{print $5}')" >> /var/log/resource-check.log

When traffic grows past what the numbers can absorb, the data from these logs is also what tells you exactly which resource to upgrade: CPU, RAM, or disk. Guessing costs more.

Check your VPS resource usage the next time anything feels slow, before you touch a config file. Ninety seconds with htop, free -h, and df -h turns “the server feels weird” into a sentence you can act on. Once the numbers look healthy, the box is ready for real work, whether that is a Jellyfin media server for your library or a Vaultwarden vault for your passwords.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.