呵呵呵呵呵

萝莉有三好,柔体 轻音 易推倒。女神有三宝,干嘛 呵呵 去洗澡。宅男有三好:Dota 基友 破电脑。


linux使用sysctl命令

linux使用sysctl命令

/sbin/sysctl命令用来查看设置,配置/proc/sys/目录下的内核参数。

The /sbin/sysctl command is used to view, set, and automate kernel settings in the /proc/sys/ directory.

可操作的内容很多,直接运行/sbin/sysctl -a可以查看列表。

 For a quick overview of all settings configurable in the /proc/sys/ directory, type the /sbin/sysctl -a command as root. This creates a large, comprehensive list, a small portion of which looks something like the following:

类似下面这样的数据

net.ipv4.route.min_pmtu = 552
kernel.sysrq = 0
kernel.sem = 250     32000     32     128

For example, the /proc/sys/net/ipv4/route/min_pmtu file is listed as net.ipv4.route.min_pmtu, with the directory slashes replaced by dots and the proc.sys portion assumed.

/proc/sys/net/ipv4/route/min_pmtu目录中的数据,在sysctl -a中显示为net.ipv4.route.min_pmtu的格式。

有二种方法可以写入参数,一是echo 二是sysctl -w

 The sysctl command can be used in place of echo to assign values to writable files in the /proc/sys/ directory. For example, instead of using the command

示例
echo 1 > /proc/sys/kernel/sysrq

use the equivalent sysctl command as follows:

sysctl -w kernel.sysrq="1"
kernel.sysrq = 1

上面的这些配置,在重启后就会丢失,要一直生效,修改/etc/sysctl.conf file.

 While quickly setting single values like this in /proc/sys/ is helpful during testing, this method does not work as well on a production system as special settings within /proc/sys/ are lost when the machine is rebooted. To preserve custom settings, add them to the /etc/sysctl.conf file.
The /etc/sysctl.conf file is installed by the initscripts package to override some kernel default values and therefore only contains a few of the possible parameters. Use the sysctl -a command to list the parameters in the sysctl key format. See the /usr/share/doc/kernel-doc-kernel_version/Documentation/networking/ip-sysctl.txt file for more information on the possible settings.

Each time the system boots, the init program runs the /etc/rc.d/rc.sysinit script. This script contains a command to execute sysctl using /etc/sysctl.conf to determine the values passed to the kernel. Any values added to /etc/sysctl.conf therefore take effect each time the system boots. Note that modules loaded after sysctl has parsed this file might override the settings.

更多内容:

linux ubuntu core dump参数定义
linux为什么没有生成core dump文件的原因
linux ubuntu apt-get 参数 -purge
ubuntu apport 介绍及关闭方法
linux下整理常用的gcc 编译器命令行参数

本文链接地址:http://www.hehehehehe.cn/i/834.html