Speed up your Ubuntu!


Back to the home page


Speeding up your Ubuntu 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 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.


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 (2 GB or less): 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 4 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 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. 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, and only fit for servers. Decreasing this 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:

a. First make sure that you have installed the applications gksu and leafpad:

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

Type (or copy/paste):
sudo apt-get install gksu leafpad

Press Enter and submit your password. Please note that the password will remain invisible, not even asterisks will show, which is normal.

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):
gksudo leafpad /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 green lines:

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

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 10.

Note: if your hard disk is an SSD, your machine will benefit from an even bigger decrease in swappiness. That's because too many write actions, like frequent swapping, reduce the lifespan of an SSD. For an SSD I advise a swappiness of 1. Also check these tips for optimizing an SSD for your Linux.

More than 1 GB memory (RAM): tame the inode cache

1.2. Computers with more than 1 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 more than 1 GB of RAM.

This is how you do it:

a. Make sure that you have installed the applications gksu and leafpad:

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

Type (or copy/paste):
sudo apt-get install gksu leafpad

Press Enter and submit your password. Please note that the password will remain invisible, not even asterisks will show, which is normal.

c. Then type in the terminal (use copy/paste):
gksudo leafpad /etc/sysctl.conf

Press Enter.

Scroll to the bottom of the text file and add your swappiness and cache parameters to override the defaults, so copy/paste the following two green lines:
# Improve cache management
vm.vfs_cache_pressure=50
d. Close the text file and reboot your computer.

Only 768 MB RAM or less: enable zRam

1.3. When your computer has very little RAM (768 MB or less), then of course your best choice is a lightweight member of the Ubuntu family, like Lubuntu. But even 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 5.

In that case, you might achieve better results by enabling the experimental kernel module zRam. zRam creates a compressed swap file in your RAM. The compression factor is the gain: with that, you "increase" your RAM.

Note: this hack might make your system unstable! So do not apply it on important computers.

The price you pay for this, is threefold:

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

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

- For the time being it's still an experimental module, so this extra layer of complexity might cause instability.

That's why, for the time being, I advise zRam only for computers with very little RAM, and even then only in combination with a swappiness that has been decreased to 5. Furthermore, zRam isn't suitable yet for production computers, but only for test machines and other, non-essential computers.

You can install it as follows:

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

Type (use copy/paste):
sudo apt-get install zram-config

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

Reboot your computer.


Check

Now check whether it works, with the following terminal command:
cat /proc/swaps

Press Enter.

If all has gone well, you should receive a report about one or more /dev/zram "partitions". zRam is active then; no need for further action.

How to disable zRam again

1.3.1. When you want to disable and remove zRam again, it can't be done by the simple terminal command "apt-get remove". This is how you do it:

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

Type (use copy/paste):
sudo apt-get purge zram-config

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

b. Reboot your computer.

c. Now check whether the removal has succeeded, with the following terminal command:
cat /proc/swaps

Press Enter.

If all has gone well, you should receive no report anymore about one or more /dev/zram "partitions".

Disable the visual effects: switch to a 2D desktop environment

2. By default, when your video card can handle it, the 3D visual effects are enabled. However, these may cause malfunctions or sluggish performance. You can disable them by switching to a 2D desktop environment.

There are several options for this.

My personal favourite is a switch to the Xubuntu desktop. But there's another option as well:

a. First, install gnome-session-flashback:

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

Type (use copy/paste):
sudo apt-get install gnome-session-flashback

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

b. Log out. In the login window, click on the Ubuntu logo next to your user name:


Then click on GNOME Flashback (Metacity).
Note: don't select GNOME Flashback (Compiz), because that also has 3D effects, and you want to get rid of those.

c. Log in again.

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 can 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

(continued in the column on the right)


This website is being sponsored by Google Ads.

Are you using an ad blocker? Then you're also blocking my earnings from advertisements....

If you wish to support my website, you can configure your ad blocker to make an exception for this website. Or you can make a donation (and get free goodies).

Thanks in advance....


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 Lubuntu):

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:
Click on the grey Ubuntu logo (Dash home). Query: startup.

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, Chrome and Chromium. 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.

Make Firefox write less to the hard disk

7. By default, Firefox writes a lot to the hard disk. This costs system resources.

You can sharply reduce the write actions of Firefox by disabling the 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. You can disable it as follows:

Type about:config in the url bar of Firefox and press Enter. Click the button to accept the risk.

In the search bar, type: sessionstore

Double-click on the item called browser.sessionstore.interval. The default interval is 15000, which means 15 seconds. Add three zeroes to the existing value, so that it becomes: 15000000 and click the OK button (note: adding too much zeroes causes an error!).

Now disable the following three other sessionstore items, by simply double-clicking them (so that "true" becomes "false"):

browser.sessionstore.restore_on_demand

and:

browser.sessionstore.resume_from_crash

and:

services.sync.prefs.sync.browser.sessionstore.restore_on_demand

Close Firefox and launch it again.

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

8. Does your system have lots of RAM memory? If it has at least 4 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.

This is how you do it:

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

Copy/paste this green 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: do not apply this on systems with less RAM than 4 GB! Because then this tweak won't make them faster, but (much) slower.

How to undo tmpfs

8.1. 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

9. 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 much.

You can do that as follows:

a. First find out if Ubuntu or Mint applies power management to your wireless chipset:

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

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.

b. When Power Management is on, first make sure that you have installed the applications gksu and leafpad:

Type in the terminal (or copy/paste):
sudo apt-get install gksu leafpad

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

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

gksudo leafpad /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Press Enter.

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.

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!

Speed up your Intel wireless chipset

10. 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 category, however, is only a minority.

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/iwlwifi11n.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 (item 10.1).

Problems? Then undo it like this

10.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/iwlwifi11n.conf

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

Clean up your Ubuntu

11. A clean Ubuntu will perform better than an Ubuntu that has become polluted too much (although pollution is much less of a problem than in Windows). This is how to clean Ubuntu up.

Want more tips?

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

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


Comments