Skip to content


Linux »

Tweaks for a better performance

Ubuntu, by default, provides cool desktop environment with some default settings which may consume much resource in the system. Tips here are to speed up Ubuntu, and they are valid for most versions of Ubuntu and can also be applied in Linux Mint and other Ubuntu based distributions.

Last update: 2022-05-07


Animation#

Ubuntu comes with cool effects, but it consumes system resource. Turn it off is a good way to increase system performance.

Open a terminal and enter this command:

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

Grub load time#

The grub gives you 10 seconds to change between dual boot OS or to go in recovery. This time can be reduced, by entering below command to open grub configuration:

sudo gedit /etc/default/grub &

Then change GRUB_TIMEOUT=10 to GRUB_TIMEOUT=1.

And update the settings:

sudo update-grub

Startup applications#

Look for Startup Applications and run it. There is a list of startup applications:

  • Remove if you don’t need to run a startup, or
  • Delay the execution by editing the application start command:
    • Add sleep x; to delay x seconds

Add user to sudoers#

To skip entering password on sudo command, add current user to sudoers with the rule NOPASSWD:

sudo bash -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/$USER"

Package installation#


Mirror server

Ubuntu contacts to many repos to download, update its packages. Choose the best mirror server is a good way to speed up system update or application installation.

In Software & UpdatesUbuntu SoftwareDownload From and choose Select Best Server.


No language translation

Suppressing the language translation while updating will slightly increase the apt update speed. To do that, open the following file:

sudo nano /etc/apt/apt.conf.d/00aptitude

And add the following line at the end of this file:

Acquire::Languages "none";


Use apt-fast

apt-fastis a shell script wrapper for apt-get that improves updated and package download speed by downloading packages from multiple connections simultaneously. Install apt-fast via official PPA using the following commands:

sudo add-apt-repository ppa:apt-fast/stable && \
sudo apt update && \
sudo apt install -y apt-fast

Automatic installation

First, add new repo to source list:

sudo bash -c 'echo "deb http://ppa.launchpad.net/apt-fast/stable/ubuntu bionic main" > /etc/apt/sources.list.d/apt-fast.list'

then use non-interactive method:

sudo apt-key adv \
    --keyserver keyserver.ubuntu.com \
    --recv-keys A2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B && \
sudo apt update && \
sudo DEBIAN_FRONTEND=noninteractive apt install -y apt-fast

Add alias for apt-fast:

echo 'alias sudo="sudo "' >> ~/.bash_aliases && \
echo 'alias apt=apt-fast' >> ~/.bash_aliases && \
echo 'alias apt-get=apt-fast'  >> ~/.bash_aliases && \
sudo bash -c 'echo "alias apt=apt-fast" >> /root/.bash_aliases' && \
sudo bash -c 'echo "alias apt-get=apt-fast"  >> /root/.bash_aliases'

Run source ~/.bash_aliases if you want the alias gets effective.

Unattended Update#

Ubuntu has a feature named Unattended Upgrades, which installs the latest security (and others) updates automatically whenever they are available. It comes pre-installed and enabled by default in the recent Ubuntu versions. While this feature helps to keep the Ubuntu system up-to-date, it is also quite annoying sometimes.

To disable unattended upgrades on Ubuntu and its derivatives, run:

sudo dpkg-reconfigure unattended-upgrades

Then choose No and hit ENTER to disable unattended upgrades.

Change network connection priority#

If machine is connected to Wi-Fi and Ethernet simultaneously, here is a method to set priority connection.

Install ifmetric tool which can be used to change the metric of any interface:

sudo apt install -y ifmetric

To use this, first see the metrics using route command:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.42.0.1       0.0.0.0         UG    100    0        0 eth0
0.0.0.0         10.42.0.2       0.0.0.0         UG    600    0        0 wlan0

The interface with lower metric is preferred for Internet.

Here, eth0 has lower metric, so it will be preferred over wlan0. If you want to prefer wlan0, then lower its metric:

sudo ifmetric wlan0 50

Now, the routing table would look like:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.42.0.2       0.0.0.0         UG    50     0        0 wlan0
0.0.0.0         10.42.0.1       0.0.0.0         UG    100    0        0 eth0

Now Linux will be using wlan0 for Internet. The change will be reflected immediately.

Install a lightweight Desktop Environment#

By default, Ubuntu uses GNOME 3 and GDM3, however, they are too heavy. Many users have reported that they can save 1 GB of RAM when using a lightweight desktop environment, such as LXDE, LXQt, XFCE.

Here are some choices:


MATE (GNOME2)

MATE is a lightweight desktop based on GNOME2 base code, it’s fully open source and a very nice option.

sudo apt install ubuntu-mate-core


Lubuntu (LXDE/LXQt)

Lubuntu is another lightweight option which I recommend if your system is low on resources or if you are giving new life to an older computer. Install it using this command:

sudo apt install lubuntu-core


Xubuntu (XFCE)

Xubuntu is an Ubuntu derivative based on the Xfce desktop environment that is light, simple, stable, but it’s also highly customizable. If you want to try it, use the following command:

sudo apt install xubuntu-core

When asked, select lightdm as the Desktop Manager, instead of gdm.

Missing packages in a minimal installation

The most happened issue is missing fbdev which shown in the log:

~/.local/share/xorg/Xorg.0.log
...
(WW) Warning, couldn't open module fbdev
(EE) Failed to load module "fbdev" (module does not exist, 0)
...
Fatal server error:
(EE) no screens found(EE)
...

To install fbdev, run:

sudo apt install xserver-xorg-video-fbdev

Comments

Back to top