How to change the swappiness

I am new to Lubuntu here and my computing knowledge is very low, so I will ask you many questions. here is the first of 999
How can I change the swappiness from 60 to 10 in Lubuntu 20.04.

Welcome to the community.

This won’t be a very user-friendly reply sorry, but I’ll provide the general Ubuntu documentation link -

Lubuntu is a flavor of Ubuntu, so we use the same base and most of our changes (outside of a good proportion of desktop configuration which is unique with us using LXQt) is identical to main Ubuntu and other flavors.

Ensure you have a swap partition, and/or swap file active (found in the same document).

The answer to your question is in the “* What is swappiness and how do I change it?*” section, where they do use =10 in example too.

Thank you for the quick response. At ubuntu they recommend to change the swappiness to 10 if you have less than 8GB RAM. My laptop only has 4GB Ram.
At ubuntu they use gedit to implement the change but ditit is a gnome application, it is not better to use a qt application in lxqt. And what qt application is that?

Yes gedit is a GNOME editor, the default editor provided with LXQt is featherpad (LXQt equivalent to gedit) but I’d use vim myself (vim is installed with Lubuntu by default too); use whatever editor you know.

Note: vim is a great editor, but it’s not really user friendly (it has a large learning curve); I learnt vi in the 1980s at university when not all terminals had arrow keys (or before clones of IBM PCs existed and thus could be afforded by universities) so it’s use of letter keys for cursor movement was essential.

Ok than I try first with vim

Be sure to look up how to exit vim first…

There are loads of vids/comics that declare vim to be trap.

“We are programmed to receive
You can check-out any time you like
But you can never leave!”
(Hotel California, The Eagles)

it isn’t working whit vim on ubuntu you must open the right page with copy the next rule in the terminal gedit admin:///etc/sysctl.conf if I change gedit in vim it isn’t work

I would use the following command in a terminal

sudo featherpad /etc/sysctl.conf

The sudo will elevate privileges (needed as you only have READ access to files in /etc/ but is needed to make save changes). featherpad is the editor or command to use, and /etc/sysctl.conf being the file you want featherpad to open.

it is complete diferent than in Ubuntu or linux mint, there you can change it very easy in your own language (in my case it is Dutch) the translation here isn’t 100% all over the gedit i just need to add following command line at the very bottom and save everything: # Verminder de swapneiging
unfortunately in featherpad i don’t know the correct command line and what to do right

I don’t think so. I’d use ctrl+alt+T to open a terminal in Ubuntu, and use the same vim editor (my personal choice). I don’t use any other language other than english, so can’t comment there sorry.

I suspect you’re talking about featherpad which is a pretty new editor & language limitations; in that case it’s age of software (no-one possibly has stepped up to help with translation into Dutch yet).

Mint very much rely on Ubuntu for much of their work; they do make run-time adjustments complicating things (but the benefit of allowing them to use Ubuntu packages), but again it’ll depend on the DE and end-software being used. Cinnamon is a desktop created by Mint, but its editor was just a fork of gedit so they didn’t need to create their own language translations, they just grabbed it as part of the fork, so I don’t think it’s a fair comparison.

You can use gedit too if you wish; it’s use will just cause some GTK+ libs to be loaded into your memory loosing some efficiency, but that’s a personal choice (and cost is more significant should your box have limited RAM).

can you also tell me how to work correctly with vim and which command line(s) to enter to change my swappiness to 10
sorry for all these questions but for someone like me who knows nothing about computers it is impossible to set everything up properly without help

Sorry I only very quickly glanced at the wiki page I posted, and only grep’d my heavily modified primary system.

I’ve now booted a recent QA-test install & there is no vm.swappiness setting to change, so when the wiki says

Search 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:


You cannot find it since it’s not there. You need only add this line to the file for it to take effect. I’d recommend adding it at the bottom, with a few lines saying why it was added, eg.

# added 2020-05-03; chris.g; alter swappiness value
# end 2020-05-03

the first line is a comment (fist character is a “#”) with the date (I use yyyy-mm-dd format usually); who; why. I often end my adds with another comment; allowing me to easy find or correct changes I’ve made should I need to.

My own system has a swap partition that is used, a new (default) install won’t create a swap partition, so you will possibly need to create a swap file. Detail for that is in the “How do I add a swap file?” section of referenced document including how to enable at startup.

On my test system this involved (commands copied from document; with minor changes)

sudo fallocate -l 4g /mnt/swap
sudo chmod 600 /mnt/swap
sudo mkswap /mnt/swap

(i manually added the swap to my file system table (/etc/fstab) because I wanted mine to line up neatly; but it would be the echo .. | sudo tee -a /etc/fstab command in the document, adjusted for my use of ‘swap’ instead of ‘1Gib.swap’ name. I also created a 4gb swap file; you use whatever you feel is appropriate). On reboot I had a 4gb swap file in use.

Thanks for al the help the swappiness=10 , even after a restart of the computer.

It was succeeded with featherpadfpad, your first advice. point 1.1.
just change 1.1.c: gedit admin:///etc/sysctl.conf
to: sudo featherpad /etc/sysctl.conf
The rest is the same

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.