Where to start First steps track · 15 stages
Linux Labs

sysctl — kernel parameters at runtime

cheat sheet · Ubuntu 24.04 · procps 4.0 https://lab.dimsanych.ru/en/wiki/sysctl/

Cheat sheet

  • sysctl vm.swappiness read a parameter
  • sysctl -n vm.swappiness the value only
  • sudo sysctl -w vm.swappiness=10 until reboot
  • echo 'vm.swappiness = 10' \
  • | sudo tee /etc/sysctl.d/90-swappiness.conf permanently
  • sudo sysctl --system apply all files
  • sudo sysctl -p /etc/sysctl.d/90-swappiness.conf one file
  • sysctl -a 2>/dev/null | grep forward find a parameter

Options

Common parameters:

Parameter What for
vm.swappiness eagerness to swap (60 by default)
net.ipv4.ip_forward packet forwarding: router, NAT, containers
fs.nr_open ceiling of the per-process open files limit
fs.file-max open files for the whole system
fs.inotify.max_user_watches inotify watches (editors, tail -f)
kernel.pid_max the largest PID (4194304 on Ubuntu)
kernel.dmesg_restrict 1 — dmesg for root only
kernel.hung_task_timeout_secs after how many seconds in D the kernel reports a hung task
net.core.somaxconn connection queue of a listening socket

The command's own options are in the table below.

Loading…