linux每日学习-系统-sysctl(2016.3.11)

sysctl 工具允许用户在运行时修改 Linux 内核参数,支持通过命令行读取和写入 /proc/sys 中列出的参数。本文介绍如何使用 sysctl 修改或查看设置,并解释了其选项和注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

sysctl(8)

-sysctl - configure kernel parameters at runtime

Description
sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/. Procfs is required for sysctl(8) support in Linux. You can use sysctl(8) to both read and write sysctl data


Parameters
variable
The name of a key to read from. An example is kernel.ostype. The '/' separator is also accepted in place of a '.'.

n
Use this option to disable printing of the key name when printing values.
-e
Use this option to ignore errors about unknown keys.
-N
Use this option to only print the names. It may be useful with shells that have programmable completion.
-q
Use this option to not display the values set to stdout.
-w
Use this option when you want to change a sysctl setting. -w   临时改动某个指定参数的值,如
sysctl -w net.ipv4.ip_forward=1
-p
Load in sysctl settings from the file specified or /etc/sysctl.conf if none given. Specifying - as filename means reading data from standard input.  从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载
-a
Display all values currently available.
-A
Same as -a


Notes


Please note that modules loaded after sysctl is run may override the settings (example: sunrpc.* settings are overridden when the sunrpc module is loaded). This may cause some confusion during boot when the settings in sysctl.conf may be overriden. To prevent such a situation, sysctl must be run after the particular module is loaded (e.g., from /etc/rc.d/rc.local or by using the install directive in modprobe.conf)

Files


/proc/sys /etc/sysctl.conf
See Also


sysctl.conf(5), modprobe.conf(5)
Author

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值