Home / Guides

Server guide

High CPU on a Linux server: how to find the cause

A server that is slow with no extra visitors usually has one process using most of the CPU. Find that process first. The fix depends on what it is.

2 min readUpdated November 2026 by the RootManage teamWorks on Ubuntu, Debian, AlmaLinux and Rocky unless noted

The short answer

Run top or ps sorted by CPU, see which user and command owns the load, then decide: a busy site, a stuck job, bots, or malware.

See who is using it

terminal
top -o %CPU
ps aux --sort=-%cpu | head -n 15

Press 1 in top to see each core. Note the user, the command and how long it has run.

Match it to a cause

  • php-fpm or apache workers at the top: a busy or slow site. Check the access log for one address or one URL hit again and again.
  • mysqld at the top: slow queries or too many connections. See MySQL slow? Find heavy queries.
  • A job you do not know: a stuck cron, a backup or a script running twice.
  • A strange name, random letters, running from /tmp or a user home: treat it as malware (often a crypto miner).

Check for bots

terminal
sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head

One address with thousands of requests is a bot or an attack. Block it in the firewall or rate-limit it.

Look closer at a suspicious process

terminal
ls -l /proc/<PID>/exe
sudo lsof -p <PID> | head
crontab -l -u <user>

If the file is in /tmp, /dev/shm or a hidden folder, or the user has a new cron job you did not add, the server is probably compromised.

Fix it

  • A slow site: add caching, reduce workers, fix the slow plugin or query.
  • A stuck job: fix the script and add a lock so it cannot run twice.
  • Bots: rate limits and a web firewall.
  • Malware: do not just kill the process. It will come back. The entry point must be found and closed. See malware cleanup.

Questions people ask

Is 100% CPU always bad?

No. A short peak during a backup or build is normal. A server that stays at 100% for long with no clear reason needs a look.

Why does the load average matter?

It shows how many tasks wait for the CPU or disk. A load much higher than the number of cores means the server is overloaded.

Can I just kill the process?

For a stuck job, yes. For a miner or a webshell, killing it only hides the problem.

Want a person to look at it?

Tell us what you see. We reply with what we think is wrong and what it would take to fix it.