Back to Blog

How to Check CPU, RAM, Disk & Network Usage on Linux

How to Check CPU, RAM, Disk & Network Usage on Linux
Command of the Day
glances

What it does: A cross-platform curses-based monitoring tool that summarizes CPU, memory, load, network, and disk I/O in a single clean terminal dashboard.

Monitoring resource usage on your RivinCloud Linux server is essential for maintaining uptime, avoiding sudden crashes, and planning scaling decisions before performance issues impact your users.

In this guide, we explore the primary command-line tools to check your CPU, Memory (RAM), Disk, and Network performance.


1. Checking CPU Utilization

To understand how hard your processors are working and determine if an application is bottlenecked on compute:

Using top or htop

top comes installed on every Linux distribution:

top

Press q to exit, or P to sort by CPU usage. For a cleaner, color-coded visual overview, install htop:

sudo apt install htop -y
htop

Checking System Load Average

The uptime command gives you load averages over 1, 5, and 15 minutes:

uptime

[!NOTE] If your load average exceeds the total number of CPU cores on your VPS (check core count with nproc), your system has processes queued waiting for CPU time.


2. Checking RAM and Memory Usage

Linux handles memory differently than Windows; it aggressively caches filesystem reads into memory buffers.

Using free -h

free -h

Example Output:

               total        used        free      shared  buff/cache   available
Mem:           7.7Gi       1.8Gi       4.2Gi        12Mi       1.7Gi       5.6Gi
Swap:          2.0Gi          0B       2.0Gi
  • used: Memory currently allocated by active applications.
  • buff/cache: Memory used by the Linux kernel to cache disk operations. This is automatically freed if applications need it.
  • available: The true metric of available memory for new or expanding applications.

3. Checking Disk Usage and Storage Space

Running out of disk space will stop databases, break logs, and cause system services to crash.

Filesystem Storage: df -h

df -h

Look for the / (root) filesystem line and monitor the Use% column.

Finding Heavy Folders: du

To pinpoint which directory is consuming the most storage on your disk:

sudo du -sh /* 2>/dev/null | sort -rh | head -n 10

4. Checking Network Traffic and Bandwidth

Monitoring network activity helps identify bandwidth saturation, DDOS attacks, or faulty application loops.

Interface Statistics with ip

ip -s link

Displays total received (RX) and transmitted (TX) packets and bytes.

Real-time Bandwidth with iftop or nload

Install nload for a visual bandwidth monitor:

sudo apt install nload -y
nload

Common Mistakes

  • Confusing "Free" RAM with "Available" RAM: Thinking the system is out of memory because free is low, when in reality buff/cache is holding reusable cache.
  • Ignoring Swap Usage: Heavy swap usage indicates physical RAM exhaustion and can severely degrade VPS disk performance.
  • Overlooking Disk Inodes: Checking only df -h instead of df -i. If inodes are 100% full, no new files can be created even with gigabytes of free space.

Troubleshooting High Resource Usage

  1. High CPU? Run ps aux --sort=-%cpu | head -n 5 to isolate the offending PID.
  2. High Memory? Check ps aux --sort=-%mem | head -n 5.
  3. Full Disk? Clean apt caches with sudo apt clean and remove old journal logs with sudo journalctl --vacuum-time=3d.

Best Practices

  • Periodically monitor your server using automated monitoring agents (like Prometheus Node Exporter or Uptime Kuma).
  • Configure alerts when disk usage exceeds 85%.
  • Maintain a small swap file (1–2GB) on SSD/NVMe VPS instances to prevent out-of-memory kernel panics.

Frequently Asked Questions

What does a high iowait (%wa in top) mean?

High iowait indicates your CPU is sitting idle waiting for storage read/write operations to complete, typically pointing to disk bottlenecking or heavy database queries.

How do I check my total CPU core count?

Run lscpu or nproc in your terminal to see total sockets, cores, and threads.


Conclusion

Knowing how to check CPU, RAM, disk, and network usage ensures your RivinCloud VPS runs smoothly. Regular performance health-checks help you resolve issues proactively before they lead to downtime.