The commands and files related to the kernel parameters in the linux system are
- command:
sysctl
- File:,
/etc/sysctl.conf
sub-directory,/etc/sysctl.d
normal operation, we put different configurations in thesysctl.d
directory
sysctl command operation
Usage:
sysctl [options] [variable[=value] ...]
Options:
-a, --all 展示所有参数
-A 与-a一样
-X 与-a一样
--deprecated 在列表中包含不推荐使用的参数
-b, --binary 同行打印
-e, --ignore 忽略unknown类型错误
-N, --names 后面加上内核参数名称,检查这个名称是否存在
-n, --values 后面加上内核参数名称,打印名称对应的值
-p, --load[=<file>] 从文件获取值即让文件配置生效
-f 与-p一样
--system 从系统目录读取值
-r, --pattern <expression>
根据表达式选择设置
-q, --quiet 设置值时不打印
-w, --write arg=value arg表示内核参数,value表示设置值。给内核参数临时设置一个值
-o 啥都不是
-x does nothing
-d alias of -h
-h, --help display this help and exit
-V, --version output version information and exit
The above parameters we used only -a/-N/-n/-w/-p
these
-w
parameters to temporary settings, be restored after a system reboot
so we want to be in a permanent configuration to take effect sysctl.conf
setting parameter file, or sysctl.d
add a new parameter file and then use sysctl -p
it permanent.