SYSCTL(8) BSD System Manager's Manual SYSCTL(8)NAMEsysctl - get or set kernel state
SYNOPSISsysctl [-Aan]
sysctl [-n] name ...
sysctl [-n] -w name=value ...
DESCRIPTION
The sysctl utility retrieves kernel state and allows processes with ap-
propriate privilege to set kernel state. The state to be retrieved or
set is described using a ``Management Information Base'' (``MIB'') style
name, described as a dotted set of components.
The following options are available:
-A List all known MIB names including tables. Those with string or
integer values will be printed as with the -a flag; for the table
values, the name of the utility to retrieve them is given.
-a List all the currently available string or integer values.
-n Specify that the printing of the field name should be suppressed
and that only its value should be output. This flag is useful
for setting shell variables. For example, to save the pagesize
in the csh(1) variable psize, use:
set psize=`sysctl -n hw.pagesize`
-w Set a value. In this case, the MIB name must be followed by an
equal sign and the new value to be used. For example, to enable
the forwarding of IP packets, use:
sysctl-w net.inet.ip.forwarding=1
If only the MIB style name is specified, the corresponding information is
displayed.
The information available from sysctl consists of integers, strings, and
tables. The tabular information can only be retrieved by special purpose
programs such as ps, systat, and netstat. The string and integer informa-
tion is summarized below. For a detailed description of these variables
see sysctl(3). The changeable column indicates whether a process with
appropriate privilege can change the value.
Name Type Changeable
hw.byteorder integer no
hw.machine string no
hw.model string no
hw.ncpu integer no
hw.pagesize integer no
hw.physmem integer no
hw.usermem integer no
kern.argmax integer no
kern.autonicetime integer yes
kern.boottime struct no
kern.clockrate struct no
kern.coresfollowlinks integer yes
kern.deadmantimer integer yes
kern.file struct no
kern.hostid integer yes
kern.hostname string yes
kern.job_control integer no
kern.license string yes
kern.license_users integer through kern.license
kern.license_flags integer through kern.license
kern.maxfiles integer yes
kern.maxproc integer yes
kern.maxsymlinks integer yes
kern.maxvnodes integer yes
kern.ngroups integer no
kern.nisdomainname string yes
kern.numvnodes integer no
kern.osrelease string no
kern.osrevision integer no
kern.ostype string no
kern.posix1version integer no
kern.proc struct no
kern.profiling node not applicable
kern.saved_ids integer no
kern.securelevel integer raise only
kern.sysvipc node not applicable
kern.version string no
kern.vnode struct no
machdep.cntlaltdel integer yes
machdep.cntlaltdelcore integer yes
machdep.console_device dev_t no
machdep.parityerrorpanic integer yes
net.inet.ah.stats struct no
net.inet.esp.stats struct no
net.inet.icmp.bmcastecho integer yes
net.inet.icmp.maskrepl integer yes
net.inet.icmp.printfs integer yes
net.inet.icmp.rediraccept integer yes
net.inet.icmp.redirtimeout integer yes
net.inet.icmp.stats struct no
net.inet.icmpv6.forwarding integer yes
net.inet.icmpv6.stats struct no
net.inet.igmp.stats struct no
net.inet.ip.do_rfc1858 integer yes
net.inet.ip.forwarding integer yes
net.inet.ip.forwsrcrt integer yes
net.inet.ip.maxfragpackets integer yes
net.inet.ip.mrstats struct no
net.inet.ip.mrtproto integer yes
net.inet.ip.mrttable struct no
net.inet.ip.redirect integer yes
net.inet.ip.sourcecheck integer yes
net.inet.ip.sourcecheck_logint integer yes
net.inet.ip.stats struct no
net.inet.ip.ttl integer yes
net.inet.ip.viftable struct no
net.inet.ipv6.debuglevel integer yes
net.inet.ipv6.forwarding integer yes
net.inet.ipv6.routersolicit integer yes
net.inet.ipv6.stats struct no
net.inet.ipv6.ttl integer yes
net.inet.tcp.conntimeo integer yes
net.inet.tcp.do_rfc1323 integer yes
net.inet.tcp.ifp_maxseg integer yes
net.inet.tcp.keepcount integer yes
net.inet.tcp.keepidle integer yes
net.inet.tcp.keepinterval integer yes
net.inet.tcp.maxpersistidle integer yes
net.inet.tcp.mssdflt integer yes
net.inet.tcp.pmtu integer yes
net.inet.tcp.pmtu_expire integer yes
net.inet.tcp.pmtu_probe integer yes
net.inet.tcp.recvspace integer yes
net.inet.tcp.sendspace integer yes
net.inet.tcp.stats struct no
net.inet.tcp.syn_bucket_limit integer yes
net.inet.tcp.syn_cache_interval integer yes
net.inet.tcp.syn_cache_limit integer yes
net.inet.tcp.43maxseg integer yes
net.inet.udp.checksum integer yes
net.inet.udp.recvspace integer yes
net.inet.udp.sendmax integer yes
net.inet.udp.stats struct no
net.route.arp.down integer yes
net.route.arp.keep integer yes
net.route.arp.maxtries integer yes
net.route.arp.probe integer yes
net.route.arp.refresh integer yes
net.route.arp.useloopback integer yes
net.route.idletimeout integer yes
net.route.netclone integer yes
net.route.stats struct no
net.socket.maxconn integer yes
net.socket.nmbclusters integer yes
net.socket.sbmax integer yes
net.link_layer.generic.lo.numif integer yes
net.link_layer.generic.pif.numif integer yes
net.link_layer.generic.ppp.numif integer yes
net.link_layer.generic.tun.numif integer yes
user.bc_base_max integer no
user.bc_dim_max integer no
user.bc_scale_max integer no
user.bc_string_max integer no
user.coll_weights_max integer no
user.cs_path string no
user.expr_nest_max integer no
user.line_max integer no
user.posix2_c_bind integer no
user.posix2_c_dev integer no
user.posix2_char_term integer no
user.posix2_fort_dev integer no
user.posix2_fort_run integer no
user.posix2_localedef integer no
user.posix2_sw_dev integer no
user.posix2_upe integer no
user.posix2_version integer no
user.re_dup_max integer no
user.stream_max integer no
user.tzname_max integer no
vfs.generic.maxsyncdelay integer no
vfs.generic.syncdelay integer yes
vm.loadavg struct no
vm.maxdsize integer yes
vm.maxmapentries integer yes
vm.maxssize integer yes
vm.swapreserve integer yes
vm.vmtotal struct no
The sysctl program can get or set debugging variables that have been
identified for its display. This information can be obtained by using
the command:
sysctl debug
In addition, sysctl can extract information about the filesystems that
have been compiled into the running system. This information can be ob-
tained by using the command:
sysctl vfs
By default, only filesystems that are actively being used are listed.
Use of the -A flag lists all the filesystems compiled into the running
kernel.
EXAMPLES
For example, to retrieve the maximum number of processes allowed in the
system, one would use the follow request:
sysctl kern.maxproc
To set the maximum number of processes allowed in the system to 1000, one
would use the follow request:
sysctl-w kern.maxproc=1000
Information about the system clock rate may be obtained with:
sysctl kern.clockrate
Information about the load average history may be obtained with
sysctl vm.loadavg
SEE ALSOgetconf(1), sysctl(3)HISTORY
The sysctl utility first appeared in 4.4BSD.
BSDI BSD/OS May 9, 1995 4