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 whateverinit
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:
cat /proc/cpuinfo
lscpu
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.
Also read: Using the /proc Filesystem to Examine Your Linux Inner Workings
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 --status-all
This command lists services started at boot time. It is compatible with CentOS, AlmaLinux, Fedora, and RHEL:
chkconfig --list
This command also lists services started at boottime:
initctl list
initctl
is a daemon control tool that allows a system administrator to communicate and interact with Upstart daemon.
If your system is using systemd, you can use the following command to find the services that run at boot time:
sudo systemctl list-unit-files --state=enabled
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.
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:
# Ubuntu/Debian sudo apt install preload # Fedora sudo dnf install preload
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.
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:
# Ubuntu/Debian sudo apt install iotop # Fedora/CentOS sudo dnf install iotop
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.
If, however, you run a disk-intensive utility like find, you’ll see its name and throughput listed clearly in iotop
.
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.
Our latest tutorials delivered straight to your inbox