Few Tips to Make Ubuntu Linux run Faster

I remember, not that long ago, how slow GNU/Linux was while booting when compared with the Windows operating system. This was also one of the main ‘complaints’ (this and the whole proprietary codecs related issues, eh! :D) that I usually received after asking some of my friends to try GNU/Linux.

But over the years, the Kernel, file systems, the desktops etc have matured a lot, and these days, my Ubuntu OS boots even faster than Windows 7!. Two of the main reasons why Ubuntu boots fast is that, it comes with somewhat a small number of ‘system services’ (important/core software programs that are loaded into the RAM while your computer boots) & a tool that significantly speeds up the loading times of these services to the RAM called ‘Ureadahead’.

However, there are still few things that you can do to speed up the OS a bit more, so I decided to write about few things that you can try out. The article might look long, but it won’t take more than 10-15 minutes of your time.

Step 1

Removing ‘unnecessary’ system services, manually

If you know what you’re doing, then you can further get rid of another 1 or 2 services for reducing the boot-up times. There are few tools that you can use, but for ease of use, I’ll stick with the ‘BUM’ (boot-up-manager) utility.

Enter the below command in your Terminal window to install it first.

sudo apt-get install bum

Then use the below command to launch it.

gksudo bum

If you don’t use applications such as ‘screen readers’ (designed for visually impaired users), then you can safely remove a system service called ‘speech-dispatcher’ as shown below. What you do is simple, just, remove the ‘check-mark’ and then from the menu go to ‘File’ -> ‘Apply’. When asked, choose ‘Yes’.

If you won’t be using any network connections, then there are few services that you can get rid of, but I think it’s better to leave them alone.

Step 2

Removing unused applications and indicators running in the system’s background

Ubuntu comes with few applications that some users might not really use. And the reason why you might wanna remove them is because they run from your OS’s background as services, thus after removing you should not only be able to free few Megabytes from your RAM, but it should also speed up the desktop loading time as well.

Basically you can do two things. You can either completely remove some of these apps or you can disable them temporarily. Either way it’s fine, and below I’ve laid out both of them.

Temporarily disabling them …

In the recent past, Ubuntu used to let users enable/disable applications that were loaded with the desktop startup. But this ‘list’ is now hidden by default. But thanks to a simple trick (I got this one via AskUbuntu), you can easily make them visible and edit as needed.

For that, execute the below four commands, one by one.

mkdir -p ~/.config/autostart

cd ~/.config/autostart

