sysctl
system administrationLinux
The sysctl command is one of the most frequently used commands in Linux/Unix-like operating systems. sysctl Configure kernel parameters at runtime
Quick Reference
Command Name:
sysctl
Category:
system administration
Platform:
Linux
Basic Usage:
sysctl [options] [arguments]
Common Use Cases
Syntax
sysctl [options] [variable[=value]] [...]
Options
Option | Description |
---|---|
-a, --all |
Display all variables |
-A |
Alias of -a |
--deprecated |
Include deprecated parameters to --all |
-b, --binary |
Print values without new line |
-e, --ignore |
Ignore unknown variables errors |
-N, --names |
Print variable names only |
-n, --values |
Print values only |
-p, --load[=FILE] |
Read values from file |
-q, --quiet |
Do not display variable changes |
--system |
Read settings from all system configuration files |
-r, --pattern PATTERN |
Only apply settings matching pattern |
-w, --write |
Change sysctl setting |
-o |
Doesn't print variable name when printing values |
-d |
Show help instead of setting a variable |
-h, --help |
Display help and exit |
-V, --version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the sysctl
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
Display all kernel parameters
sysctl -a
Display specific kernel parameter
sysctl net.ipv4.ip_forward
Set a kernel parameter temporarily (until reboot)
sysctl -w net.ipv4.ip_forward=1
Load settings from all system configuration files
sysctl --system
Advanced Examples:
Enable IP forwarding for routing
sysctl -w net.ipv4.ip_forward=1
Verify the change
sysctl net.ipv4.ip_forward
Increase maximum open file descriptors
sysctl -w fs.file-max=100000
Check the new value
sysctl fs.file-max