1.\" Copyright (c) 1993 The Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)sysctl.8 5.2 (Berkeley) 04/03/93 7.\" 8.Dd "" 9.Dt SYSCTL 8 10.Os 11.Sh NAME 12.Nm sysctl 13.Nd get or set kernel state 14.Sh SYNOPSIS 15.Nm sysctl 16.Op Fl n 17.Ar name ... 18.Nm sysctl 19.Op Fl n 20.Fl w 21.Ar name=value ... 22.Nm sysctl 23.Op Fl n 24.Fl aA 25.Sh DESCRIPTION 26The 27.Nm sysctl 28utility retrieves kernel state and allows processes with 29appropriate privilege to set kernel state. 30The state to be retrieved or set is described using a 31``Management Information Base'' (``MIB'') style name, 32described as a dotted set of components. 33The 34.Fl a 35flag can be used to list all the currently available string or integer values. 36The 37.Fl A 38flag will list all the known MIB names including tables. 39Those with string or integer values will be printed as with the 40.Fl a 41flag; for the table values, 42the name of the utility to retrieve them is given. 43.Pp 44The 45.Fl n 46flag specifies that the printing of the field name should be 47suppressed and that only its value should be output. 48This flag is useful for setting shell variables. 49For example, to save the pagesize in variable psize, use: 50.Bd -literal -offset indent -compact 51set psize=`sysctl -n hw.pagesize` 52.Ed 53.Pp 54If just a MIB style name is given, 55the corresponding value is retrieved. 56If a value is to be set, the 57.Fl w 58flag must be specified and the MIB name followed 59by an equal sign and the new value to be used. 60.Pp 61The information available from 62.Nm sysctl 63consists of integers, strings, and tables. 64The tabular information can only be retrieved by special 65purpose programs such as 66.Nm ps , 67.Nm systat , 68and 69.Nm netstat . 70The string and integer information is detailed below. 71The changeable column indicates whether a process with appropriate 72privilege can change the value. 73.Bl -column kern.posix1versionxx "integerxx" 74.It Sy "Name " " Type " " Changeable" 75.It Pa kern.ostype No " string" No " no" 76.It Pa kern.osrelease No " string" No " no" 77.It Pa kern.version No " string" No " no" 78.It Pa kern.osrevision No " integer" No " no" 79.It Pa kern.posix1version No " integer" No " no" 80.It Pa kern.maxproc No " integer" No " yes" 81.It Pa kern.maxfiles No " integer" No " yes" 82.It Pa kern.argmax No " integer" No " no" 83.It Pa kern.securelevel No " integer" No " raise only" 84.It Pa kern.hostname No " string" No " yes" 85.It Pa kern.hostid No " integer" No " yes" 86.It Pa kern.clockrate No " struct" No " no" 87.It Pa vm.loadavg No " struct" No " no" 88.It Pa hw.machine No " string" No " no" 89.It Pa hw.model No " string" No " no" 90.It Pa hw.ncpu No " integer" No " no" 91.It Pa hw.cpuspeed No " integer" No " no" 92.It Pa hw.physmem No " integer" No " no" 93.It Pa integer.usermem No " integer" No " no" 94.It Pa hw.pagesize No " integer" No " no" 95.El 96.Sh EXAMPLES 97.Pp 98For example, to retrieve the maximum number of processes allowed 99in the system, one would use the follow request: 100.Bd -literal -offset indent -compact 101sysctl kern.maxproc 102.Ed 103.Pp 104To set the maximum number of processes allowed 105in the system to 1000, one would use the follow request: 106.Bd -literal -offset indent -compact 107sysctl -w kern.maxproc=1000 108.Ed 109.Pp 110Information about the system clock rate may be obtained with: 111.Bd -literal -offset indent -compact 112sysctl kern.clockrate 113.Ed 114.Pp 115Information about the load average history may be obtained with 116.Bd -literal -offset indent -compact 117sysctl vm.loadavg 118.Ed 119.Sh FILES 120.Bl -tag -width <vm/vm_param.h> -compact 121.It Pa <sys/sysctl.h> 122definitions for top level identifiers and second level kernel 123and hardware identifiers 124.It Pa <sys/socket.h> 125definitions for second level network identifiers 126.It Pa <vm/vm_param.h> 127definitions for second level virtual memory identifiers 128.El 129.Sh SEE ALSO 130.Xr sysctl 2 131.Sh HISTORY 132.Nm sysctl 133first appeared in 4.4BSD. 134