Skip to content

Top 10 CPU-Intensive Processes in Linux: How to Identify?

Advertisement

Hey there! If you’re using Linux—whether it’s on a server, your laptop, or some random project—you’ve probably noticed it can slow down sometimes. Usually, that’s because a few processes are hogging the CPU. Figuring out what they are and getting them under control can make a huge difference. So, let’s walk through how to spot the top 10 CPU-heavy processes and what you can do about them. Trust me, it’s easier than it sounds!

Here is the quick command to find CPU-intensive processes:


ps -eo pid,ppid,cmd,%cpu --sort=-%cpu | head -n 11

Why Bother Checking CPU Usage?

Picture this: your system’s lagging, apps are taking forever to respond, or maybe your server’s dropping connections. Nine times out of ten, it’s because something’s chewing up all the CPU power. Keeping an eye on what’s using it helps you troubleshoot, speed things up, and make sure the important stuff gets done. Lucky for us, Linux has some awesome built-in tools to figure this out. Let’s dive in.

How to Spot the Top 10 CPU Hogs

There are a couple of go-to ways to see what’s eating your CPU. Here’s how:

1. The top Trick

If you’ve never used top, you’re in for a treat—it’s like a live dashboard for your system. Just pop open a terminal and type:

top

Boom, you’ll see a list of processes updating in real time. The %CPU column tells you who’s the greediest, and by default, it’s sorted that way. Want to quit? Just hit q. If you’re sure it’s sorted by CPU (and it usually is), the top 10 are right there at the top. Pro tip: hit Shift + P if it’s not sorted how you like.

Sort processes by cpu utilization in top command
Sort processes by cpu utilization in top command

2. The ps Move

Maybe you don’t need a live feed—just a quick snapshot. That’s where ps comes in. Try this:

ps -eo pid,cmd,%cpu --sort=-%cpu | head

It’s a mouthful, I know. Here’s what it does: it grabs the process ID (PID), parent PID, command name, and CPU percentage, sorts them from hungriest to least, and shows the top 10 (plus a header). You’ll get something clean and simple, no fancy scrolling.

List top 10 CPU using processes in Linux
Top 10 CPU utilizing processes

So, What Do You Do About It?

Now that you’ve caught the culprits, here’s how to deal with them:

1. Play Nice with nice and renice

Linux has this cool thing called “niceness”—it’s like telling a process how important it is. Values go from -20 (super important) to 19 (chill out). To start something less pushy:

nice -n 10 python3 script.py

Already running? Tweak it with:

renice 10 -p 1234

That tones down PID 1234 without killing it.

2. Put a Cap on It with cpulimit

If a process won’t behave, slap a limit on it. First, install cpulimit (on Ubuntu, it’s sudo apt install cpulimit), then:

cpulimit -p 1234 -l 20

That keeps PID 1234 at 20% CPU max. Nice and simple.

3. Pull the Plug

If it’s junk you don’t need, just kill it:

kill -9 1234

Swap in the PID, and it’s gone. Be careful, though—don’t zap something critical!

4. Dig Into the Problem

If it’s your Python script or Java app acting up, maybe it’s buggy—like an infinite loop or something. Tools like strace or perf can help you figure out what’s wrong. Takes a bit of patience, but it’s worth it.

5. Keep Things Fresh

Sometimes old software or an outdated system just works harder than it should. Update with:

sudo apt update && sudo apt upgrade

That’s for Debian or Ubuntu—adjust if you’re on another distro.

Make It Automatic

Want to stay on top of this without babysitting? Try these:

  • htop: It’s top but prettier. Install it (sudo apt install htop), hit F6, pick %CPU, and you’re golden.
  • Cron: Set up a little script to log CPU usage every 5 minutes:
  • 
    */5 * * * * ps -eo pid,cmd,%cpu --sort=-%cpu | head -n 11 >> /var/log/cpu_usage.log
    
    
  • Fancy Tools: If you’re serious, check out Nagios, Zabbix, or Prometheus. They’re overkill for most, but awesome for big setups.

Wrapping Up

There you go! With top or ps, you can track down those CPU hogs in no time, and with a few tricks—like nice, cpulimit, or a quick kill—you’ll have your system humming again. Whether you’re a Linux newbie or a grizzled sysadmin, this stuff’s handy to know. So, fire up that terminal, see what’s eating your CPU, and take charge!

Rahul

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top