Advertisement
linuxserver Learn how to monitor CPU, memory, disk usage, and running processes on a Linux server in real time using tools like top, htop, free, df, iotop, and vmstat. A simple and practical guide for beginners.

How to Monitor Your Linux Server in Real Time (Practical Guide for Beginners)

5 Min Read Verified Content

One of the first lessons you learn when managing a Linux server is this:

If you don’t monitor your server, problems will always surprise you.

And nobody likes surprises on production servers.

Luckily, Linux comes with great built-in tools to check what’s happening — live — without installing heavy dashboards. In this guide, I’ll walk you through the tools I personally use almost every day.

No theory — just practical usage.


🧠 First Thing: Know What You’re Looking For

When a server feels slow, the issue is usually one of these:

🔹 CPU usage is too high
🔹 Memory is full or swapping
🔹 Disk is full or overloaded
🔹 A process is stuck
🔹 Too many connections

So let’s monitor each one step-by-step.


🔥 Step 1 — Monitor CPU Usage with top

Run:

top

This shows real-time process activity.

Things I usually look at first:

CPU summary section

Example:

%Cpu(s): 15.2 us, 3.5 sy, 0.0 ni, 80.1 id, 1.1 wa

Meaning:

  • us = user processes (apps)

  • sy = system/kernel

  • id = idle (free CPU)

  • wa = waiting for disk

If id is close to 0%, CPU is maxed out.
If wa is high, you may have disk I/O problems.

Process list (below)

Look for:

  • high %CPU

  • processes stuck for long time

  • zombie processes (Z state)

Press:

  • P → sort by CPU

  • M → sort by memory

  • q → quit

Simple — but powerful.


🌈 Step 2 — Use htop (A Friendlier Version of top)

If installed:

htop

If not:

sudo apt install htop

Why I love htop:

✔ Colored graphs
✔ Easier sorting
✔ Search
✔ Scrollable list

You can instantly see which processes are heavy.

This is usually the first tool I open during incidents.


🧮 Step 3 — Check Memory Usage with free

Run:

free -h

Example:

Mem: 4.0G 3.1G 900M 200M 1.5G Swap: 2.0G 800M 1.2G

Important:

  • If swap is heavily used, RAM is not enough.

  • Swap usage often means performance drops.

A little swap is okay.
A lot → time to optimize or upgrade.


💽 Step 4 — Check Disk Usage with df

Run:

df -h

Look at the % column.

If anything is over 90%, you’re in danger.

I’ve seen servers crash just because /var/log filled up quietly.

Check large directories with:

sudo du -sh /*

Then drill deeper if needed.


🚚 Step 5 — Monitor Disk I/O with iotop

Install:

sudo apt install iotop

Run:

sudo iotop

This tells you which process is hammering the disk.

Useful for:

✔ database spikes
✔ backup jobs
✔ log writers

If wa in top is high, iotop is your friend.


🔌 Step 6 — Check Load Average with uptime

Run:

uptime

Example:

load average: 1.23, 2.10, 3.50

These are averages over:

  • 1 minute

  • 5 minutes

  • 15 minutes

Compare with CPU cores:

nproc

Rule of thumb:

  • Load ≈ cores → fine

  • Load ≫ cores → overloaded

So if load is 10 but you only have 2 cores…
Yeah — time to panic a little 😄


🌐 Step 7 — Check Network Connections with ss

Run:

ss -tulpn

You’ll see ports and services.

Useful when:

✔ a port is stuck
✔ traffic floods in
✔ malware suspicion


⚙ Bonus: Continuous Monitoring with vmstat

Run:

vmstat 2

This prints stats every 2 seconds.

Good for spotting trends, not snapshots.


🧩 Real-World Workflow I Usually Follow

When something feels slow:

1️⃣ Run top → identify CPU hog
2️⃣ Check free -h → memory? swap?
3️⃣ Run df -h → disk full?
4️⃣ Use iotop → disk I/O heavy?
5️⃣ Check uptime → load too high?
6️⃣ Tail logs → errors? runaway scripts?

It becomes second nature over time.


🚨 Signs You Should Take Action

⚠ load higher than CPU cores for long periods
⚠ swap constantly used
⚠ disk over 90%
⚠ unknown processes consuming resources
⚠ server feels laggy

These are warning signs — not to be ignored.


🎯 Final Thoughts

Monitoring a Linux server doesn’t require fancy dashboards or paid tools — although those are great too.

With just built-in utilities, you can:

✅ See what’s happening in real time
✅ Detect problems early
✅ Trace resource hogs
✅ Understand server behavior

And most importantly…

👉 You stop guessing.

Because servers always tell you what’s wrong —
you just need to know where to look.

Advertisement
Back to Linuxserver