How to speed up Linux

Updated on 4/1/2023You may have noticed as a Linux user (here we will focus on Ubuntu, but this applies to major distros), that your system has rather been slow or sluggish over time despite the powerful hardware of your computer. If you are using a Linux operating system, you may occasionally find that your system is running slower than you would like, or that certain tasks are taking longer to complete than expected. There are a number of potential causes for slow performance on a Linux system, and fortunately, there are also many ways to speed up the system and improve its performance.

Some processes or services take longer times to execute even though the processor is capable of handling a high number of tasks at ease. The reasons however can be diverse but the most common ones are rather few :
– Several open applications can be consuming your RAM
– Many unused or unnecessary applications are eating up resources at boot time
– hardware cannot handle the increasingly demanding load efficiently (specification might be old, .i.e. Hard disk, CPU… )

In this article you will learn how to identify the reasons behind your system’s sluggishness (swap memory area, RAM, CPU, hard disk health status, running services at start-up… ) and some common methods for speeding up Linux, including techniques for optimizing the system’s hardware, software, and configuration. We will also cover some best practices for maintaining the performance of your Linux system over time. so that you will be able to solve them and speed up your Linux.

Switch to more efficient desktop alternatives

To improve the performance of your system, consider installing the GNOME 3 desktop on your machine. This desktop environment is optimized for efficient resource use and smooth graphics, but it does require a powerful hardware setup to run optimally. If you have an older machine, you may experience slower performance. One solution is to try Lubuntu, a lightweight version of Ubuntu with a LX-based desktop environment. You can install it by entering:

sudo apt-get install lubuntu-desktop

in the terminal. Alternatively, you can choose an Ubuntu version that comes with a pre-installed Lubuntu desktop. Additionally, consider using lightweight alternatives for some common applications, such as Gdebi for package installation and AbiWord instead of LibreOffice Writer or AppGrid instead of the Ubuntu Software Center.

Read: How to speed up your laptop: Here are 10 tips

Services running at boot time

In order to display the list of services that started at boot time, open up your terminal and run the command below:

service –status-all

In case your system is using systemd, which provides a complete solution for system management and startup, you can first get a glimpse into the system boot-up time by running systemd-analyze command without any arguments as follows:

systemd-analyze

This will tell how much time it took the kernel, userspace and initrd to start while booting.

And use systemctl of systemd in order to find the services that run at boot time:

systemctl list-unit-files –state=enabled

Now to view a list of all running services, sorted by initialization time, the blame switch of systemd should be used as follows :

systemd-analyze blame


Use Enter key to view additional services in the list and then ‘q’ to quit.
You will be able to find out which service took an unusually long time during boot and react accordingly. If you want to disable a service from running at boot, you can run the command below :

sudo systemctl disable service_name

In Ubuntu 18.04, you can also use a graphical application in order to prevent a program from launching at startup. This is called ‘Startup Applications’ which you can invoke from the activities menu :

Once the window pops up as shown below :


Speed up Ubuntu: Remove program from launching at startup

Click on your chosen app and then press ‘Remove’ in order to prevent the selected program from starting.

Read  :How to install and uninstall applications on Ubuntu ?

Keep Ubuntu updated

Ubuntu updates are released to fix known issues and improve the overall performance and efficiency of the system. It’s important to understand the Ubuntu release cycle so you can determine which version you can upgrade to. Every two years in April, Canonical releases a Long Term Support (LTS) version, which is used by 95% of all Ubuntu installations worldwide. In the meantime, interim releases are published every six months to give users access to newer upstream capabilities for better stability, usability, and performance. To get the latest updates for Ubuntu, open the terminal and enter “sudo apt-get update.” If your release is outdated, you can check for major upgrade availability by running “sudo apt-get upgrade” and pressing “Y” when prompted. Remember to back up your files before proceeding with this task.

Replace your hard drive with an SSD

Solid State Drives or SSD, are known to have faster read and write times than when compared to the good old mechanical hard drives. Make sure to buy the right model for your machine though..

How to speed up ubuntu using an SSD

Upgrade your RAM

Since Ubuntu 18.04 demands at least 2GB of RAM in order to run smoothly, increasing your RAM might improve your machine overall speed. If your applications are resources hungry such as videos and games, you might need to add even more RAM to your system.

Read: How to encrypt a USB stick on Ubuntu

You can manually install new RAM in your machine. You would just need to make sure to acquire the right model that fits into your computer’s RAM slots.

In order to know how much RAM memory your system has, open up the terminal and run the command below:

free –m

Speed up linux mint / Ubuntu and similar distros by upgrading the RAM

To display your Ubuntu RAM type and other specifications, run the command:

sudo lshw -c memory

For more on this, you might want to read our article : How to Fix High Memory Usage in Linux

Use local mirrors

Using a mirror that is very close to your location can help speed up downloading latest software updates. This is because Ubuntu software repositories are scattered or mirrored across many countries. By default, when you set up your system, this is automatically selected, but you can always check that you are using the closest mirror.

To change mirror settings, go to activities and type in ‘Software’ :

Select the one with the caption ‘Software Updates’ as shown above. A new window will pop up :

Next click on the button ‘Settings’ . This will bring yet another dialog box :

To select the nearest server to your location when downloading something, click the drop-down box next to “Download from”. Alternatively, you can use the shell script “apt-fast” as a wrapper for “apt-get” to automatically download packages from multiple locations. This can speed up the process of downloading and updating packages by using multiple connections at once. To try out this tool,, you can install it using the official PPA by running these commands:

