While Linux is pretty efficient with a computer's resources out of the box, there are still ways you can make it run leaner and meaner on your desktop. Using a little bit of know-how, a willingness to run a few terminal commands and a mind for efficiency, you can get every last bit of power from your Linux box, or get more life from an older system. Read on for a roundup of ways to slim down and speed up Linux that any level of user can implement.One quick note: Many of these tweaks require altering system files, disabling processes or otherwise changing how your system runs. Whenever you alter a system file, back it up. The easiest way is to open a terminal and create a ".backup" version of it. For instance, to back up the /etc/hosts file, open a terminal and type:
sudo cp /etc/hosts /etc/hosts.backup
More importantly, if you're unsure of anything, don't do it.
Prune your processes
The easiest and safest way to free up memory in any Linux system is to stop unnecessary programs and background processes from running, and then get your system to remember how you like it. Most Linux distributions have a tool in their "System" or "Administration" menus that let you see what's going on and halt things, if necessary—in Ubuntu, there are two of them: System->Preferences->Sessions, and System->Administration->Services.
On every computer I've loaded Linux onto, there are a few startup programs I almost always disable from the "Sessions" menu. I don't sync my phone to my computer and use Thunderbird instead of the built-in Evolution, so the Bluetooth Manager and Evolution Alarm Notifier are first to go. Before touching anything in the "Services" window, consult this ExtremeTech guide for pointers on what is and isn't safe to turn off. As mentioned in the guide, Ubuntu (like most distro GUIs) only sees a few of the many services your computer is running. If you really want to fine-tune your system, you can install the sysv-rc-conf package found in many distros and surgically remove unnecessary background programs — but I'll reiterate that point made above about backing up and making only a few changes at a time.
Install Lighter, Faster Applications
Full-featured, well-rounded programs like Firefox, OpenOffice.org and Amarok are a big part of the growth in Linux users. For computers running tight on memory, however, they can make Linux feel less like the streamlined system it's meant to be. For users who only need the basics, there are lighter-weight alternative applications that take up less memory and move a little swifter.
- Office programs: AbiWord, Gnumeric, KOffice—OpenOffice, like its proprietary adversary, Microsoft Office, has more features, settings and tools than any one user is likely ever going to need. For those who just want to be able to type documents and make basic spreadhseet edits, AbiWord and Gnumeric are a nice compromise between speed and features. KOffice is a bit more full-featured and KDE-oriented, but seems to run faster OpenOffice.
- File browsing: Thunar, PCMan—Both are fast, streamlined file browsers that don't try to offer up all the multimedia extras and graphical niceties that can bog down the default Nautilus (GNOME) and Konquerer (KDE) browsers. The PsychoCats site has a helpful guide for switching from Nautilus to Thunar; KDE users can also install Thunar or look into installing Dolphin from repositories, and any user can check out Google Docs, Zoho or other online office suites.
- Web browsing: Opera, Konquerer—There are extremely light browsers that use far less memory than Firefox (Dillo, Epiphany and the like), but the convenience and ease of use are hardly comparable. Opera, however, offers a small memory savings, and KDE's built-in browser is extensible and noticeably lighter.
Remove extra virtual terminals
Virtual terminals are a good tool to have—they offer a last-ditch escape to command line for a chance to fix things in a crashing system. But many Linux systems come with six of them enabled, which isn't usually necessary. You can usually disable five of them with few consequences. If you're using Gutsy, open a terminal and type in the following commands:
sudo mv tty3 tty3.bak
sudo mv tty4 tty4.bak
... and so on, through the tty6 file. If you're still on Feisty or other Linux distros, you'll likely have to edit the file in /etc/inittab and add a # character in front of the lines ending with tty3, tty4 and the like.
If your system generally has enough memory to handle what you throw at it, your use of swap space should be minimal, but your system doesn't know that. To temporarily lower your swappiness, type the following command into a terminal (replacing "sudo" with "su" in some systems):
sudo sysctl -w vm.swappiness=10
To make that fix permanent, enter the following command (trading "gedit" for "kate" in KDE systems, or "nano" or "vi" if you have neither):
sudo gedit /etc/sysctl.conf
In the file that comes up, look for the line vm.swappiness=x and change the value to 10, or add the line if it doesn't exist.
Get good with the terminal
You've heard us evangelize about the efficiency of terminals before, but it's especially true in Linux. Give your terminal a handy keyboard shortcut, keep a list of basic commands handy, and learn to write bash scripts, create command shortcuts and find anything from one no-nonsense interface.
Five more tips and guides to speeding up your system
- Speed up GNOME menu—A simple but noticable tweak, especially on older computers.
- Speed up OpenOffice—Also applies to Windows and Mac version.
- Speed up Ubuntu Boot and Shutdown Process—This guide applies mainly to Ubuntu 7.04, "Feisty Fawn," and earlier versions.
- Give Ubuntu a speed boost—Note that some of the tweaks in the linked article could, if done improperly, leave a system unbootable, so proceed with caution.
- Change GNOME Menus to Use PCMan File Manager—If you don't want to make a complete PCMan transition, this trick launches the browser from GNOME's top bar menu.
How do you optimise your Linux desktop? Let us know in the comments.
Kevin Purdy, Lifehacker's newest Associate Editor, digs finding optimisation tips. His weekly feature will appear every Saturday on Lifehacker AU.