Debian Codegraph @

man/sysctl.8

raw
1 .\"
2 .\" Copyright (c) 2011-2024 Craig Small <[email protected]>
3 .\" Copyright (c) 2013-2023 Jim Warner <[email protected]>
4 .\" Copyright (c) 2011-2012 Sami Kerola <[email protected]>
5 .\" Copyright (c) 2004-2006 Albert Cahalan
6 .\" Copyright (c) 1999 George Staikos <[email protected]>
7 .\"
8 .\" This program is free software; you can redistribute it and/or modify
9 .\" it under the terms of the GNU General Public License as published by
10 .\" the Free Software Foundation; either version 2 of the License, or
11 .\" (at your option) any later version.
12 .\"
13 .\"
14 .TH SYSCTL 8 2024-07-19 procps-ng
15 .SH NAME
16 sysctl \- configure kernel parameters at runtime
17 .SH SYNOPSIS
18 .B sysctl
19 .RI [ option " .\|.\|.\&]"
20 .IR variable [\c
21 .BI = value\c
22 ] .\|.\|.
23 .P
24 .B sysctl \-p
25 .IR file-or-regexp " .\|.\|."
26 .SH DESCRIPTION
27 .B sysctl
28 is used to modify kernel parameters at runtime. The parameters available
29 are those listed under \fI/proc/sys/\fR. Procfs is required for
30 .B sysctl
31 support in Linux. You can use
32 .B sysctl
33 to both read and write sysctl data.
34 .SH PARAMETERS
35 .TP
36 .I variable
37 The name of a key to read from. An example is kernel.ostype. The '/'
38 separator is also accepted in place of a '.'.
39 .TP
40 .IR variable = value
41 To set a key, use the form
42 .IR variable = value
43 where
44 .I variable
45 is the key and
46 .I value
47 is the value to set it to. If the value contains quotes or characters
48 which are parsed by the shell, you may need to enclose the value in double
49 quotes.
50 .TP
51 \fB\-n\fR, \fB\-\-values\fR
52 Use this option to disable printing of the key name when printing values.
53 .TP
54 \fB\-e\fR, \fB\-\-ignore\fR
55 Use this option to ignore errors about unknown keys.
56 .TP
57 \fB\-N\fR, \fB\-\-names\fR
58 Use this option to only print the names. It may be useful with shells that
59 have programmable completion.
60 .TP
61 \fB\-q\fR, \fB\-\-quiet\fR
62 Use this option to not display the values set to stdout.
63 .TP
64 \fB\-w\fR, \fB\-\-write\fR
65 Force all arguments to be write arguments and print an error if
66 they cannot be parsed this way.
67 .TP
68 \fB\-p\fR[\fIFILE\fR], \fB\-\-load\fR[=\fIFILE\fR]
69 Load in \fBsysctl\fR settings from the file specified or \fI/etc/sysctl.conf\fR
70 if none given. Specifying \- as filename means reading data from standard
71 input. Using this option will mean arguments to
72 .B sysctl
73 are files, which are read in the order they are specified.
74 The file argument may be specified as regular expression.
75 .TP
76 \fB\-a\fR, \fB\-\-all\fR
77 Display all values currently available except deprecated and verboten parameters.
78 .TP
79 \fB\-\-deprecated\fR
80 Include deprecated parameters to
81 .B \-\-all
82 values listing.
83 .TP
84 \fB\-b\fR, \fB\-\-binary\fR
85 Print value without new line.
86 .TP
87 \fB\-\-system\fR
88 Load settings from all system configuration files. See the
89 .B SYSTEM FILE PRECEDENCE
90 section below.
91 .TP
92 \fB\-r\fR, \fB\-\-pattern\fR \fIpattern\fR
93 Only apply settings that match
94 .IR pattern .
95 The
96 .I pattern
97 uses extended regular expression syntax.
98 .TP
99 \fB\-A\fR
100 Alias of \fB\-a\fR
101 .TP
102 \fB\-d\fR
103 Alias of \fB\-h\fR
104 .TP
105 \fB\-f\fR
106 Alias of \fB\-p\fR
107 .TP
108 \fB\-X\fR
109 Alias of \fB\-a\fR
110 .TP
111 \fB\-o\fR
112 Does nothing, exists for BSD compatibility.
113 .TP
114 \fB\-x\fR
115 Does nothing, exists for BSD compatibility.
116 .TP
117 \fB\-h\fR, \fB\-\-help\fR
118 Display help text and exit.
119 .TP
120 \fB\-V\fR, \fB\-\-version\fR
121 Display version information and exit.
122 .SH FILES
123 .TS
124 Li.
125 /proc/sys
126 /etc/sysctl.d/\fR*\fP.conf
127 /run/sysctl.d/\fR*\fP.conf
128 /usr/local/lib/sysctl.d/\fR*\fP.conf
129 /usr/lib/sysctl.d/\fR*\fP.conf
130 /lib/sysctl.d/\fR*\fP.conf
131 /etc/sysctl.conf
132 .TE
133 .SH NOTES
134 .SS System file precedence
135 When using the \fB\-\-system\fR option,
136 .B sysctl
137 will read files from directories in the following list in given
138 order from top to bottom. Once a file of a given filename is loaded, any
139 file of the same name in subsequent directories is ignored.
140 .P
141 .TS
142 Li.
143 /etc/sysctl.d/\fR*\fP.conf
144 /run/sysctl.d/\fR*\fP.conf
145 /usr/local/lib/sysctl.d/\fR*\fP.conf
146 /usr/lib/sysctl.d/\fR*\fP.conf
147 /lib/sysctl.d/\fR*\fP.conf
148 .TE
149 .P
150 All configuration files are sorted in lexicographic order, regardless of the
151 directory they reside in. Configuration files can either be completely
152 replaced (by having a new configuration file with the same name in a
153 directory of higher priority) or partially replaced (by having a configuration
154 file that is ordered later).
155 .P
156 The file \fI/etc/sysctl.conf\fR is read last which means it can replace/override any
157 parameters previously set in files in the listed directories.
158
159 .SS Deprecated parameters
160 The
161 .B base_reachable_time
162 and
163 .B retrans_time
164 are deprecated. The
165 .B sysctl
166 command does not allow changing values of these
167 parameters. Users who insist to use deprecated kernel interfaces should push values
168 to \fB/proc\fR file system by other means. For example:
169 .PP
170 echo 256 > /proc/sys/net/ipv6/neigh/eth0/base_reachable_time
171
172 .SS Verboten parameters
173 Certain kernel parameters should not be read due to side-effects and will be
174 skipped by \fBsysctl\fR using the \fB\-\-all\fR option.
175 .TP
176 .B stat_refresh
177 This parameter returns no value but flushes per-cpu vm statistics.
178
179 .SH EXAMPLES
180 /sbin/sysctl \-a
181 .br
182 /sbin/sysctl \-n kernel.hostname
183 .br
184 /sbin/sysctl \-w kernel.domainname="example.com"
185 .br
186 /sbin/sysctl \-p/etc/sysctl.conf
187 .br
188 /sbin/sysctl \-a \-\-pattern forward
189 .br
190 /sbin/sysctl \-a \-\-pattern forward$
191 .br
192 /sbin/sysctl \-a \-\-pattern 'net.ipv4.conf.(eth|wlan)0.arp'
193 .br
194 /sbin/sysctl \-\-pattern '\[char94]net.ipv6' \-\-system
195 .SH SEE ALSO
196 .BR proc (5),
197 .BR sysctl.conf (5),
198 .BR regex (7)
199 .SH "REPORTING BUGS"
200 Please send bug reports to
201 .MT [email protected]
202 .ME .