← Notes

Change the swappiness of your Ubuntu system

Change how frequently Ubuntu uses the swap


December 8, 2020

Tags: swap
ubuntu

You can check the current swappiness value with:

cat /proc/sys/vm/swappiness

To change it for the current session run:

sudo sysctl vm.swappiness=10

A value of 10 means that the swap will be utilized only after the RAM has reached 90% of its capacity.

To change it permanently edit /etc/sysctl.conf:

sudo nano /etc/sysctl.conf

Look for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10

Save the file and reboot.

Extra resources: