Tune Kernel Parameters with sysctl (vm.swappiness)

sysctl reads and writes live kernel parameters; vm.swappiness controls how eagerly the kernel swaps out memory.

LinuxsysctlmemorytuningMedium risk
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=10

02What 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

RiskMedium risk
Requirementsprocps; the -w change is temporary and resets on reboot — persist it in /etc/sysctl.d/ for permanence.
!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=60

05Sources

  • sysctl(8) - read/write system parameters
    man7.org Linux man-pages · technical · 2026-09-17
    Evidence: 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

06Related solutions