Speed Up your Ubuntu!


Back to the home page


Speeding up your Ubuntu 20.04 is fun! That way, you'll get more performance out of your computer for free.

Note: are you using Linux Mint? There's a separate page for speed tips for Linux Mint.

There are several tweaks to make Ubuntu run faster on a slow computer. Some are quite safe, some are risky. Here you'll find only the safe ones.

I don't like risky tweaks, because I think that stability and reliability are much more important than a little speed gain. That's why I've collected a couple of speed tips, that you can apply safely and with which you can make your Ubuntu run considerably faster in many cases.

Those tips are mainly how-to's that can be found elsewhere on this website as well, but scattered all over the site. I've bundled them on this page, that only deals with speed gain.

Note: even though in general you can apply those tips safely, nothing in life is really for free.... You always pay some "price". You disable a particular system service, a couple of nice visual effects or some feature.

Each tweak therefore has its own "price tag". So you should consider before you apply a tip, whether you're willing to pay the "price" for it.

OK, now that that's out of the way, let's get started:

Contents of this page:

Improve usage of the system memory (RAM)

1. You can improve the usage of the system memory with the following tweaks:

The absolute number one: decrease swap use

1.1. This is especially noticeable on computers with relatively low RAM memory: they tend to be far too slow in Ubuntu, and Ubuntu accesses the hard disk too much. Luckily, this can be helped.

Note: does your computer have 8 GB RAM or more? Then you can skip this item, because with so much RAM you probably won't notice any benefits from applying it.

On the hard disk there's a separate file or partition for virtual memory, called the swap. When Ubuntu uses the swap too much, the computer slows down a lot.

Ubuntu's inclination to use the swap, is determined by a value called swappiness. The lower the value, the longer it takes before Ubuntu starts using the swap. On a scale of 0-100, the default value is 60. Which is much too high for normal desktop use; the optimal compromise is probably 20. Decreasing this default value on a desktop computer has no negative side effects whatsoever.

A detailed explanation can be found here (link dead? Then download this pdf file with the same content).

Now the how-to for decreasing the swappiness to a more reasonable level, namely 20:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Now check your current swappiness value. Type in the terminal (use copy/paste):

cat /proc/sys/vm/swappiness

Press Enter.

The result will probably be 60.

