Chapter #15: Manage Kernel Runtime Parameters in Linux
In this article, we explain how to view and modify Linux kernel runtime parameters using sysctl, /proc/sys, and configuration files.

In Chapter 13 (βGRUB and the boot processβ), we explained how to use GRUB to modify the behavior of the system by passing options to the kernel during the boot process.
Similarly, you can use the command line in a running Linux system to alter certain runtime kernel parameters as a one-time modification or permanently by editing a configuration file.
Thus, you can enable or disable kernel parameters on the fly without much difficulty when a required change in the way the system is expected to operate arises.
Introducing the /proc Filesystem
The latest specification of the Filesystem Hierarchy Standard indicates that /proc
represents the default method for handling process and system information, as well as other kernel and memory information.
Particularly, /proc/sys
is where you can find all the information about devices, drivers, and some kernel features.
The actual internal structure of /proc/sys
depends heavily on the kernel being used, but you are likely to find the following directories inside.
In turn, each of them will contain other subdirectories where the values for each parameter category are maintained:
- dev: parameters for specific devices connected to the machine.
- fs: filesystem configuration (quotas and inodes, for example).
- kernel: kernel-specific configuration.
- net: network configuration.
- vm: use of the kernelβs virtual memory.
Viewing and Modifying Kernel Parameters
To modify the kernel runtime parameters, we will use the sysctl
command. The exact number of parameters that can be modified can be viewed with:
sysctl -a | wc -l
If you want to view the complete list of parameters, just do:
sysctl -a
As the output of the above command will consist of a lot of lines, we can use a pipeline followed by less
to inspect it more carefully:
sysctl -a | less
Letβs take a look at the first few lines. Please note that the first characters in each line match the names of the directories inside /proc/sys
:

For example, the highlighted line: