Skip to content

Kernel

Commands

sysctl

View and configure kernel parameters at runtime. Kernel parameters are tunable values that can be adjusted during runtime.

Kernel parameters can be delimited with dots or slashes

sysctl kernel.hostname
sysctl kernel/hostname

```sh title="Suppress sysctl -n kernel.hostname

Kernel parameters are set persistently by defining values in **/etc/sysctl.conf** or other .conf files placed in **/etc/sysctl.d/**.
```ini title="/etc/sysctl.conf"
net.ipv4.ip_forward=1

These values are then loaded into memory ad-hoc with:

sysctl -p # --load

The runtime can be manipulated directly from the command-line with a different flag"

sysctl -w net.ipv4.ip_forward=1

Alternatively, values can be echoed to the virtual filesystem exposed at /proc/sys

echo 1 > /proc/sys/net/ipv4/ip_forward

Disable IPv6

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

Alternatively, kernel parameters can be viewed or even edited through the virtual filesystem mounted at /proc/sys

uname

uname       # Display operating system "Linux"
uname -m    # Kernel architecture
uname -r    # Kernel release version
uname -a

Modules

A family of commands exists to manipulate Linux modules, including:

  • Floppy, which can be used safely as a stand-in for any module while learning the commands
  • KVM
  • Wireguard

Display currently loaded modules. Output in three columns:

  1. Module name
  2. Module size (bytes)
  3. Processes, filesystems, or other modules using the module

rmmod

rmmod floppy # (1)
  1. Equivalent to
    modprobe -r floppy