Menu Close

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

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newest Most Voted
Inline Feedbacks
View all comments