How to Optimize Ubuntu Linux for Low-End Hardware (Command-Line Only)

On
Optimizing Ubuntu Linux for low-end hardware

If you are running Ubuntu on an old computer, some lag is noticeable while multitasking. Although Linux is known to perform well even on old hardware, a slight lag is present if you are doing resource-consuming tasks. In this guide, we'll optimize Ubuntu for performance through the command-line interface. Some of the methods given below are applicable to other Linux distros as well. After applying these techniques, your Ubuntu Linux instance will be lightning fast even on old hardware. The tutorial is focused on a minimal setup aimed at power users who prefer the command-line over the GUI interface.

Optimizing Ubuntu Linux for low-end hardware
📷 Ubuntu Linux optimization for Low-End Hardware Computers

You can apply it to modern Linux-powered computers, too. An added performance boost is always a good addition to any computer system. I've tested it thoroughly on Ubuntu and Debian machines.

Read Also:
Practical Linux Hardening Guide for Everyday Users

Remember, applying and testing these optimization methodologies on a virtual machine instance is not a good idea. Optimize a standalone Ubuntu-powered computer through the methods given below.

Step 1: Identify System Bottlenecks

Let's start with the identification of problem processes on your system. This exercise is to pin down processes contributing to slowing down your Linux computer. To do that, use the htop command.

If it's not already installed on your computer, install it through the following command:

sudo apt install htop -y

Thereafter, use the following command to shortlist the problem processes.

htop

You get a nicely formatted and colored output of all the processes running on your Linux system.

List of processes displayed through the htop command
📷 Scan and identify the problem processes listed through the htop command

In the process list, look for:

  • CPU-intensive tasks running in the background
  • Memory leaks
  • Idle and unnecessary services running in the background

You can use the F6 key to sort the process list by CPU usage or memory consumption.

Step 2: Disable Unnecessary Startup Services

Every operating system launches several background services at boot time, and Linux is no different. Some of these startup services are either never used or rarely used. Disabling them can significantly reduce stress on system resources, making your computer fast and responsive.

Let's see how to disable these startup services on a Linux machine. First, list all the services enabled on your computer.

systemctl list-unit-files --type=service | grep enabled

Now inspect the list of enabled services and select the ones you want to disable. For example, if you want to disable Bluetooth service, use the following command:

sudo systemctl disable bluetooth.service

Some other common services you may want to disable are:

  • cups.service → Printing service
  • avahi-daemon.service → Local network discovery
  • ModemManager.service → Mobile broadband

After disabling all the services, reboot the system.

sudo reboot

And, that's it! After disabling all the unnecessary services, you've moved one more step closer to optimizing your Ubuntu Linux computer.

Step 3: Remove Bloat and Unused Packages

Next, we'll remove unused packages and other types of bloat, like temporary files and cache. Cleaning up this junk helps in optimizing the overall system performance. Start with the following two commands:

sudo apt autoremove --purge
sudo apt clean

Now, check all the snaps installed on your system and remove the unused ones. To do so, use the following two commands:

# Check installed snaps:
snap list

# Remove unused ones:
sudo snap remove <package-name>

To completely remove the snap system, use the commands given below.

sudo apt purge snapd -y
sudo systemctl mask snapd

Taking these steps will free up disk space and will also reduce the startup overhead while booting.

Step 4: Switch to a Lightweight Desktop or Go CLI-Only

If the default GNOME desktop environment feels heavy on your computer, you can switch to a lighter alternative. The following are some of the light GUI desktop environments you can try out.

1. XFCE (recommended)

sudo apt install xubuntu-desktop -y

2. LXQt (ultra-light)

sudo apt install lubuntu-desktop -y

If you want to boot your Linux system directly into terminal mode, use the following command.

sudo systemctl set-default multi-user.target

And, at any time, if you want to revert to the GUI environment, run the following command.

sudo systemctl set-default graphical.target

If you are a power user who's comfortable with a text-only environment, I'd recommend using the command-line mode.

Step 5: Tweak Swappiness (RAM Optimization)

