I try to set swapiness to 0 but it goes back to 10 after a reboot.
cat /proc/sys/vm/swappiness
10
sudo gedit /etc/sysctl.conf
With Spaces around “=”
Add:
vm.swappiness = 0
save, reboot
cat /proc/sys/vm/swappiness
10
I tried a different path/file (sudo gedit /usr/lib/sysctl.d/swap.conf), but same issue, the swapiness value is either not set to 0 or overridden back to 10 by something else.
Not really
sudo echo … > /path/to/file does nothing, because the sudo cmd doesn’t give privilege for the redirection > only for the echo
But you’re right, the > overwrite any existing file.
My personal preference isn’t to use tee, but just sudo vi ... instead and edit the file in place, add a little comment if needed etc. it’s not copy-paste easy, but worth the time to see a previous version and perhaps some hints I left myself earlier.