How to create persistent sysctl configuration

Create persistent sysctl configuration using standard system utilities.

I will modify swappiness setting to decrease its aggressiveness.

Inspect default swappiness value.

$ sudo sysctl --all --pattern swappiness
vm.swappiness = 60

Temporarily decrease swappiness value.

$ sudo sysctl --write vm.swappiness=50
vm.swappiness = 50

Create configuration file to persistently decrease swappiness value.

$ echo "vm.swappiness = 40" | sudo tee /etc/sysctl.d/90-swappiness.conf
vm.swappiness = 40

Load configuration stored in specific file.

$ sudo sysctl --load /etc/sysctl.d/90-swappiness.conf
vm.swappiness = 40

Load system wide configuration.

$ sudo sysctl --system
* Applying /etc/sysctl.d/90-swappiness.conf ...
vm.swappiness = 40
* Applying /etc/sysctl.d/99-sysctl.conf ...
* Applying /etc/sysctl.d/protect-links.conf ...
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.conf ...

Additional information