In this context, swapiness means how aggressively Ubuntu transfers inactive memory pages to the swap space on the disk. Its default value is 60, which can range between 0 and 100.

A higher value forces Linux to frequently use swap space, transferring memory pages from RAM. A lower value decreases this activity significantly. The latter approach is what you need to keep your system fast and responsive.

Here's how you can check the current swapiness value.

cat /proc/sys/vm/swappiness

Set a lower value for a faster and responsive system.

sudo sysctl vm.swappiness=15

If you want to make this change permanent, first open the sysctl.conf file.

sudo nano /etc/sysctl.conf

And add the desired value as shown below.

vm.swappiness=15

Save the file and execute the following command:

sudo sysctl -p

Now, the swapiness value will persist through subsequent boots in the future.

Step 6: Tune Disk I/O Scheduler

High disk I/O activity also contributes to making the system sluggish. To counter this problem, an optimized multi-queue I/O scheduler for disk reads and writes can help. Here are some of the options available for Ubuntu Linux.

  • Use mq-deadline or noop for SSD drives.
  • Use bfq or deadline for HDDs.

To check which I/O scheduler is currently being used on your Linux system, use the following command.

cat /sys/block/sda/queue/scheduler

As an example, let's set a new I/O scheduler for an SSD drive. Here's how you go about it.

# Set new one (forSSD)
echo mq-deadline | sudo tee /sys/block/sda/queue/scheduler

# Make it permanent (open the file)
sudo nano /etc/udev/rules.d/60-io-scheduler.rules

# Add an entry and save the file
ACTION=="add|change", KERNEL=="sda", ATTR{queue/scheduler}="mq-deadline"

Reboot the system for changes to take effect. Now, your Linux system's disk I/O activity will be optimized for maximum performance.

Step 7: Disable GNOME Animations via CLI

If you still prefer the GUI environment and are currently using the default GNOME desktop, you can optimize and speed it up by disabling animations. To do so, use the following command:

gsettings set org.gnome.desktop.interface enable-animations false

After applying this setting, a reboot is not required as the effect takes effect instantly.

Step 8: Analyze Boot Delays

If your Ubuntu system takes a long time to boot, it's time to optimize it. To do that, you have to analyze which services and applications are slowing down the boot time during startup. Here's how to do it.

First, list all the services sorted on the basis of load time.

systemd-analyze blame

Also, view the dependency tree of services and apps in the boot chain.

systemd-analyze critical-chain

Both these commands will help you shortlist the services that are slowing down boot time and are also safe to disable without affecting any functionality. Disable all these services to speed up the boot time.

Step 9: Enable zRAM (Compressed Memory)

If your Linux system is low on RAM, here's another trick to optimize its performance. And that is to use the zRAM kernel module to reduce the swap space usage.

First, install it on your system if it is not already installed.

sudo apt install zram-tools -y

To check its configuration and status, use the following command:

systemctl status zram-config

The zRAM modules compress data in memory, reducing the swap space usage. This speeds up the responsiveness as swap space-related disk activity is reduced significantly.

Step 10: Replace Heavy GUI Apps with CLI Tools

And last but not least, replace heavy GUI applications with their lightweight CLI alternatives. Here's a list of some of the common ones you can replace easily.

  • File Manager: Replace Nautilus with ranger or nnn
  • Text Editor: Replace Gedit with vim or nano
  • Music Player: Replace Rhythmbox with cmus
  • System Monitor: Replace GNOME Monitor with htop
  • Network Manager: Replace Settings with nmtui or iwconfig

You can install each of these CLI tools using the following command pattern.

sudo apt install <package-name> -y

There are dozens of CLI tools for different categories of applications that you can replace with their GUI equivalents. I've listed some of the common ones.

Conclusion

Optimizing Ubuntu for low-end hardware doesn’t require a GUI or a different distro. These command-line tweaks can make your old machine perform like new with smoother multitasking, faster boots, and lower CPU load.

If you’re a developer or a tech enthusiast running Ubuntu on legacy hardware, this setup will give you maximum performance with minimal footprint.