Linuxlab

sysctl in Linux: read and set kernel parameters

Updated July 3, 2026

sysctl reads and changes kernel parameters that live under /proc/sys.

Syntax

sysctl parameter[=value]

Common cases

sysctl vm.swappiness               # read a parameter
cat /proc/sys/vm/swappiness        # the same thing as a file
sudo sysctl -w vm.swappiness=10    # change it until reboot
sysctl -a                          # every parameter at once

How it works: a dot is a slash

A sysctl parameter name is just a path under /proc/sys with the dots turned into slashes: vm.swappiness is the file /proc/sys/vm/swappiness. So you can read a parameter with either cat or sysctl. sysctl -w changes a value, but only until reboot. To make a setting survive a reboot, you write it into /etc/sysctl.conf or a file in /etc/sysctl.d/. In the sandbox, writing kernel parameters is usually blocked, while reading them is fine.

Used in

You need this in the lesson The kernel via /proc. The theory is the chapter The Linux kernel at work.

See also

The /proc filesystem.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.