Linux Running Too Slow? Here’s How to Find the Cause

Linux Running Slow Feature

There’s nothing more frustrating than installing Linux on your PC and the whole system still feeling sluggish. After spending money building, purchasing or upgrading a machine, you expect it to be snappy. However, that’s not always the case, and with Linux, you can do quite a bit of investigating to check out what’s wrong. Today, we show you how to find the cause of your Linux machine running too slow.

Why Is My Linux Computer Running Slow?

Your Linux computer could be running slow for any one of the following reasons:

  • Unnecessary services started at boot time by systemd (or whatever init system you’re using)
  • High resource usage from multiple heavy-use applications being open
  • Some kind of hardware malfunction or misconfiguration

Before we find out how we can speed up a Linux computer, we need to know which methods can help us find the services started at boot time, processes running with higher or lower priorities, CPU health status, and whether the RAM is filled with much more data than it requires, and also check whether the swap memory area is full. Lastly, we also need to check if the hard disk is working well.

Examine CPU Information

When you want to speed up a slow Linux computer, the first step is to check CPU information. If your computer is struggling to open a program like Firefox or LibreOffice, there’s a possibility that it’s because your CPU is not powerful enough for heavyweight applications.

Open a terminal and run one of the following commands:

cpuinfo
cpuinfo-list

The above commands display detailed information about your CPU, such as vendor_id, model name, CPU MHZ, cache size, microcode and bogomips.

Let’s go through some important details about CPU information.

  • bogomips: simply means Bogus Millions of instructions per second. It is a standalone program that displays your system performance.
  • model_name: model_name indicates the manufacturer, model and speed of the CPU. In this case, we have an Intel(R) Celeron(R) CPU that has a speed of 1.73GHz.
  • cpu MHZ: cpu MHZ (MegaHertz) is used to measure the transmission speed of channels, buses and the computer’s internal clock. In this case the transmission speed is 1733.329GHz.

Here we can see the problem clearly: the Intel Celeron 1.73 GHz CPU is an old processor with little processing power. It’s a single core CPU that runs at a low speed, whereas many newer CPUs run 16 cores at nearly 5 GHz.

Solution

When you have an old and slow CPU, the only solution is to change to a newer one. Learn what you need to look for when buying a new processor.

Check for Services Started at Boot Time

There are different methods to check for services started at boot time. You can use any of the following commands.

This command lists services started at boot time:

service

This command lists services started at boot time. It is compatible with CentOS, AlmaLinux, Fedora, and RHEL:

chkconfig1

This command also lists services started at boottime:

initctl is a daemon control tool that allows a system administrator to communicate and interact with Upstart daemon.

init-ctl

If your system is using systemd, you can use the following command to find the services that run at boot time:

Solution

For Linux distro that are using systemd, you can use the systemctl command to manage your services, so they will not run during boot time.

Examine CPU Load

Apart from checking for services started at boot time, you can also check whether your processor/CPU is overloaded with processes. You can use the command top or any of these system monitoring tools to check CPU load.

The top command sorts processes with the highest usage on top. As you can see from the screenshot below, you can clearly identify which process/application is abusing your CPU and kill it if necessary using the kill command.

topnew

Solution

If you are running too many applications (both in the foreground and background), and your CPU is not up to par, it is best to close the applications you are not using. Also, disable any applications you are not using that are running in the background.

Alternatively, you can use preload to load commonly used applications. Preload is a daemon that runs in the background and analyzes frequently-run applications.

Open a terminal and run the following command:

Preload works in the background, so there is no need tweak it. Preload loads a section of commonly-used applications into memory to ensure faster load of these applications.

Check for Free Memory Space

RAM is where commonly used applications are usually stored. You can use the free command to check for memory information, such as free space available for RAM and so on. Less memory space can also affect a computer’s performance.

free

Solution

Either upgrade your RAM or replace your memory-intensive applications with lightweight alternatives. Applications such as Libreoffice are rather memory intensive. Instead of using LibreOffice, you can use Abiword.

Check Whether Your Hard Drive Is Overworking

Is your hard drive light constantly chugging along, yet you have no idea what it’s doing? Mysterious input/output can be a problem, so there is a top-like tool called iotop, specifically meant to help diagnose this kind of problem.

Open a terminal and enter the command:

A normal, idle system should be mostly zeros across the board, sometimes with a few small bursts while data is being written, as in the screenshot below.

linuxperformance-iotop1

If, however, you run a disk-intensive utility like find, you’ll see its name and throughput listed clearly in iotop.

linuxperformance-iotop2

Now you can easily find out which program is using your I/O, who ran it, the speed the data is being read, and more.

Conclusion

While there are many things that can potentially cause system slowness, CPU, RAM, and disk I/O are behind the vast majority of performance problems. Using the methods described here will help you determine the cause of your performance problems and how you can fix them.

The next thing you can do is to speed up your Ubuntu system. If you are also having Wi-Fi issues, check out this guide to fix the Wi-Fi not working in Linux issue.

John Perkins John Perkins

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.

10 comments

  1. Thanks a lot… It is really helpful!

    Just a quick question, my linux server is showing 95% of CPU usage in gzip command and I am amazed as I am not using it. How can I stop only this process in linux through command…..Any Idea?

    1. “95% of CPU usage in gzip command”

      At a guess it is probably logrotate running gzip (the default compression program) on a very large log file.

      Two points to consider

      1) Do not let your logfiles grow so large — logrotate them more frequently if only weekly or monthly. If daily, then examine the log file and cure the problem that is causing lots of entries in the log file.

      2) Change the default compression from gzip to bzip2 or maybe even xz to compress your logfiles to a smaller size to save on disk space and do not keep more than your reasonably need.

      ps -efw | grep gzip

      will reveal the process and its parent id, then use ps -efw | grep parent_id to show what process was invoking gzip (probably logrotate launched fron cron.daily).

  2. “Check for Services Started at Boot-Time”
    You can run BootChart for Linux. It charts the entire boot process.

    1. I just installed bootchart on my Linux Mint PC. When I run it I get a nasty looking error about a missing or empty file:
      Warning: path ‘/var/log/bootchart.tgz’ does not exist, ignoring

      It then follows up with:
      Parse error: empty state: ‘/var/log/bootchart.tgz’ does not contain a valid bootchart

      Scratch 1 solution. I have a comment about iotop as well but I’ll enter that as a separate comment.

  3. I have already commented on bootchart in reply to Dragonmouth. Now for iotop:

    I installed iotop on my Linux Mint PC. When I try to to run it (with sudo of course) I get a very verbose traceback of .py modules but the main message at the bottom is:
    /data.py, line 196, in parse_proc_pid_status
    key, value = line.split(‘:t’, 1)
    ValueError: need more than one value to unpack

    Clues? Was this released with a nasty program bug?

  4. Please, can we just forget about the free(1) command? It provides absolutely no useful information to diagnose performance issues. Newcomers to Linux are often alarmed when they see almost no free memory. You do not want *any* free memory because free memory is wasted memory. For details look at https://www.linuxatemyram.com/ for a glimpse of how Linux memory management actually works.

    Instead, use the vmstat(8) tool to monitor the paging file in-bound traffic (the SI column). Linux does implement paging but it just does not do paging (aka “swapping”) very well, so it is to be avoided. Out-bound paging traffic (the SO column) can be ignored: Linux will do anticipatory page evictions of stale memory content to make more room for the demands of the moment; SO is good, SI is bad.

  5. If it is a very old computer running slow sometimes the only answer is a very lightweight OS like puppy, or a new computer. Yet older computers can be repurposed, for things like media machines or home servers.

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.