sudo add-apt-repository ppa:apt-fast/stable

sudo apt-get update

sudo apt-get install apt-fast

Read: What you need to do to secure Ubuntu

Speed up application load time

To improve your system’s performance, you can use Preload, a daemon that operates in the background. It speeds up the time it takes for applications to load by tracking and analyzing how software is used. Essentially, it stores frequently used apps in cache to enhance overall system performance.

In order to install Ubuntu Preload, open up a terminal session and run the following command:

sudo apt-get install preload

Ubuntu speed up

Once this is done, reboot your computer. After the startup, Preload will run in the background. You will hopefully notice an improvement in the frequently used application load time.

Increase Swap space

The ‘Swap’ space can help speed up your system in case your Linux machine does not have enough RAM to handle the daily load.

When you first install Ubuntu, a dedicated swap partition will be assigned on your hard drive. As time goes on, the ‘Swap’ size might need to be increased using ‘Gparted’ which is Ubuntu’s default disk manager.

Read: How to fix : Unable to install GParted on Ubuntu

In your activities section, type in ‘Gparted’ and open it :

You can for instance shrink your main partition after deleting your existing one.

Read: How to increase swap space in Linux

Once this is done, click on ‘Create a new partition’ in order to add a larger swap space. You can always refer to the GParted help manual for assistance. Be careful when resizing your hard drive as it is a sensitive and delicate operation. Backing up your data should be carried out beforehand.

Restart your computer

As you continue to use your computer, the number of open applications, running processes, and services may accumulate over time, both in the foreground and background. This can lead to a slower system as the available resources such as RAM, swap, and CPU power are being consumed by these tasks. One solution to this issue is to shut down your computer at least once or twice a week. Simply putting it to sleep will not solve the problem, as the processes will still be active when you wake it up again.

Keep your system clean

As time passes, many unnecessary files tend to pile up on you system. This might affect your Ubuntu’s performance especially when your hard drive is not SSD.
Make sure to uninstall the applications that you no longer need and remove unnecessary files (check out the Downloads folder).

In order to empty out the temporary cache that is used by ‘apt-get’. To do this, run the command:

sudo apt-get clean

Unused packages and dependencies can also be removed (safely) using the command below :

sudo apt-get autoremove

Read: how to keep your Ubuntu clean

Reduce overheating

You may have noticed that when a computer gets hot, it runs slow. This might affect the overall system performance negatively. In order to overcome this issue, two tools can be used to help reduce overheating CPUFREQ and TLP.

The CPUFREQ indicator allows you tweak CPU algorithms which enable the processors to adjust their frequency accordingly depending on the temperature and power consumption of the computer. can be installed by using the following command:

sudo apt-get install indicator-cpufreq

After you restart your computer, you may want to use the Powersave mode:

In order to install TLP, run the following commands in your terminal:

sudo add-apt-repository ppa:linrunner/tlp

sudo apt-get update

sudo apt-get install tlp tlp-rdw

Now to start using TLP, execute the command below :

sudo tlp start

TLP will be running as a background process afterwards.

Read: How to save power on Linux Ubuntu/Debian using cpufreq

CPU activity check

As mentioned in the previous section, when the CPU is running hot, it could be that it is handling a lot of intense computations required by some background applications some of which might just be useless.In order to glimpse into the CPU current load, you can use the top the command

The top tool enables you to sort processes according to the highest CPU usage. In order to run the top utility, simply execute the command :

top

The screenshot above provides an overview of the processes which overstrain the CPU. You have the possibility kill the culprits using the kill command.

For more on this, you might want to read our article : Ubuntu/Debian monitoring tools guide for system administrators

Hard Drive I/O monitoring

In order to monitor your Linux Disk I/O usage, there exists a free top-like utility called iotop which allows the user to monitor the Disk Input/Output activities and prints out a table of the existing I/O utilization by thread or process. In order to install iotop, run the command below:

sudo apt install iotop

After the installation is completed, start iotop by running the command below :

sudo iotop

In the snapshot above, the system is clearly idle system since there are zeros everywhere across the screen. You may notice from time to time few small positive values popping up. This actually data that is being written/read as shown below for the process systemd-journald for example:

You now have the possibility to identify the process that is I/O-hungry so that you can react accordingly.

Conclusion

One common cause is having too many open applications or running processes, which can drain system resources like RAM and CPU power. Another potential issue is not shutting down the system frequently enough, which can lead to build-up of unnecessary background processes. To fix these issues, it’s important to regularly close unused applications and shut down the system regularly. Additionally, using performance monitoring tools can help diagnose and solve problems with system slowdowns.


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

ziad nahdy

Ziad Nahdy, fan of open source and programming languages. He is a technical writer, blogger and Linux enthusiast. He loves to read and help others with their problems. He is addicted to open source software but he also loves other technology related subjects.

This Post Has 5 Comments

  1. Daniel

    I have latest KDE Neon on SSD (no swap, only /) and it is super fast (hence, no real need for tweaking).
    But… Do have a penchant for MX19 which is much slower at booting (even with a few things unloaded).
    Any suggestions?

    1. admin

      MX19 Beta 2.1 is the beta release – I would wait until this is stable enough…

  2. Jay

    Nice article, thank you

  3. LinuxLover

    I know it’s old fashioned but RAM disk anyone? (Useful fast temp/cache store)

Leave a Reply