↑ ↓ select, Enter open, Esc close

Change swappiness at runtime

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
sysctl vm.swappiness=10

Changes how early the kernel moves memory pages to swap. On database and web servers with enough RAM, a value around 10 is common, so active data stays in memory longer. The change takes effect immediately and can be reverted at any time.

Note: To make the value permanent, create a file like /etc/sysctl.d/99-swappiness.conf containing vm.swappiness=10 and load it with sysctl --system.

Also searched as

  • reduce swappiness
  • server swaps too early
  • set vm.swappiness

Related one-liners

All in System and hardware

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.