Linux Performance Optimization: Tools and Techniques

For intermediate Linux users, you may already be somewhat familiar with basic system tools and techniques for managing your Linux system. But to further optimize your system’s performance, it is necessary to go more in depth with monitoring tools and tuning techniques. In this tutorial, we will cover some of the most essential performance tuning techniques and monitoring tools that will assist you in optimizing your Linux machine.

In this tutorial you will learn:

  • Tools for monitoring system performance
  • Techniques for optimizing Linux performance
Linux Performance Optimization: Tools and Techniques
Linux Performance Optimization: Tools and Techniques
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software top, htop, sysstat, Nagios, smartmontools, Stacer
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Monitoring Tools

First, we will go over some useful monitoring tools for Linux. When trying to optimize your system, you must know exactly how your resources are being consumed and which processes are running on the computer. This will help you make needed adjustments if you find something chewing up resources or unnecessary processes running in the background.

top and htop – Process Monitoring

The top command is installed by default and is a great way to see CPU and RAM usage on your system. It will also allow you to check which processes are consuming the most system resources. This will give you insight as to whether or not it may be necessary to upgrade system components, or rein in services that may be tying up an unreasonable amount of system CPU or memory.

$ top
Linux top command output
Linux top command output

A better alternative would be the htop command, which is just like top but more human readable. It gives you a summary that is easier to digest and interact with, but the program is usually not installed by default. If possible, it is highly recommended to install this program and use it to get a quick glimpse of which processes are chewing up the majority of your system’s hardware resources.

To install htop:

$ sudo apt install htop # Ubuntu, Debian, Linux Mint
$ sudo dnf install htop # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S htop # Arch Linux, Manjaro

To use htop:

$ htop
Linux htop command output is more user friendly
Linux htop command output is more user friendly

Hard Drive Input/Output Statistics

If you are working with computers that do lots of read/write operations, like a busy database server, for instance, you will need to check disk activity. This can be done with the help of the iostat command, which will give us statistics about the input and output operations of all the hard disks in our system.

iostat is available in the sysstat package. To install sysstat:

$ sudo apt install sysstat # Ubuntu, Debian, Linux Mint
$ sudo dnf install sysstat # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S sysstat # Arch Linux, Manjaro

To use iostat:

$ iostat

Or to run continuously for 10 seconds:

$ iostat -d 1 10
Command output of the iostat command on Linux
Command output of the iostat command on Linux

Nagios – Monitor performance of multiple devices

Nagios is a popular monitoring tool which is open source and can keep tabs on the performancce of network devices, servers, and background services. If predetermined thresholds are exceeded, Nagios will alert the system administrator so corrective action can be taken. This gives users a way to stay on top of all their devices to make sure they are working as expected.

You can download Nagios from the official website.

SMART Data – Check Hard Drive Health

All hard drives collect data about their performance statistics, bad sectors, power on hours, and other information. These stats are known as SMART (Self Monitoring Analysis and Reporting Technology) data, and can be viewed if your system has the smartmontools package installed.

To install smartmontools:

$ sudo apt install smartmontools # Ubuntu, Debian, Linux Mint
$ sudo dnf install smartmontools # Fedora, Red Hat, CentOS, AlmaLinux
$ sudo pacman -S smartmontools # Arch Linux, Manjaro

To use smartmontools to check the current status of a hard drive (/dev/sda):

$ sudo smartctl -a /dev/sda

To see more smartctl usage examples and learn how to run diagnostic tests on your hard drives, check out our tutorial on How to check an hard drive health from the command line using smartctl.


Stacer allows Linux users to monitor and optimize multiple aspects of their operating system. Stacer monitoring includes but is not limited to CPU load monitoring, disk performance and usage. Stacer also allows for number of system configurations as well as it is capable to perform disk clean up.

Stacer system monitoring tool
Stacer system monitoring tool

Performance Tuning

There are many ways to tune the performance of your Linux system, and the techniques you employ may vary depending on what kind of system you are working with (for example, a database server vs. a backup server). Here is a list of some of the most general optimizations that can be made to any kind of Linux system:

Reducing System Overhead by Eliminating Running Processes

A computer’s resources are used by processes running on the system. Therefore one of the easiest ways to free up resources and thereby improve performance is to eliminate any services that you do not need on your system. You can see a list of services / daemons running on your Linux system by using the systemctl command.

# systemctl list-units --type=service

For more information and to see how to disable services from running, see our tutorial on How to use systemctl to list services on systemd Linux

Use an Optimized Desktop Environment

One of the most resource consuming things on any Linux system is the desktop environment. This is one of the primary reasons that Linux servers, in general, simply do not run a GUI at all. If you need a GUI because you use your system for desktop activities like watching videos and browsing the web, then you may want to consider installing a lightweight desktop environment such as LXQt. Such desktop environments are specifically designed with performance in mind, and lack many of the unnecessary aesthetics and features of bulkier desktop environments like GNOME, KDE, etc. See our tutorial on Using Linux without GUI for more information.

Customizing the Kernel

Customizing the kernel is a very advanced process that will elude the vast majority of Linux users, but it is definitely a good way of optimizing a Linux system. It allows us to completely strip out components of the operating system that we do not need. For example, a web server will not need sound drivers, so these could be excluded from the Linux kernel.

The process is quite lengthy and takes a lot of explanation, so we have a dedicated guide Build custom kernel on Debian / Ubuntu to help you with the process. This option is very advanced and not necessary in the majority of situations, but can be a fun experiment nevertheless.

Closing Thoughts

In this tutorial, we learned about some tools and techniques to assist with performance optimization on a Linux system. By monitoring your system performance and making gradual adjustments, you can reduce system overhead and get a more responsive system with freed up resources. By using the right tools and techniques, you can take your Linux performance to the next level.

Comments and Discussions
Linux Forum