cp /etc/xdg/autostart/*.desktop .

sed -i "s/NoDisplay=true/NoDisplay=false/g" *.desktop

Now, from the top right corner’s menu, click on ‘Startup Applications…’ and it should now show you all the user-related services that are loaded with the desktop.

Update: Starting with Ubuntu 12.10, this menu entry is now removed. But you can open the startup manager by simply searching for ‘startup applications’ on the ‘Dash’.

If you know what you’re doing, then you can remove a lot of these services (by removing the ‘check mark’, don’t click on the ‘Remove’ button!), but if you’re new to Ubuntu, then below are a list of some of the services that you can git rid of safely.

‘Backup-Monitor’ :- If you don’t need the ‘Deja-dup’ (default data backup tool) to schedule backups, then disable it.

‘Bluetooth-Manager’ :- If you don’t use Bluetooth, then disable this too.

‘Chat’ (telepathy indicator service) :- If you don’t use the ‘Telepathy’ chat client, then by disabling this you can free up about 2.7MB of your RAM.

‘Desktop Sharing’ :- If you don’t need remote desktop or desktop sharing features (most users don’t need this) then remove the ‘check-mark’ to disable that too.

‘GPG Password Agent’ :- This is a tool that adds encryption to email clients (has nothing to do with web based email services) and chat programs, if you use them, then keep this one. Otherwise, disable it.

‘Gwibber’ :- This is a microblogging client. If you don’t use it, then disable it.

‘Onboard’ :- This is the on-screen keyboard that comes with Ubuntu. Most won’t be using it, so yes, you can disable this one too.

‘Orca screen reader’ :- As you can see from the name, this is a screen reader application, most can disable this.

‘Personal file Sharing’ :- Unless you’re gonna be sharing files over a network (has nothing to do with applications such as ‘Bittorrent’ or if you use the internet), disable it.

‘Ubuntu One’ : I don’t think anyone would need an introduction to this as it’s the famous Ubuntu’s Cloud computing product. I don’t use this, but even if you don’t use it, it runs a service from the background and it uses 30MB or more of your RAM. If you don’t use it, then please disable it :D.

‘Update notifier’ :- If you don’t need to receive automatic update notifications (as you can execute it manually), then you can disable it as well. But for security reasons, I encourage you to keep it enabled.

‘Zeitgeist-Datahub’ : It’s an activity logger. It logs user data such as your web history, chat data, files opened etc and lets other applications to access that data for improving the user interactions. I just don’t like it for what it does (logging me personal life :P), so if you don’t need it, then disable it.

*Note* If you remove this one however, then Unity desktop will fail to do things like giving you a list of files/folders & applications for your search queries on the ‘Dash’. So …

Completely getting rid of some of them

You won’t be able to remove a lot of services as above with the below method. But, it frees up HDD spaces and ‘cleans’ up the system plus, some can be disabled using this method only (such as the below ‘indicator-messages’) and are not available in the above method.

*. ‘indicator-messages’ :- It’s a small icon on the top bar on your desktop that allows you to access various social apps and their settings (such as Gwibber, Empathy etc).

If you don’t need it, then enter the below command to get rid of it (the second command only removes the ‘indicator’/service that uses ‘telepathy’ not the app itself).

sudo apt-get autoremove indicator-messages

sudo apt-get autoremove telepathy-indicator

*. ‘Deja-dup’: If you don’t use this file backup tool, use the below command to get rid of it.

sudo apt-get autoremove deja-dup

*. ‘Zeitgeist’: As said above, this is a major component in Ubuntu. If you don’t need it, and because it too has few services that occupy my RAM, use the below command to remove it (again, if you do this, then it’ll disable the ability to search on ‘Dash’).

sudo apt-get autoremove zeitgeist-core

*. ‘Ubuntu One’: If you’re sure that you don’t need it, then enter the below command to get rid of it.

User says : ‘No thank you’
Ubuntu One says: ‘You’ll come back!’ ;-)

sudo apt-get autoremove ubuntuone-client python-ubuntuone-control-panel

Specially ‘thanks’ to Ubuntu one, and others, these steps should help you to reduce at least 35-40MB from your memory.

Step 3

Removing temporary packages stored in your HDD

When you install packages in Ubuntu using the Software Center or the ‘apt-get’, ‘Synaptic’ … they all first download these packages and store then in your HDD (caching). As time goes on, this cache can get a lot bigger. Though other than the ‘wasted’ HDD space, it won’t have a big impact on your system’s performance.

However, I think by removing these packages should help to improve the performance of these package managers (including update manager) because they no longer have to deal with (compare, search etc) the long list of applications in the cache.

So from time to time, make sure to run the below command to clean this package cache.

sudo apt-get clean

Step 4:

When you install some packages, they also installs other packages with them (known as ‘dependencies’). However, when you remove those, some of those dependency packages don’t get removed automatically due to many reasons.

So from time to time, you can use the below command to safely get rid of some of those dependency packages that are no longer required.

sudo apt-get autoremove

Step 5

Installing utilities that improve the system performance

*. ‘zRam’: As most know, a ‘Swap’ file is a temporary location in your disk drive (including SSD etc) that’s being used by the OS to save data (temporarily) while loading/unloading programs from the disk drive to RAM (vice versa).

What ‘zRam’ does is, it creates a virtual and a compressed ‘Swap’ file on the RAM itself, so the RAM can now hold more programs and their data. This minimizes the need to use the ‘real Swap’ file on the disk drive, thus increases the performance as HDD or SSD etc are far more slower when compared with RAM.

I honestly haven’t seen huge improvements, but, you can try installing it anyway. If you use Ubuntu 12.10 Quantal Quetzal and 12.04 Precise Pangolin, then simply enter the below command.

sudo apt-get install zram-config

For older versions (11.04 Natty Narwhal & 11.10 Oneiric) use the below commands.

sudo apt-add-repository ppa:shnatsel/zram

sudo apt-get update

sudo apt-get install zramswap-enabler

That should do it.

*. Use ‘BFS’ (task scheduler): Every operating system has a core component called the ‘task scheduler’ which deals with multitasking. The one included in the GNU/Linux is called ‘CFS’, a conservative scheduler.

But ‘BFS’ on the other hand, is especially written for desktop/laptop computers and is a bit ‘aggressive’ one. In simple words, if want your PC to be a bit more ‘responsive’ while multitasking, then ‘BFS’ can help (it is not recommended to be used on environments such as Servers where heavy loads of applications is present).

There won’t be ‘huge’ performance increases (can be sometimes, such as gaming), but it’s worth trying anyway. For installing it in Ubuntu 11.04 to 12.04, use the below commands.

sudo add-apt-repository ppa:chogydan/ppa

sudo apt-get update

sudo apt-get install linux-image-generic-ck linux-headers-generic-ck

Once you install it, it’ll add a new menu into the GRUB boot loader‘s list, so you can switch between the new and the standard Kernel task schedulers that comes with Ubuntu with ease.

Update: For installing ‘BFS’ on Ubuntu 12.10, 13.04 etc, please use the instructions listed on ‘Step 7‘, below.

Step 6

Reducing the ‘Swap’ file usage

If you have like 2GB or more RAM, then you can force Ubuntu to rely on more using the RAM rather than the ‘Swap’ file on the HDD (which improves the performance). I’ve already written a post on that, so please read this post for achieving that.

Update: I have come across another few methods that should come in handy for fine tuning Ubuntu (one in particular), so I decided to update this post. So here it goes.

Step 7

Switch to ‘BFQ’ Disk I/O Scheduler

Just like the above mentioned ‘task scheduler’ that deals with processes, there is another very important utility in every operating system called the ‘disk i/o scheduler’, and it is its job to ‘distribute’ your hard disk’s ‘read/write’ (i/o) bandwidth in a way (as in situations like when the disk is busy while multiple programs trying to access it) so that the performance is kept at its optimal level.

So then, if your current disk i/o scheduler is not properly optimized to handle such situations (say that you are trying to open a memory hungry app while the HDD is busy copying a large file), the end result would be as such that the OS will lose its usual ‘responsiveness’, and thus your programs will open slower than usual, switching between opened apps will take a long time etc.

‘BFQ’ in that sense, is a new disk i/o scheduler that is designed to address such situations. Or in other words, if you are not that happy with the application loading times in Ubuntu when your HDD is ‘busy’, then you should try installing ‘BFQ’, because it is claimed by the developer plus, according to my experiences as well, ‘BFQ’ has the ability to load programs 260-670% faster!.

Opening 'Firefox' while tar archive is being copied - bfq vs deadline

I have written a detailed review. So please go over to this page, and if you don’t need all the details, then just scroll down a bit for finding the instructions for installing it in Ubuntu (this will also install the ‘BFS’ task scheduler as well).

Step 8

Install ‘preload’

‘preload’ is a tool that keeps a track of your mostly used applications & the files that they load into RAM upon their execution. Then based on that data, it tries to predict which app (s) that has the highest probability of being executed by the user, in the near future, and it then loads its data into RAM, before their demanded.

When the accuracy of this prediction is high enough, it should improve the loading times of your favorite applications. If you have 512MB or more RAM, then you can try installing ‘preload’. I’ve also written a detailed review, but if don’t want to read it, then just enter the below command to install it.

sudo apt-get install preload

That’s it. Now reboot the computer & keep using the computer as usual. Once ‘preload’ has gathered enough data, you should see its ‘effect’ :).

Step 9

Defrag your file system

It is the common belief that GNU/Linux file systems are better equipped to handle file fragmentation and that they don’t require any defragmentation. It is true that they have low file fragmentation ratio, but according some experts who have done extensive research, in some situations, the latter claim is simply not true.

'e4defrag' giving a file fragmentation summary

So as an Ubuntu user, if you the ‘Ext4′ file system (default one used in Ubuntu), then you can use a tool called ‘e4defrag’ that lets you easily see whether the file system is fragmented or not and if it is, then you can use it to defrag it. For the instructions, please read this article.

Step 10

Fastening the Shutting down process

Ubuntu has always been shutting down pretty quickly in my experience and over the years it has been getting better and better. However, the 12.10 version has been taking an awful lot time while turning off. But luckily I was able to found a temporary solution, and few have mentioned that it has helped them as well. So I decided to add it here.

You can read this article for the instructions, but please remember that, if you are not experiencing any issues while shutting down, then just ignore this ‘Step’.

Anyway, these are some of the things that came to my mind but if you have suggestions, then please throw in some comments. Again remember, even if you follow these steps, there’s no guarantee that you’ll see big improvements in performance, but they do help!. Good luck.

28 thoughts on “Few Tips to Make Ubuntu Linux run Faster

  1. ScratchPuddin

    Hey thanks for this list, it has helped out a bit already. However I do have a (probably) dumb question.. how do i get into GRUB boot loading menu to set BFS as the task scheduler?

    1. Gayan Post author

      That's the best part. When you install 'BFS' it'll replace your old two menu entries (first and the second entries in GRUB) and when you click on that menu to boot (just as you normally do), then 'BFS' will be used by default, we don't have to do anything.

      You can always use the 'CFS' (default task scheduler in Ubuntu) by clicking on the 'Previous Linux Versions' menu item (usually listed as the third entry).

      The GRUB menu that has a '….. generic-ck' is the one that's included the 'BFS' scheduler and the old menu entry names end with '…. generic'. That's it :).

  2. Alan

    Hi Gayan, If I remember right, you can remove network manager completely and set up the Ethernet card to connect to the router, however if you're not using one, such as if you have wi-fi, then don't try and remove it.

  3. Cason

    Is it possible if you can update this guide instructing noobs how to re-install and add them to “Startup Applications”? I removed Zeitgeist using CLI and deleted it in Startup Application which causing my “most recent used apps/files/folders” not displaying in Dash.

    I reinstalled Zeitgiest but it doesn’t seem to update in Dash. I’m think I have to add it to Startup since I don’t see it in the list anymore.

    1. Gayan Post author

      ‘Cason’, you can reinstall ‘Zeitgeist’ by using the below command.

      sudo apt-get install zeitgeist-datahub zeitgeist-core

      Actually you should be able to install it fully just by using the ‘zeitgeist-datahub’ without having to use ‘zeitgeist-core’, but I forgot to test that one, and am now back at my Windows 8 so ;-) ….

      Also, you don’t need to re-add that startup entry as ‘Zeitgeist’ should be running from your background. Nevertheless, if you want, then you can add the entry by following the below procedure.

      Open the ‘Startup’ application window and click on the ‘Add’ button (if you haven’t really removed the ‘Zeitgeist …’ entry and had only disabled, then of course you can re-enable it) & fill the field using the below ones.

      Name: Zeitgeist Datahub

      Command: zeitgeist-datahub

      Comment: Start the Zeitgeist Datahub for passive loggers

      *Note* The comment field is optional.

      Then save the new entry and reboot your PC and now everything should be back to normal. I have also updated the post saying what would happen if you remove ‘Zeitgeist …’ so thank you for pointing that out too.

    1. Gayan Post author

      Thank you ‘Stan’. I actually just wrote a review about ‘preload’ & added it to this article as well. Thanks for reminding about it :).

  4. Ray

    Great article!

    on a small home server (still needing a desktop UI) I also removed empathy:

    sudo apt-get autoremove empathy

    and evolution-data-server:

    sudo apt-get autoremove evolution-data-server

    which were not used.

  5. gary knott

    Dear Gayan, How does one tell grub (or is it grub2) to not display
    a splash screen while booting, but instead to print on-screen all the stuff
    about what is happening while booting like old-fashioned linux systems used to do?

    And how can I get my “bash terminal program that comes with LXDE on 12.04
    to use “real scroll bars”, and not the very annoying pop-up mini scroll
    controls? (I would apt-get a better terminal window if i knew the
    name of such.)

    1. Gayan Post author

      Hi Gary,

      1. You can temporarily disable the boot-splash by pressing ESC key when it pops up. Or, if you want to disable it permanently (yes, you can re-enable it later), then please refer to the below article.

      http://askubuntu.com/questions/33416/how-do-i-disable-the-boot-splash-screen-and-only-show-kernel-and-boot-text-inst

      2. As for the second question. I have never used LXDE on Ubuntu & I guess that you were referring to ‘Ayatana Scroll-Bars‘. I don’t know if they are used in Lubuntu, so I cannot really answer your question with confidence. But if they are included, then you should be able to remove them using the below command.

      sudo apt-get remove overlay-scrollbar liboverlay-scrollbar

      Then reboot the PC. To revert the changes, use the below command.

      sudo apt-get install overlay-scrollbar liboverlay-scrollbar

      Hope this helped.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>