GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
NSYSCTL(8) FreeBSD System Manager's Manual NSYSCTL(8)

nsysctl
get or set system state

nsysctl [--libxo options [-r tagroot]] [-DdeFGgHIilnOpqTtvWz] [-N | -h [b | o | x]] [-B bufsize] [-s sep] [-f filename] name[=value[,value]] ...

nsysctl [--libxo options [-r tagroot]] [-DdeFGgHIklnOpqSTtvWz] [-N | -Vh [b | o | x]] [-B bufsize] [-s sep] -a

The nsysctl utility can get or set the state of the System at runtime. The System exposes the available parameters as objects of a “Management Information Base” (MIB), nsysctl can explore the MIB, print the properties of an object, get or set its value and show the output in human and machine readable formats.

An object is identified by an Object Identifier (OID), a series of numbers, it is possible to replace a number with a string to obtain an object name, e.g., [1.1] → “kern.ostype”, nsysctl can receive in input one or more name, eventually with a new value, or -a for all objects.

nsysctl requires the sysctlinfo(4) interface. To load the required kernel module at boot time, place the following line in loader.conf(5):

sysctlinfo_load="YES"

The following options are available:

options
Generate output via libxo(3) in a selection of different human and machine readable formats, see xo_parse_args(3).
Equivalent to -a -o, obsolete.
Display all objects.
Print value in binary format.
<bufsize>
use a buffer of <bufsize> bytes.
Equivalent to -d -F -G -H -l -O -t.
Show description.
Use “=” as separator.
Display format string.
<filename>
Load objects from <filename>.
Show true flags.
Print flags.
Show the object handler status.
Try to show values in a human-friendly format.
Show internal nodes, only leaves are printed by default.
Ignore unknown objects.
Show object with SKIP flag with -a.
Print aggregation label.
Alias for -S.
Hide value.
Hide name.
Display OID.
Show value in hex format until 16 bytes.
Display [ “PROPERTY-NAME” ]: “property-value”.
Avoid to show some warning.
<tagroot>
Specify a <tagroot> with libxo.
Display also the “sysctl.*” subtree with -a.
<sep>
Use <sep> as separator.
Show only settable objects via loader.
Print type.
By default -a hides an object without a value, this option disable this feature.
nsysctl version.
Display only writable objects that are not statistical.
Equivalent to -a -x, obsolete.
Print value in hex format.
Alias for -O.
Toggle numeric or boolean value, if the value is 0 becomes 1, if it is not 0 becomes 0, if the value is an array only the first index takes effect.

The nsysctl utility exits 0 on success, and >0 if an error occurs.

To get an object value:

nsysctl kern.hostname

To set an object value:

nsysctl kern.hostname=myBSD

Print object info:

nsysctl -pD kern.ostype

Print object info in xml:

nsysctl --libxo=xml,pretty -D kern.ostype

sysctl(8) prints internal and SKIP nodes with -aN, -ad and -at, only leaves avoiding SKIP nodes otherwise, to reproduce with nsysctl:
/sbin/sysctl             /usr/local/sbin/nsysctl
% sysctl -aN             % nsysctl -aNIk
% sysctl -ad             % nsysctl -adIk
% sysctl -at             % nsysctl -atIk

sysctl(3), sysctlmibinfo2(3), xo_parse_args(3), sysctlinfo(4), sysctl(8)

The nsysctl utility first appeared in FreeBSD 13.0.

nsysctl was written by Alfonso Sabato Siciliano <alf.siciliano@gmail.com>.
January 2, 2022 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 8 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.