Linux command
sysctl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show
sysctl -a
Set
sysctl -w [section.tunable]=[value]
Get
sysctl fs.file-nr
Get
sysctl fs.file-max
Apply
sysctl -p
说明
sysctl is used to examine and modify kernel parameters at runtime. Parameters available are listed under /proc/sys/ and can be read or written using this tool. Common categories include kernel. (core kernel settings), net. (networking), vm. (virtual memory), and fs. (filesystem). Changes made with sysctl are temporary unless persisted to configuration files.
参数
- -a, --all
- Display all available variables
- -w, --write
- Write value to variable
- -p, --load _file_
- Load settings from file (default: /etc/sysctl.conf)
- -n, --values
- Print only values, not variable names
- -e, --ignore
- Ignore unknown variables
- -q, --quiet
- Suppress error messages
- --system
- Load settings from all system configuration files
FAQ
What is the sysctl command used for?
sysctl is used to examine and modify kernel parameters at runtime. Parameters available are listed under /proc/sys/ and can be read or written using this tool. Common categories include kernel. (core kernel settings), net. (networking), vm. (virtual memory), and fs. (filesystem). Changes made with sysctl are temporary unless persisted to configuration files.
How do I run a basic sysctl example?
Run `sysctl -a` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --all do in sysctl?
Display all available variables