Tune Kernel Parameters with sysctl (vm.swappiness)
sysctl reads and writes live kernel parameters; vm.swappiness controls how eagerly the kernel swaps out memory.
Run `sysctl vm.swappiness` to read the current value and `sudo sysctl -w vm.swappiness=10` to lower swap aggressiveness until the next reboot.
01Command
Command
$ sysctl vm.swappiness && sudo sysctl -w vm.swappiness=1002What it does
The kernel exposes hundreds of tunables under /proc/sys, and sysctl is the friendly front-end: `-a` dumps everything, and a parameter can be read or written by dotted name. vm.swappiness ranges from 0 (avoid swapping) to 100 (swap aggressively), and the common default is 60. Writes via -w are lost on reboot, so persistent tuning belongs in a file under /etc/sysctl.d/ (e.g. 99-tuning.conf with 'vm.swappiness=10'), applied with `sudo sysctl --system`.
03Risk
!Warning: Changing kernel tunables affects the whole system; wrong values (e.g. vm.swappiness=0) can hurt performance or stability under memory pressure.
04Undo
Undo
$ sudo sysctl -w vm.swappiness=6005Sources
- sysctl(8) - read/write system parametersEvidence: sysctl is used to modify kernel parameters at runtime; -a lists all available parameters, -w writes a value to a parameter.
Last verified: 2026-09-17 · Category: System & Settings