brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: sysctl -w tries a linux kernel setting, a file in sysctl.d keeps it

Linux
~/tips/tip-linux-sysctl-write-persist

sudo sysctl -w vm.swappiness=10

Changes a kernel setting at once and keeps it across reboots with one small file.

I test a kernel setting live first and only write the file once it does what I want.

sudo sysctl -w vm.swappiness=10
echo 'vm.swappiness = 10' | sudo tee /etc/sysctl.d/99-local.conf
sudo sysctl --system

sysctl -w changes the value immediately and loses it at reboot. A .conf file in /etc/sysctl.d/ is read at boot, and sysctl --system loads every such file now so you can check the file is valid without rebooting. A higher number in the filename wins when two files set the same key. Read the current value with sysctl vm.swappiness.

Further reading: sysctl manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link