c. To change the swappiness into a more sensible setting, type in the terminal (use copy/paste to avoid typo's):

gedit admin:///etc/sysctl.conf

Press Enter.

Scroll to the bottom of the text file and add your swappiness parameter to override the default. Copy/paste the following two blue lines:

# Decrease swap usage to a more reasonable level
vm.swappiness=20

d. Save and close the text file. Then reboot your computer.

e. After the reboot, check the new swappiness setting:

Launch a terminal window.
(You can launch a terminal window like this: *Click*)

Type (use copy/paste):

cat /proc/sys/vm/swappiness

Press Enter.

Now it should be 20.

Note: if your hard disk is an SSD, there's an extra reason to decrease swappiness. That's because too many write actions, like frequent swapping, reduce the lifespan of an SSD. Also check these tips for optimizing an SSD for your Linux.

At least 6 GB memory (RAM): tame the inode cache

1.2. Computers with at least 6 GB of memory (RAM), will probably benefit by shrinking the inode cache less aggressively.

The price that you pay for this, is that certain system items will remain longer in the RAM memory, which decreases the amount of available RAM for general tasks. That's why this tweak is only useful for computers with at least 6 GB of RAM.

This is how you do it:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Then type in the terminal (use copy/paste):

gedit admin:///etc/sysctl.conf

Press Enter.

c. Scroll to the bottom of the text file and add your cache parameter to override the defaults, so copy/paste the following two blue lines into it:

# Improve cache management
vm.vfs_cache_pressure=50


d. Close the text file and reboot your computer.

Only 4 GB RAM or less: increase zswap

1.3. When your computer doesn't have much RAM (4 GB or less), then the "lack" of memory will remain a problem, which will cause your system to slow down from time to time. Even when the swappiness has been decreased to 20.

In that case, you'll often achieve better results by increasing the maximum for zswap. By default, zswap uses up to 20 percent of the RAM memory. It's a kernel feature that provides a compressed RAM cache for swap pages.

Pages which would otherwise be swapped out to disk are instead compressed and stored into a memory pool in RAM. Once the pool is full or the RAM is exhausted, the least recently used page is decompressed and written to disk, as if it had not been intercepted. After the page has been decompressed into the swap cache, the compressed version in the pool will be freed.

With "only" 4 GB RAM or less, I recommend to double the maximum for zswap to 40 percent (not more!).

The price you pay for this, is twofold:

- Your processor (CPU) is being taxed more heavily, because it'll have to compress and decompress more;

- When the system has filled the RAM swap, it'll start swapping on the hard drive as well. With a heavy burden on the available RAM: the chunk of memory that has been sacrificed for the RAM swap.

That's why I advise to increase zswap only for computers with not so much RAM, and even then only in combination with a swappiness that has been set to 20.

You can increase zswap as follows:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Copy/paste the following command line into the terminal:

gedit admin:///etc/default/grub

Press Enter.

(the three consecutive slashes are intended and no typo!)

c. Find the following line:

GRUB_CMDLINE_LINUX=""

Add zswap.max_pool_percent=40 between the quotation marks, or simply replace the entire line by the following line (use copy/paste):

GRUB_CMDLINE_LINUX="zswap.max_pool_percent=40"

Save the modified file and close it.

d. Copy/paste the following command line into the terminal, in order to execute the modification:

sudo update-grub

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

(if you type the command: note the dash between update and grub)

e. Reboot your computer.

You can check whether the change has been implemented with this command:

cat /sys/module/zswap/parameters/max_pool_percent

It should report 40 now.

Weak graphics card? Consider turning your Ubuntu into Xubuntu

2. By default, when your video card can handle it, 3D visual effects are enabled in Ubuntu. However, on weak hardware these may cause malfunctions or sluggish performance. If you experience such problems you might consider disabling them, which you can do by switching to a 2D desktop environment.

The best way is then to turn your Ubuntu into Xubuntu.

Make your Solid State Drive (SSD) run faster

3. Do you have an SSD for hard drive? Then optimize it to make it faster.

Disable Java in Libre Office

4. The performance of Libre Office might be enhanced greatly, when you disable Java in it. This will disable a few features, but usually you won't even miss those.

Toolbar Libre Office Writer - Tools - Options...

LibreOffice - Advanced - Java options:
remove the tick for: Use a Java runtime environment

Turn off some startup applications

5. You can speed up Ubuntu somewhat, by disabling a couple of system services, that may be superfluous for you. This tweak can be compared to tweaking msconfig in Windows.

First make all startup applications visible, because in Ubuntu most of them are hidden by default (not so in Xubuntu and Bodhi Linux):

Launch a terminal window.
(You can launch a terminal window like this: *Click*)

Type (use copy/paste):

cd /etc/xdg/autostart/

Press Enter.

Then copy/paste this into the terminal (it's one line!):

sudo sed --in-place 's/NoDisplay=true/NoDisplay=false/g' *.desktop

Press Enter. When prompted, type your password. Your password will remain entirely invisible, not even dots will show, this is normal.
Press Enter again.

Now check the Startup Applications:

On the bottom left, click on the button with the white dots (Show Applications). Query: startup

Click on Startup Applications

Untick what you don't need and reboot your computer (or log out and then log in again).

Note: only remove the ticks, do not remove the application from the list! Keep the tweak easily reversible (you never know). When in doubt about a particular application: don't do anything, just leave it the way it is.

Examples of system services that many people don't need:
- Bluetooth Manager
- NVIDIA X Server Settings

Note: unticking startup applications is a user preference, so repeat in each user account.

Add-ons and extensions: don't turn your web browser into a Christmas tree

6. You can install a lot of add-ons (extensions) in the web browsers Firefox and Google Chrome. Those add-ons can be very useful, but they have a couple of important disadvantages, because they are "applications within an application":

- they slow your browser down, especially if there are a lot of them;
- they can cause malfunctions; both in each other and in the browser itself;
- it has occurred: add-ons with malicious content. Don't trust them blindly.

So don't turn your browser into a Christmas tree: don't adorn it with lots of add-ons. Limit yourself to only a few add-ons, that are really important for you.

Note: watch out for add-ons that claim that they make your browser faster! Often they do more harm than good. Do not install them: even if one or two of them can really make your browser run noticeably faster, they may damage the stability of your browser.

Limiting the disk write actions of Firefox

7. By default, Firefox writes a lot to the hard disk. This reduces its speed. You can limit the disk write actions of Firefox, by putting the Firefox network cache into the RAM and by disabling sessionstore. Like this:

Putting the Firefox network cache into the RAM

7.1. By moving the Firefox network cache from your hard disk to the RAM, you diminish the amount of disk writes. This'll probably make your Firefox noticeably faster. The price you pay is small: it'll only "cost" you 300 MB of your RAM.

Note: don't do this when your computer has only 2 GB of RAM or less! Because with very little RAM, even 300 MB can't be missed.

Proceed like this:

a. Type in the URL bar of Firefox:
about:config
Press Enter.

b. Now you're being presented with a warning. Ignore it and click on the button "I accept the risk!".

c. Copy/paste the following into the filter bar (search bar):
browser.cache.disk.enable
Toggle its value to false by double-clicking it: this will disable "cache to disk" entirely.

d. Now you're going to make sure that "cache to RAM" is enabled. Copy/paste the following into the filter bar (search bar):
browser.cache.memory.enable
This should already be set to true; if not, toggle it to true by double-clicking it.

e. Then you're going to determine how much memory can be used as RAM cache. Copy/paste this into the filter bar (search bar):
browser.cache.memory.capacity
It should exist already (if not, create it now). The current integer value will probably be -1, which automates the size of the RAM cache dependent on the amount of RAM. Set it to 307200 (KB, which equals 300 MB). That's usually enough for all amounts of RAM.

f. Close Firefox and launch it again. You're done! Check it like this:

Type in the URL bar:
about:cache
Press Enter.

By the way: you'll then also see a mention of an "appcache" which is still present on the disk, but there's no need to move that (much less frequently used) cache to the RAM as well.

Note: This is a user preference. Repeat this hack in each user account.

Disabling sessionstore

7.2. Firefox has a session restore feature, which remembers what pages were opened if Firefox experiences an unexpected shutdown (read: crashes). This feature is neat, but causes many disk writes. Disable it like this:

a. Type in the URL bar of Firefox:

about:config

Press Enter.

b. Now you're being presented with a warning. Ignore it and click on the button "I accept the risk!".

c. Type in the filter bar: sessionstore

c. Double-click on the item called browser.sessionstore.interval. The default interval is 15000, which means 15 seconds. Add three zeros to the existing value, so that it becomes: 15000000 and click the OK button.

d. Close Firefox and launch it again. Now you've practically disabled the session restore feature.

Note (1): Leave the other cache and sessionstore settings as they are: usually, the less invasive a hack is, the better. Because this reduces the risk of unexpected unwanted side effects.

Note (2): This is a user preference. Repeat this hack in each user account.

Firefox: optimize the Places database from time to time

8. In your Firefox profile there's an sqlite database called Places, which after a while starts resembling a swollen Swiss cheese with holes. That might slow your Firefox down.

You can speed your Firefox up a bit, by optimizing (vacuuming) that database: you can namely deflate that swollen Swiss cheese into a compact smaller cheese. As follows:

Type the following in the URL bar of Firefox:

about:support

Press Enter.

Almost at the bottom of the page you get to see then, there's a header called Places Database. Click there on the button called Verify Integrity.

You're done! Repeat this on a monthly basis, so that your Firefox won't lose speed again because of a swollen database.

Lots of RAM (at least 8 GB): put /tmp on tmpfs

9. Does your system have lots of RAM memory? If it has at least 8 GB, then you can probably speed up your system a bit by placing /tmp on a tmpfs partition. Which means, translated into ordinary language: you bring about that temporary files will not be placed on the hard disk anymore, but on a virtual RAM disk instead.

In certain cases this will not only improve overall performance, but also reduce boot time.

This is how you do it:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

Copy/paste this blue line into the terminal (it's one line!):

sudo cp -v /usr/share/systemd/tmp.mount /etc/systemd/system/

Press Enter. Type your password when prompted; your password will remain entirely invisible, not even dots will show when you type it, this is normal.

b. Then copy/paste this command into the terminal:

sudo systemctl enable tmp.mount

Press Enter.

c. Reboot your computer.

d. After the reboot: check whether it works, with this terminal command:

systemctl status tmp.mount

By default, a tmpfs partition has its maximum size set to half your total RAM. The actual memory consumption depends on how much you fill it up, as a tmpfs partition doesn't consume any memory until it is actually needed.

Note: in general, do not apply this on systems with less RAM than 8 GB! Because then this tweak might not make them faster, but (much) slower.

Changing the default maximum size of tmpfs

9.1. As said: by default, a tmpfs partition has its maximum size set to half your total RAM. The actual memory consumption depends on how much you fill it up, as a tmpfs partition doesn't consume any memory until it is actually needed.

If you wish to set another maximum size for tmpfs than the default, you can do that by adding a size option to /etc/systemd/system/tmp.mount. For example, if you wish to set the maximum size to 2 Gigabyte, copy/paste this line into the terminal:

sudo sed -i 's/,nodev/,nodev,size=2G/' /etc/systemd/system/tmp.mount

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

Afterwards, reboot your computer.

After the reboot you can check whether the modification has succeeded, by executing this command:

df -h /tmp

How to undo tmpfs

9.2. Do you wish to undo tmpfs? Then copy/paste this line into the terminal:

sudo rm -v /etc/systemd/system/tmp.mount

Press Enter. Type your password when prompted; your password will remain entirely invisible, not even dots will show when you type it, this is normal.

Afterwards, reboot your computer.

Speed up your wireless internet (some WiFi chipsets)

10. For some wireless chipsets, a simple tweak is sufficient for increasing the speed and the connection quality of your wireless internet. Namely disabling the power management for the wireless chipset. The price you pay is obviously an increase in power consumption, although this increase isn't big.

There are two ways to do it: an easy way and a harder way. Below I describe both methods.

The easiest way: speeding up your WiFi by executing a single command

10.1. The easiest way to speed up your wireless internet connection by executing a single command that disables power management for the WiFi chipset, goes like this:

a. First you need to find out whether Ubuntu applies power management to your WiFi chipset. For this, launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Type in the terminal:

iwconfig

Press Enter.

You can then not only see the name for your wireless chipset (for example: wlp2s0), but also whether Power Management is on for it. When it's off, or when no mention is made of Power Management at all, you don't need to do anything.

When Power Management is on, proceed as follows:

c. Use copy/paste for transferring the following line into the terminal (don't try to type it!):

sudo sed -i 's/3/2/' /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

d. Reboot your computer.

e. Then check in the terminal, by the command iwconfig, whether Power Management for the wireless chipset is off now.

If so, you're done!

The harder way: speeding up your WiFi by editing a file manually

10.2. You can also edit a configuration file by hand, in order to disable power management for the Wifi chipset. It's a bit more difficult than the method described in item 10.1, but you can do it as follows:

a. First you need to find out whether Ubuntu applies power management to your wireless chipset. For this, launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Type in the terminal:

iwconfig

Press Enter.

You can then not only see the name for your wireless chipset (for example: wlp2s0), but also whether Power Management is on for it. When it's off, or when no mention is made of Power Management at all, you don't need to do anything.

c. When Power Management is on, proceed as follows.

In order to prevent typo's, copy/paste this line into the terminal (it's one line!):

gedit admin:///etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Press Enter.

d. Now a text file opens. In that text file, you see the following content:

[connection]
wifi.powersave = 3


Change 3 into 2.

Save the modified file and close it.

e. Reboot your computer.

f. Then check in the terminal, by the command iwconfig, whether Power Management for the wireless chipset is off now.

If so, you're done!

Speed up your Intel wireless chipset

11. If you have a (reasonably) modern wireless chipset from Intel, it'll run on the iwlwifi driver. If so, you'll probably be able to increase its speed noticeably, by turning on Tx AMPDU for it.

The purpose of AMPDU is to improve data transmission by aggregating or grouping together several sets of data. Thus it reduces sharply the amount of transmission overhead.

It used to be "on" by default in the iwlwifi driver. But several years ago, it was turned off because of stability issues on a few wifi chipsets. This problem, however, affects only a minority of chipsets.

For turning it on, proceed like this:

a. First check whether your chipset runs on the iwlwifi driver:

Launch a terminal window.
(You can launch a terminal window like this: *Click*)

Use copy/paste to transfer this line into the terminal:

lsmod | grep iwlwifi

Press Enter.

Does the terminal output contain the word iwlwifi (in red letters)? If so, proceed with the next step.

b. Use copy/paste to transfer the following blue line (it's one line!) to the terminal. Don't type it; it's too easy to make typing errors....

echo "options iwlwifi 11n_disable=8" | sudo tee /etc/modprobe.d/iwlwifi-speed.conf

Press Enter and submit your password. Note that your password will remain entirely invisible, not even asterisks will show, which is normal.

c. Reboot your computer.

d. Finally, check your new wireless speed, for example on speedtest.net.

Has your wifi become unstable? Then undo the iwlwifi hack as described below.

Problems? Then undo it like this

11.1. Does the iwlwifi hack create stability issues for your wifi? Then undo it with the following terminal command:

sudo rm -v /etc/modprobe.d/iwlwifi-speed.conf

Then reboot. All should be then, as it was before.

Turn off the firewall log

12. Have you enabled the firewall (which is recommended)? Then you'll probably never look at its logs, so it won't hurt to turn off all logging by the firewall. Especially because it can be rather spammy sometimes. Turning off its log can save some system resources and disk space, and can be done like this:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Copy/paste this blue line into the terminal:

sudo ufw logging off

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

Regrets? Then turn firewall logging on again like this

12.1. Do you want to enable logging by the firewall again? Then use the following terminal command to turn firewall logging on again with the default amount of activity (low):

sudo ufw logging low

All should be then, as it was before.

Increase battery life by disabling the Bluetooth driver

13. If you rarely use Bluetooth, you can probably increase the battery life of your laptop a lot by disabling the Bluetooth driver (instead of simply disabling the Bluetooth feature). Like this:

a. Launch a terminal window.
(You can launch a terminal window like this: *Click*)

b. Copy/paste this blue line into the terminal (it's one line!):

echo "blacklist btusb" | sudo tee /etc/modprobe.d/blacklist-bluetooth.conf

Press Enter. Type your password when prompted. In Ubuntu this remains entirely invisible, not even dots will show when you type it, that's normal. In Mint this has changed: you'll see asterisks when you type. Press Enter again.

c. Reboot your computer.

How to undo (re-enabling Bluetooth support)

13.1. Do you want to enable Bluetooth again? Then proceed as follows:

a. Temporary re-enabling Bluetooth can be done with this terminal command:

sudo modprobe -v btusb

This will instantly re-enable Bluetooth, but it won't survive a reboot.

b. Permanent re-enabling of Bluetooth can be achieved by the following terminal command which removes the Bluetooth module from the blacklist:

sudo rm -v /etc/modprobe.d/blacklist-bluetooth.conf

Then reboot your computer. Bluetooth should be available again permanently.

Clean up your Ubuntu

14. A clean Ubuntu will perform better than an Ubuntu that has become polluted too much with file debris and disordered settings (although pollution is much less of a problem than in Windows). This is how to clean Ubuntu.

Want more tips?

15. Do you want more tips and tweaks? There's a lot more of them on this website!

For example:

Avoid 10 fatal mistakes


To the content of this website applies a Creative Commons license.

Back to the home page

Disclaimer