Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
SYSCTL(8)		  BSD System Manager's Manual		     SYSCTL(8)

     sysctl -- get or set kernel state

     sysctl [-bdn] name	...
     sysctl [-bn] -w name=value	...
     sysctl [-bdn] -aAX

     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 the currently available string or	integer	values.

     -A	     List all the known	MIB names including opaques.  Those with
	     string or integer values will be printed as with the -a flag; for
	     the opaque	values,	information about the format and the length is
	     printed in	addition the first few bytes is	dumped in hex.

     -X	     Same as -A	except the entire value	of opaque variables is hex-

     -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	variable psize,	use:
		   set psize=`sysctl -n	hw.pagesize`

     -b	     Force the value of	the variable(s)	to be output in	raw, binary
	     format.  No names are printed and no terminating newlines are
	     output.  This is mostly useful with a single variable.

     -d	     Display the description rather than the value of the requested

     -w	name=value ...
	     Set the MIB name to the new value.	 If just a MIB style name is
	     given, the	corresponding value is retrieved.

     The information available from sysctl consists of integers, strings, and
     opaques.  Sysctl only knows about a couple	of opaque types, and will re-
     sort to hexdumps for the rest.  The opaque	information is much more use-
     ful if retrieved by special purpose programs such as ps, systat, and

     The string	and integer information	is summarized below.  For a detailed
     description of these variable see sysctl(3).

     The changeable column indicates whether a process with appropriate	privi-
     lege can change the value.

     Name			     Type	   Changeable
     kern.ostype		     string	   no
     kern.osrelease		     string	   no
     kern.osrevision		     integer	   no
     kern.version		     string	   no
     kern.maxvnodes		     integer	   yes
     kern.maxproc		     integer	   no
     kern.maxprocperuid		     integer	   yes
     kern.maxfiles		     integer	   yes
     kern.maxfilesperproc	     integer	   yes
     kern.argmax		     integer	   no
     kern.securelevel		     integer	   raise only
     kern.hostname		     string	   yes
     kern.hostid		     integer	   yes
     kern.clockrate		     struct	   no
     kern.posix1version		     integer	   no
     kern.ngroups		     integer	   no
     kern.job_control		     integer	   no
     kern.saved_ids		     integer	   no
     kern.boottime		     struct	   no
     kern.domainname		     string	   yes
     kern.update		     integer	   yes
     kern.osreldate		     string	   no
     kern.bootfile		     string	   yes
     kern.corefile		     string	   yes
     kern.logsigexit		     integer	   yes
     vm.loadavg			     struct	   no
     hw.machine			     string	   no
     hw.model			     string	   no
     hw.ncpu			     integer	   no
     hw.byteorder		     integer	   no
     hw.physmem			     integer	   no
     hw.usermem			     integer	   no
     hw.pagesize		     integer	   no
     hw.floatingpoint		     integer	   no
     hw.machine_arch		     string	   no
     machdep.console_device	     dev_t	   no
     machdep.adjkerntz		     integer	   yes
     machdep.disable_rtc_set	     integer	   yes
     user.cs_path		     string	   no
     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.expr_nest_max		     integer	   no
     user.line_max		     integer	   no
     user.re_dup_max		     integer	   no
     user.posix2_version	     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.stream_max		     integer	   no
     user.tzname_max		     integer	   no

     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 per	uid to 1000, one would
     use the follow request:
	   sysctl -w kern.maxprocperuid=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

     More variables than these exist, and the best and likely only place to
     search for	their deeper meaning is	undoubtedly the	source where they are

     <sys/sysctl.h>	   definitions for top level identifiers, second level
			   kernel and hardware identifiers, and	user level
     <sys/socket.h>	   definitions for second level	network	identifiers
     <sys/gmon.h>	   definitions for third level profiling identifiers
     <vm/vm_param.h>	   definitions for second level	virtual	memory identi-
     <netinet/in.h>	   definitions for third level Internet	identifiers
			   and fourth level IP identifiers
     <netinet/icmp_var.h>  definitions for fourth level	ICMP identifiers
     <netinet/udp_var.h>   definitions for fourth level	UDP identifiers


     Sysctl presently exploits an undocumented interface to the	kernel sysctl
     facility to traverse the sysctl tree and to retrieve format and name in-
     formation.	 This correct interface	is being thought about for the time

     Sysctl first appeared in 4.4BSD.

     In	FreeBSD	2.2, sysctl was	significantly remodeled.

BSD			      September	23, 1994			   BSD


Want to link to this manual page? Use this URL:

home | help