We stand with Palestine ✊ Free Palestine 🇵🇸

Why and How to Change Swappiness in Ubuntu

How to Change Swappiness in Ubuntu

After installing any Linux distribution, such as Ubuntu, there are basic things that you need to do: one of them is to change the value of Swappiness. But what is Swappiness, why should you change it, and how do you do it? Your time is precious (isn’t it?), so I will try to make it simple and short.

What Is Swappiness?

Understanding Swappiness in Linux.

Swappiness is a parameter that controls your distro’s tendency to move data & processes out of Random Access Memory (RAM) onto disk (SWAP file or partition). Of course, your favorite distribution does this to free up the RAM space used by the inactive pages (data) by moving it (writing it) to the swap to allow the active programs to get enough RAM.

Why Change Swappiness?

It’s no secret that RAM is much faster than drives (faster even than the fastest solid-state disk), which means that the more intense the Swap, the slower the system and programs. If you understand the above, you will realize that the higher the value of the swappiness, the lower the performance of Linux OS and vice versa (in most cases). So simply the answer is: Improving performance!

How to Change Swappiness in Ubuntu?

You must have decided to adjust the value of Swappiness, but don’t go crazy and make it 0. The default value on Ubuntu is 60, and you can edit it from 0 to 100 (It’s Linux). The recommended value is 10 (recommended by the official site). The reading class is over; it’s time for the practical work class:

  1. Open a terminal window;
  2. Check the swappiness value using the below command line:
cat /proc/sys/vm/swappiness
  1. Permanently change the Swappiness value by editing the configuration file using your favorite text editor (I use nano):
sudo nano /etc/sysctl.conf
  1. Search for vm.swappiness and change its value to 10. If it does not exist, add it to the end of the file as follows:
vm.swappiness=10
  1. Save the changes and restart the system. That’s it.
NovaCustom Laptops

Looking for a high-performance, customizable Linux laptop with open-source firmware?

Affiliate Link (read disclosure)

💬 Did you notice a performance improvement? Tell us in the comments.

  • Share this post
sniper1720

I’ve chosen to keep this blog free of AdSense and automated ads — making LTM one of the rare blogs that do. The only income comes from a handful of carefully selected affiliate links/banners (which, as you know, don’t go far). If you enjoy the blog, consider showing your support via

Every contribution helps!

Join the Discussion!

0 0 votes
Rate This Article
Subscribe
Notify of
guest
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments