sysctl Reload Without Reboot: Apply Kernel Parameters on Linux

Tested on Ubuntu 25.04 (Plucky Puffin)
Package sysctl from procps-ng 4.0.4
sysctl from procps-ng 4.0.4
Applies to Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Fedora
Privilege sudo or root
Man page sysctl(8)
Scope sysctl reads and writes Linux kernel tunables under /proc/sys. Use sysctl -w for temporary changes, drop files in /etc/sysctl.d/, then sysctl -p or sysctl --system to reload without rebooting — except for parameters.
Related guides sysctl command
Linux disable IPv6 properly
Suppress net.ipv6.conf.all.stable_secret warning
Linux commands

sysctl — quick reference

Read values

When to use Command
Read one parameter sysctl net.core.somaxconn
Print only the value (scripts) sysctl -n net.core.somaxconn
List every tunable sysctl -a
Same as -a sysctl --all
Read value from proc path directly cat /proc/sys/net/core/somaxconn

Write temporary (runtime) values

Changes apply immediately but are lost on reboot unless saved in a .conf file.

When to use Command
Set a value until reboot sudo sysctl -w net.core.somaxconn=4096
Write via procfs (same effect) echo 4096 | sudo tee /proc/sys/net/core/somaxconn

Load from config files

When to use Command
Apply one drop-in file sudo sysctl -p /etc/sysctl.d/99-custom.conf
Same as -p (long form) sudo sysctl --load=/etc/sysctl.d/99-custom.conf
Apply all system sysctl directories sudo sysctl --system
Legacy: load /etc/sysctl.conf only sudo sysctl -p
Apply without printing each line sudo sysctl -q -p /etc/sysctl.d/99-custom.conf

Search and scripting

When to use Command
Filter a long list sysctl -a | grep somaxconn
Ignore unknown keys in a file (containers) sudo sysctl -e -p /path/file.conf
Print names only sysctl -N net.ipv4.tcp_fin_timeout
Dry-run: show what would be written sudo sysctl --dry-run -p /etc/sysctl.d/99-custom.conf

sysctl — command syntax

Synopsis from sysctl --help on Ubuntu 25.04 (procps-ng 4.0.4):

text
sysctl [options] [variable[=value] ...]

Options:
  -a, --all            display all variables
  -n, --values         print only values of the given variable(s)
  -p, --load[=<file>]  read values from file
  --system             read values from all system directories
  -w, --write          enable writing a value to variable
  -q, --quiet          do not echo variable set
  -e, --ignore         ignore unknown variables errors
  --dry-run            print keys and values but do not write

Kernel tunables live under /proc/sys/. Dotted names map to paths (net.core.somaxconn/proc/sys/net/core/somaxconn). Drop-in files belong in /etc/sysctl.d/ — avoid editing vendor files under /usr/lib/sysctl.d/ directly; override with a lexically later file in /etc/sysctl.d/.


sysctl — command examples

Essential Read the current value of one parameter

Before changing a tunable, capture what the kernel is using now — you need the exact dotted name.

Run the command:

bash
sysctl net.core.somaxconn

Sample output:

output
net.core.somaxconn = 4096

The same value is visible under procfs:

bash
cat /proc/sys/net/core/somaxconn

Sample output:

output
4096

Use sysctl -n when a script only needs the number with no label.

Essential Temporary change with sysctl -w

Tune a running system for a test or incident response — the value resets at reboot unless you also write a .conf file.

Run the command:

bash
sudo sysctl -w net.core.somaxconn=256

Sample output:

output
net.core.somaxconn = 256

Confirm it took effect:

bash
sysctl net.core.somaxconn

Sample output:

output
net.core.somaxconn = 256

Revert when finished (restore your site's normal value):

bash
sudo sysctl -w net.core.somaxconn=4096
Essential Persistent file in /etc/sysctl.d/ and reload

Make a tunable survive reboot by adding a drop-in file, then load it with sysctl -p.

Create the drop-in (example lab file under /tmp — on a real host use /etc/sysctl.d/):

bash
echo 'net.ipv4.tcp_fin_timeout = 30' | sudo tee /etc/sysctl.d/99-cheatsheet-lab.conf

Reload that file only:

bash
sudo sysctl -p /etc/sysctl.d/99-cheatsheet-lab.conf

Sample output:

output
net.ipv4.tcp_fin_timeout = 30

Verify:

bash
sysctl net.ipv4.tcp_fin_timeout

Sample output:

output
net.ipv4.tcp_fin_timeout = 30

Remove the lab file when done: sudo rm /etc/sysctl.d/99-cheatsheet-lab.conf and run sudo sysctl --system to re-apply vendor defaults.

Common Reload every sysctl drop-in with --system

After editing several files, or when you are unsure which file set a value, reload all system sysctl directories in one pass.

Run the command:

bash
sudo sysctl --system

Sample output (truncated):

text
* Applying /usr/lib/sysctl.d/10-bufferbloat.conf ...
* Applying /usr/lib/sysctl.d/50-default.conf ...
* Applying /etc/sysctl.d/99-cheatsheet-lab.conf ...
net.ipv4.tcp_fin_timeout = 30
...

Check a parameter you care about:

bash
sysctl net.ipv4.tcp_fin_timeout

sysctl --system is what many admins mean by "sysctl reload without reboot" — it reapplies every configured file without restarting the machine.

Common Find which file sets a parameter

When a value surprises you, search config trees before editing blindly.

Run the command:

bash
sudo grep -r 'net.core.somaxconn' /etc/sysctl.conf /etc/sysctl.d/ /usr/lib/sysctl.d/ 2>/dev/null

Sample output:

output
/usr/lib/sysctl.d/50-default.conf:net.core.somaxconn=4096

Override vendor defaults by adding a file in /etc/sysctl.d/ with a later sort order (higher numeric prefix) containing your desired value, then sudo sysctl --system.

Common Undo a runtime-only change

If you used sysctl -w and did not write a file, set the parameter back to the intended production value or reload from disk.

Reload all on-disk settings:

bash
sudo sysctl --system

Then read the parameter again:

bash
sysctl net.core.somaxconn

Sample output:

output
net.core.somaxconn = 4096

Deleting a drop-in line alone does not always restore old runtime values — reload from files or reboot to pick up removals cleanly.

Advanced Parameters that need a reboot

Many network and VM tunables apply live; some memory reservations only take effect during early boot.

Examples that often need a reboot (or boot-time kernel args) even after sysctl -w:

text
vm.nr_hugepages
vm.nr_overcommit_hugepages
kernel.shmmax
kernel.shmall

You can still write them at runtime:

bash
sudo sysctl -w vm.nr_hugepages=128

Sample output:

output
vm.nr_hugepages = 128

If the kernel cannot allocate the pages because memory is already in use, the value may not stick or may break running workloads — plan hugepage changes for a maintenance window and initramfs/boot config when your distro requires it.

Advanced Script-friendly read with -n

Shell scripts often need the raw number for comparisons — -n drops the name = prefix.

Run the command:

bash
CUR=$(sysctl -n net.core.somaxconn)
echo "somaxconn is $CUR"

Sample output:

output
somaxconn is 4096

Pair with sysctl -q -p in automation when you do not want every applied line printed to stdout.


sysctl — when to use / when not

Use sysctl when Use something else when
  • You need to tune kernel runtime parameters exposed under /proc/sys
  • You want persistent settings via /etc/sysctl.d/*.conf plus reload
  • You are adjusting network buffers, TCP behaviour, or VM settings on a running server
  • You need a quick temporary test with sysctl -w
  • The setting is a kernel boot parameter (not in procfs) → kernel command line or bootloader config
  • You are changing hugepages or shared memory limits that must be reserved at boot → plan reboot / initramfs
  • You need per-interface firewall rules → nftables / iptables, not sysctl alone
  • You are tuning a specific application → application config files first
  • You want cgroup or container limits → cgroup v2 / orchestrator settings

sysctl — interview corner

What does sysctl do in Linux?

sysctl is the user-space tool for kernel parameters exposed as files under /proc/sys/. Names use dots (net.ipv4.tcp_fin_timeout); paths use slashes (/proc/sys/net/ipv4/tcp_fin_timeout).

You can read values, write temporary values with -w, and reload .conf files with -p or sysctl --system. There is no long-running sysctl daemon — each command talks to procfs directly.

A strong answer is:

"sysctl reads and writes kernel tunables in /proc/sys. Persistent settings go in /etc/sysctl.d/*.conf; sysctl -p or --system reloads them without reboot for most parameters."

How do you reload sysctl without rebooting?

For most tunables:

  1. Put key = value lines in /etc/sysctl.d/NN-name.conf
  2. Run sudo sysctl -p /etc/sysctl.d/NN-name.conf for one file, or sudo sysctl --system for everything

sysctl -p with no path on Ubuntu often follows the legacy /etc/sysctl.conf symlink — prefer explicit paths or --system.

A strong answer is:

"Edit /etc/sysctl.d/, then sysctl -p on that file or sysctl --system for all drop-ins — no reboot for most network and VM knobs."

Should you edit /etc/sysctl.conf or /etc/sysctl.d/?

Prefer /etc/sysctl.d/*.conf with a numeric prefix (e.g. 99-custom.conf) so:

  • Vendor defaults in /usr/lib/sysctl.d/ stay intact
  • Overrides are ordered and easy to find
  • Multiple teams can add files without one giant sysctl.conf

Override one key from a vendor file by adding a lexically later file in /etc/sysctl.d/ with your value.

A strong answer is:

"I add numbered files under /etc/sysctl.d/ instead of editing sysctl.conf or vendor files — later filenames win."

When does sysctl still require a reboot?

Runtime sysctl -w works for many parameters, but memory layout settings are often fixed after boot — examples include vm.nr_hugepages, kernel.shmmax, and kernel.shmall.

Symptoms: value appears set but behaviour does not change, or workloads fail after hugepage tweaks. Fix: maintenance window, correct drop-in, rebuild initramfs if your distro embeds sysctl at boot, then reboot.

A strong answer is:

"Most sysctl changes apply live, but hugepages and some shared-memory limits need boot-time reservation — I treat those as reboot changes."

What is the relationship between sysctl and /proc/sys?

They are the same knobs. sysctl net.core.somaxconn reads /proc/sys/net/core/somaxconn. Writing with echo VALUE > /proc/sys/... is equivalent to sysctl -w for that key.

sysctl adds file loading (-p, --system), filtering (-a, grep), and safer parsing for scripts.

A strong answer is:

"/proc/sys is the source of truth; sysctl is the CLI to read, write, and bulk-load .conf files against those paths."


Troubleshooting

Symptom Likely cause What to try
Permission denied on write Not root Prefix with sudo
sysctl: cannot stat /proc/sys/... Typo or kernel lacks that tunable sysctl -a | grep keyword; check kernel docs
Value unchanged after sysctl -p Wrong file path or later file overrides grep -r KEY /etc/sysctl.d/ /usr/lib/sysctl.d/
sysctl -p only loads one file Expected — use --system for all sudo sysctl --system
Setting reverts after reboot Only used sysctl -w Add /etc/sysctl.d/*.conf
Setting wrong after removing drop-in Old runtime value still in memory sysctl --system or reboot
Unknown key errors in containers Tunable not available in namespace sysctl -e -p file to ignore missing keys

References

Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security
  • Cloud Computing
  • Kubernetes
  • Linux
  • Ansible (software)