Managing Kernel Parameters at Runtime
You can adjust some kernel settings in the running kernel through the virtual file system.
Some virtual files under /proc, and especially under
/proc/sys, are writable. You can adjust settings in the running
kernel through these files. For example, to change the hostname, you can revise the
/proc/sys/kernel/hostname file as follows:
echo www.mydomain.com | sudo tee /proc/sys/kernel/hostname
Other files take binary or Boolean values, such as the setting of IP forwarding, which is
defined in /proc/sys/net/ipv4/ip_forward:
cat /proc/sys/net/ipv4/ip_forward
0
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
cat /proc/sys/net/ipv4/ip_forward
1
Use the sysctl command to view or change values under the
/proc/sys directory.
Even root can't bypass the file access permissions of virtual file
entries under /proc. If you change the value of a read-only entry
such as /proc/partitions, no kernel code exists to service the
write() system call.
For more information, see the sysctl(8) and
sysctl.d(5) manual pages.
Listing Configurable Kernel Parameters and Values
Use the sysctl command to browse kernel system parameters that are
defined in the /proc/sys virtual file system. The following
methods of viewing kernel parameters and their values by using the
sysctl command are available:
Updating Kernel Parameters
Use the sysctl command to update kernel system parameters that are
defined in the /proc/sys virtual file system.