How to Fix High CPU Usage in Linux

Is your PC freezing? Or have you started hearing loud CPU fan noise coming from your computer? There are many reasons for high CPU utilization in , but the most common one is a misbehaving app. Read on to find out how you can fix high CPU in Linux.

Find the Culprit

A misbehaving app can bring even the fastest processors to their knees. You can use the System Monitor app or top in the Terminal to find the problematic application.

Open your terminal, type top, and press Enter.Fix High Cpu In Linux Top

By default, all processes are sorted according to their CPU utilization, with the most CPU-hungry ones at the top. If an app is always in one of the top five slots with a CPU utilization rate significantly higher than the rest, you’ve found the culprit.

Renice or Kill the App

Top includes support for both renice and kill, so you can use those tools to change the priority of any process or forcefully stop it.

Fix High Cpu In Linux Top Renice

An app’s nice priority refers to the amount of CPU resources it’s allowed to use compared to the other running processes. Nice accepts values from +19 to -20. The higher the number, the lower the priority.

In top, press r and enter the problematic app’s PID. Try changing it to a “+5” value, and if that doesn’t help, retry with “+10”, “+15”, and finally the lowest possible priority, “+19”.

Fix High Cpu In Linux Top Kill

If the app is unresponsive, you should just stop it immediately. Press k while in top, enter the PID, press Enter, and the app will be gone.

Update Everything

If the problem persists every time you run the app, updating the app may fix the issue.

To do that, in your terminal, enter:

Fix High Cpu In Linux Sudo Upgrade

After that, try running the problematic application again.

Remove and Re-Install App

If the problem isn’t fixed, there’s a slight chance it appears because of a wrong parameter in the program’s configuration. Resetting it to its original state may help.

First, back up your configuration in case it wasn’t the cause of the problem, and you decide to restore it in the future. Then, purge the problematic app:

Fix High Cpu In Linux Purge App

Reinstall the app:

Fix High Cpu In Linux Apt Install

This will reset the app to its original state.

Revert to the Previous Version

If upgrading the app didn’t solve the problem, you can revert to the previous version instead. You can try downgrading and using an older version, at least until the developer has fixed the bugs in the app.

To downgrade your app, first check out the available versions by running your terminal and issuing:

Your currently installed version will have three asterisks next to it. Take note of the other available versions.

Before downgrading, we suggest you purge the existing version. This will eliminate any configuration-related problems.

Install the older version, with:

Fix High Cpu In Linux Apt Install Version

Use Alternative App

The good thing about Linux is that there are many apps that can do the same thing. So if one app is causing high CPU usage, you can and should replace it with an alternative.

Fixes for Core Apps Causing High CPU Usage

What happens if what’s eating up your CPU is a core app, like systemd or Xorg?

For systemd, try disabling non-essential features and secondary devices on your computer, such as joypads and printers.

If the device is a joypad, mouse, or keyboard, and you’re running Ubuntu or a compatible distribution, type xinput in your terminal to see all such connected devices. To disable one of them, use:

Fix High Cpu In Linux Xinput Disable

To reenable the device, swap disable with enable in the above command.

For other devices, the solution is somewhat more complicated. First, you’ll have to enter lsmod in your terminal and press Enter to see all extra drivers your Linux kernel loads as modules. Find the one for the offending device and note down its name. Then, enter the following:

The document you just opened is a blacklist of modules that shouldn’t load during boot. It will probably already be populated with some entries. Move to the end of the file and follow the same syntax to add your module to this list. Your entry should look like:

Save the file, reboot, and hopefully, everything will work okay now.

For Xorg, try disabling your Window Manager’s compositor. Although officially the compositor offloads CPU-related tasks to the GPU, that’s not always the case. Sometimes, by enabling compositing support, you’re also enabling many demanding effects.

Sometimes the GPU’s drivers can cause high CPU usage, too. Xorg didn’t really get along with specific versions of Nvidia’s or AMD’s drivers. The solution is upgrading or downgrading to a different version. Alternatively, you can try open-source versions of your GPU’s drivers. Still, those don’t share the exact feature-set and may lack some functionality.

Swap your Kernel

It’s rare for the Linux kernel to be the reason for high CPU utilization. Still, if you’ve reached this point with no solution in sight, you won’t lose anything trying a different one.

As stated on its official site, to install the popular Liquorix kernel in Ubuntu, visit your terminal and type:

Fix High Cpu In Linux Apt Install Kernel

This will add its repository to Ubuntu’s sources. Then, to bring the Kernel itself onboard, use:

Reboot to enable your new Kernel, and, hopefully, your CPU utilization will be back to normal levels.

We hope one of those solutions worked for you. If not, you can also try manually assigning CPU core for applications with taskset. Lastly, maybe it’s time to reinstall your OS from scratch or jump to a different distribution.

You might also like More from author

Leave A Reply

Your email address will not be published.