nsysctl is a tool to get or set the FreeBSD kernel state supporting LibXo and a lot of options, this is the manual, furthermore a tutorial is available.
This manual is for nsysctl <= 1.2.1, for the new version Manual nsysctl version 2.
NSYSCTL(8) FreeBSD System Manager's Manual NSYSCTL(8)
NAME
nsysctl - get or set system state
SYNOPSIS
nsysctl [--libxo options [-r tagroot]] [-DdFGgIilmNpqTtWy]
[-V | -v [h [b | o | x]]] [-e sep] [-B bufsize] [-f filename]
name[=value[,value]] ...
nsysctl [--libxo options [-r tagroot]] [-DdFGgIlmNpqTtWy]
[-V | -v [h [b | o | x]]] [-e sep] [-B bufsize] -A | -a | -X
DESCRIPTION
The system maintains a "Management Information Base" ("MIB") where the
objects are properties to tuning the system, the nsysctl utility can get
or set the value of a property.
The output is explicitly indicated by the options, see COMPATIBILITY for
a comparison with sysctl(8).
The following options are available:
--libxo options
Generate output via libxo(3) in a selection of different human
and machine readable formats. See xo_parse_args(3)
-A Equivalent to -a -V -o.
-a Display every object.
-b Print value in binary format.
-B <bufsize>
use a buffer of <bufsize> bytes.
-D Equivalent to -d -F -G -g -l -N -t -v -y.
-d Show description.
-e <sep>
Use <sep> as separator.
-F Display format string.
-f <filename>
Load objects to get or set from <filename>.
-G Show true-flags.
-g Print flags.
-h Try to show values in a human-friendly format.
-I Show internal nodes, only leaves are printed by default.
-i Ignore unknown objects.
-l Display aggregation label.
-m Display internal magical objects.
-N Print name.
-o Show value in hex format until 16 bytes.
-p Display [property-name]: property-value.
-q Avoid to show some warning.
-r <tagroot>
Specify a <tagroot> with libxo.
-T Show only objects that are settable via loader.
-t Print type.
-V Show value, if value is not "showable" hidden the object.
-v Display value.
-W Display only writable objects that are not statistical.
-X Equivalent to -a -V -x.
-x Print value in hex format.
-y Show ID.
EXIT STATUS
The nsysctl utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
To get the hostname:
nsysctl -Nv kern.hostname
To set the hostname:
nsysctl kern.hostname=myBSD
Dump all info about an object:
nsysctl -Dp -e ', ' kern.ostype
Dump all info about an object in xml format:
nsysctl --libxo=xml,pretty -r 'ROOT-NAME' -D kern.ostype
COMPATIBILITY
/sbin/sysctl /usr/local/sbin/nsysctl
% sysctl name=value % nsysctl -Nv name=value
% sysctl name % nsysctl -Nv name
% sysctl -d name % nsysctl -Nd name
% sysctl -e name % nsysctl -Nv -e `=' name
% sysctl -N name % nsysctl -N name
% sysctl -n name % nsysctl -v name
% sysctl -t name % nsysctl -Nt name
% sysctl -a % nsysctl -aNV
% sysctl -aN % nsysctl -aN
% sysctl -an % nsysctl -aV
% sysctl -ad % nsysctl -aNd
% sysctl -at % nsysctl -aNt
% sysctl -ao % nsysctl -aNVo
% sysctl -ax % nsysctl -aNVx
% sysctl -A % nsysctl -AN
% sysctl -X % nsysctl -XN
SEE ALSO
sysctl(3), sysctlmibinfo(3), xo_parse_args(3), sysctlinfo(4), sysctl(8)
HISTORY
The nsysctl utility first appeared in FreeBSD 13.0.
AUTHORS
The nsysctl utility was written by Alfonso Sabato Siciliano
<alf.siciliano@gmail.com>
FreeBSD 13.0-CURRENT September 14, 2019 FreeBSD 13.0-CURRENT