Difference between revisions of "Sysctl"

From GhostBSD Wiki
Jump to: navigation, search
(Introduction)
Line 4: Line 4:
 
==Introduction==
 
==Introduction==
 
The [https://www.freebsd.org/cgi/man.cgi?query=sysctl&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html sysctl] utility retrieves kernel state and allows processes with appropriate 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.<br/>
 
The [https://www.freebsd.org/cgi/man.cgi?query=sysctl&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html sysctl] utility retrieves kernel state and allows processes with appropriate 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.<br/>
 +
 +
==Usage==
  
 
The information available from sysctl consists of integers, strings, and  opaque types.  The sysctl utility only knows about a couple of opaque    types, and will resort to hexdumps for the rest.  The opaque information  is much more useful if retrieved by special purpose programs such as [https://www.freebsd.org/cgi/man.cgi?query=ps&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports  ps(1)], [https://www.freebsd.org/cgi/man.cgi?query=systat&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports systat(1)], and [https://www.freebsd.org/cgi/man.cgi?query=netstat&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports netstat(1)].
 
The information available from sysctl consists of integers, strings, and  opaque types.  The sysctl utility only knows about a couple of opaque    types, and will resort to hexdumps for the rest.  The opaque information  is much more useful if retrieved by special purpose programs such as [https://www.freebsd.org/cgi/man.cgi?query=ps&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports  ps(1)], [https://www.freebsd.org/cgi/man.cgi?query=systat&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports systat(1)], and [https://www.freebsd.org/cgi/man.cgi?query=netstat&sektion=1&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports netstat(1)].
Line 9: Line 11:
 
Some of the variables which cannot be modified during normal system operation can be initialized via [https://www.freebsd.org/cgi/man.cgi?query=loader&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader(8)] tunables.  This can for example be  done by setting them in [https://www.freebsd.org/cgi/man.cgi?query=loader.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader.conf(5)].  Please refer to [https://www.freebsd.org/cgi/man.cgi?query=loader.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader.conf(5)]  for more information on which tunables are available and how to set them.
 
Some of the variables which cannot be modified during normal system operation can be initialized via [https://www.freebsd.org/cgi/man.cgi?query=loader&sektion=8&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader(8)] tunables.  This can for example be  done by setting them in [https://www.freebsd.org/cgi/man.cgi?query=loader.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader.conf(5)].  Please refer to [https://www.freebsd.org/cgi/man.cgi?query=loader.conf&sektion=5&apropos=0&manpath=FreeBSD+12.1-RELEASE+and+Ports loader.conf(5)]  for more information on which tunables are available and how to set them.
  
==Usage==
+
===Retrieve Kernel Information===
 +
 
 +
 
 +
Use '''sysctl''' plus the following NAME:
  
The following list is only an excerpt.
+
<code>sysctl NAME</code>
  
Use '''sysctl''' plus the following NAME
+
You will get the following examples:
  
 
{|class="wikitable" style="width:96.5%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px"  
 
{|class="wikitable" style="width:96.5%;background:#FFFFFF; border:2px solid #008000;text-align:left;padding: 10px"  

Revision as of 12:13, 26 February 2020

Welcome to Icon Disti GhostBSD.png Sysctl.
Kernel Competence
Sysctl Kldstat Third-party Kernel Modules
Kernel Modules FreeBSD Ports: Kld Kenv
Back to the Icon Disti GhostBSD.pngSystem

Introduction

The sysctl utility retrieves kernel state and allows processes with appropriate 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.

Usage

The information available from sysctl consists of integers, strings, and opaque types. The sysctl utility only knows about a couple of opaque types, and will resort to hexdumps for the rest. The opaque information is much more useful if retrieved by special purpose programs such as ps(1), systat(1), and netstat(1).

Some of the variables which cannot be modified during normal system operation can be initialized via loader(8) tunables. This can for example be done by setting them in loader.conf(5). Please refer to loader.conf(5) for more information on which tunables are available and how to set them.

Retrieve Kernel Information

Use sysctl plus the following NAME:

sysctl NAME

You will get the following examples:

NAME Description
kern.ostype FreeBSD
kern.osrelease 12.1-STABLE
kern.osrevision 199506
kern.osreldate 1201512
You get the same result with the command: uname -U
kern.version FreeBSD 12.1-STABLE GENERIC
kern.hostname slughorn.ghostbsd-pc.home
kern.clockrate { hz = 1000, tick = 1000, profhz = 8128, stathz = 127
kern.boottime Fri Feb 21 18:58:27 2020 (example)
kern.bootfile /boot/kernel/kernel
kern.corefile %N.core
kern.logsigexit 1
security.bsd.suser_enabled 1
security.bsd.see_other_uids 1
security.bsd.unprivileged_proc_debug 1
security.bsd.unprivileged_read_msgbuf 1
vm.loadavg { 0,59 0,52 0,54 }
hw.machine amd64
hw.model AMD Athlon(tm) 64 X2 Dual Core Processor 6000+
hw.ncpu 2
hw.byteorder 1234
hw.physmem 3972182016
hw.usermem 3445424128
hw.machine_arch amd64
hw.realmem 4294967296
user.cs_path /usr/bin:/bin:/usr/sbin:/sbin
Back to Icon Disti GhostBSD.pngHow To