We stand with Palestine ❤️ Free Palestine 🇵🇸

No to genocide in Gaza. No to the killing of civilians. No to targeting hospitals and schools. No to deception and double standards.

Why & 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.
Made with Gimp & Inkscape

{tocify} $title={Table of Contents}

What is Swappiness?

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.
Made with Gimp & Inkscape

Why to 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 :
  • Open a terminal window;
  • Check the swappiness value using the below command line:
cat /proc/sys/vm/swappiness{codeBox}
  • Permanently change the Swappiness value by editing the configuration file using your favorite text editor (I use nano):

sudo nano /etc/sysctl.conf{codeBox}

  • 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: 
  • Save the changes and restart the system. That's it.

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

If you find Linux-Tech&More helpful, consider supporting it on Patreon or Liberapay. For more supporting options contact me.{alertIdea}
Djalel Oukid

Science teacher, PhD student, Master degree in Microbial biotechnology , Microbiologist, designer, video editor, podcaster & blogger. linkedin portfolio github

Comments are welcomed and encouraged on this blog. Spam, abusive and off-topics comments will be deleted. Please read our Comments policy before commenting.

Post a Comment (0)
Previous Post Next Post
Blackview BV9900 Pro Thermal Camera Mobile Phone Helio P90 Octa Core 8GB+128GB IP68 Rugged Smartphone 48MP Quad Rear Camera