7 Easy Ways to Fix High CPU Usage in Linux

Due to high CPU usage in Linux, there are times when you often have to deal with delayed or unresponsive programs.

This happens when the CPU on your Linux system is overloaded; as a result, subsequent requests usually cannot be processed, and queued requests must wait until the CPU becomes free.

Use the appropriate instructions to determine which processes are typically CPU consuming on Linux if you want to know which ones are consuming it.

What is the processor limit?

There are various levels at which a CPU limit can be set: it indicates the percentage limit on database access to CPU resources.

This level represents the percentage limit of available host or LPAR CPU resources for all subclasses of the function superclass. You can check the CPU limit using the iostat command and the mpstat command.

What causes high CPU usage in Linux?

The most common causes of high CPU usage are:

  1. Resource problem. High CPU usage can be caused by system resources including RAM, disk space, memory usage, Apache, etc. They can be solved by deleting the cache.
  2. Code error. A problem with the application can lead to memory leaks and other issues.
  3. System configuration. Usage problems may occur due to default settings or other configuration errors.

How do you troubleshoot CPU performance issues?

Learn how to troubleshoot high CPU usage on Linux here.

  • Reload. Start by saving your work and restarting your computer.
  • Existing or new processes. (CTRL+SHIFT+ESCAP) Start Task Manager.
  • Update your drivers
  • Check for malware.
  • Select Power Options.
  • Find specific advice online.
  • Reinstall Windows.

How to limit cpu usage?

Follow this metric to limit CPU usage:

  • Processor power management. Get access to the control panel.
  • Select hardware and sound.
  • Then select power options.
  • Edit plan settings.
  • Change your power settings.
  • Reduce CPU state to max, 80% or whatever you want.

How to fix high CPU usage in Linux OS?

There are various ways to fix high CPU usage on Linux, such as using the ps command and the sar command, but we recommend that you proceed step by step.

  1. Find the culprit
  2. Update All
  3. Uninstall and reinstall the application using Ubuntu
  4. Renice or kill app
  5. Use an alternative application
  6. Revert to previous version
  7. Fix Major Applications Causing High CPU Usage

1. Find the culprit

Even the fastest processors can crash due to a problematic application. To find the offending app, use the top of the terminal or the System Monitor app.

Open a terminal, enter start, and then close it; if you want to undo it press ctrl-c or undo it.

All processes are ranked by default from most CPU intensive to least CPU intensive based on their average CPU usage.

You have identified the offending program if it consistently occupies one of the top five positions with much higher CPU usage than the others.

2. Update everything

The app may need to be updated if the problem continues to occur no matter how many times you run it.

Type the following command into your terminal:

sudo apt update && sudo apt -y upgrade

After that, run the problematic application again.

3. Uninstall and reinstall the application using Ubuntu.

If the issue still needs to be resolved, chances are it will come back due to a misconfigured setting in the Ubuntu application. It may be useful to reset it to its original state.

Before uninstalling the problematic program, back up your configuration in case it wasn’t the root of the problem and you need to restore it later. Use this command:

sudo apt clear APP_NAME

sudo apt autodelete

Reinstall the application with the following command:

sudo suitable update

sudo apt set APP_NAME

After that, the application will be restored to its original state.

4. Change or kill the app

Support for both renice and kill is enabled at the top. A beautiful application can be used to forcefully terminate a process or change its priority.

The amount of CPU resources a good application is allowed to use compared to other active processes is called its good priority. Nice takes values ​​from +19 to -20. The voltage decreases as the number increases.

Press R on the top and enter the PID of the problematic application. If changing it to ‘+5’ doesn’t work, try again with ‘+10’, ‘+15’ and finally ‘+19’ which is the lowest priority.

Please stop using the beautiful app as soon as it stops responding. The application will be deleted if you press k at the top, type in the PID and press Enter.

5. Use an alternative app

Linux has the advantage of having a large number of applications that can perform the same function. You can and should replace alternative software if it takes up a lot of CPU resources.

For example, LibreOffice Writer can be problematic software because it requires a lot of dependencies to run efficiently.

Abiword is a fantastic replacement for this app. Run the following command on the command line to set it up on Ubuntu:

sudo apt install AbiWord

6. Revert to previous version

Reverting to an earlier version is possible if the program update did not fix the problem. To use the program until the developer fixes the bugs, try downgrading and using an earlier version.

Check available versions by launching a terminal and running cmd: to downgrade your program before doing this:

sudo appropriate APP_NAME policy

The version you are using right now will have three stars next to it. Take a look at the alternatives:

We advise you to clean up your current version to fix any configuration related issues before downgrading.

Install the previous version using this on the command line:

sudo apt install APP_NAME=VERSION

7. Fix Major Applications Causing High CPU Usage

What happens if a main application like systemd or Xorg uses all your CPU power and memory?

Try disabling additional hardware on your computers, such as joysticks and printers, to disable systemd.

Let’s say you’re using Ubuntu or another similar distribution, and the device is a joystick, mouse, or keyboard. In this case, you can see all connected devices by typing xinput in your terminal – use: to disable one of them.

xinput – disable DEVICE_id

Replace disable with enable in the above command to enable the device again.

The answer is a bit more complicated for other devices. To view all additional drivers loaded as modules by the Linux kernel, type lsmod in a terminal and press Enter. Once you have located the device for the problem device and noted down its name, enter the following:

sudo nano /etc/modprobe.d/blacklist.conf

The newly opened document contains a blacklist of unloadable modules. Most likely, it already has several entries. The exact syntax must be used at the end of the file to add your module to this list. Your view should look like this:

blacklist MODULE_NAME

After rebooting and saving the file, everything can function adequately.

Try disabling the linker in your Xorg window manager. Even though this is the official policy, there are cases where the GPU handles CPU-bound activities instead. Sometimes activating compositing support also allows you to use many time-consuming effects.

Sometimes high CPU usage can also be caused by GPU drivers. Specific versions of AMD or Nvidia and Xorg drivers should get along with each other.

Upgrading or switching to another version is the answer. Alternatively, try open source drivers for your GPU.

However, they have different precise feature sets and may need additional features.

CDN CTB