Change swappiness settings

A small guide for a better/faster system performance by making changes to the swappiness file using  terminal command lines.

Ubuntu uses a swap file to extend the amount of available RAM by writing some of it to your hard drive. Most of the hard drives are slow and most modern computers come with more than 1GB ram as standard and Ubuntu is using 60% of the RAM by default. You can check your RAM usage with next terminal command:

        cat /proc/sys/vm/swappiness

Swappiness is a tweakable setting that controls how often the swap file (hard disk) is used, you  can change this setting by using this terminal command :

$ sudo sysctl vm.swappiness=40
vm.swappiness = 40

This setting lasts until reboot or you change it again with another sysctl vm.swappiness invocation. To make this setting take effect on every reboot, edit your /etc/sysctl.conf configuration file.

$ gksudo gedit /etc/sysctl.conf

Find the vm.swappiness line; if none exists, add it.

vm.swappiness = 40


If you have plenty of RAM (2GB or more) you can use a lower value then 40. To use your new settings you must first clear your old ones, to do this use the following command lines in your terminal:

        sudo swapoff -a
        sudo swapon -a

Now reboot your PC/Laptop and enjoyt a faster Ubuntu!!

command not found

$ vm.swapiness=40 

bash: vm.swapiness=40: command not found


Just saying...

looks like Ubuntu 8.10 tweak,

looks like Ubuntu 8.10 tweak, tested it myself on Ubuntu 8.10 now i am running on Jaunty and have the same problem but... It's possible to change the settings in Jaunty and i will post that a.s.a.p. but 2day is sunday....

Yup, there was a small typo,

Yup, there was a small typo, I edited the post and now it all should be clear.
vm.swappiness = 40 is a value in the /etc/sysctl.conf file, so to tweak it U simply edit that file.
Greetz from the nightfly, now in lovely Ukraine

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Ubuntu 10.04 LTS

Ubuntu: For Desktops, Servers, Netbooks and in the cloud

Other Stuff

n00bsonubuntu on TwitterFacebookYoutube, pwnageP3t3's channelFeedburner

Click to watch

Read Article

Who's online

There are currently 0 users and 14 guests online.