KENV(1)
πΈ KENV(1) πΈ
okay so bestie, this is kenv(1) from the General Commands Manual β the little tool that lets you peek at and poke the kernel environment π
no cap, it's giving very βinside the machineβ energy.
β¨ NAME β¨
kenv β list or modify the kernel environment π«Ά
π¦ SYNOPSIS π¦
kenv [-l | -s] [-hNq]
kenv [-qv] variable[=value]
kenv [-q] -u variable
π DESCRIPTION π
So if you run the kenv utility with no arguments at all? It will list, like, all the variables in the kernel environment. iconic behaviour, honestly β¨
If you hit it with the -l option, then the static environment provided by loader(8) gets listed instead. Similar vibe with -s: that one lists the static environment defined by the kernel config. But heads up, bestie β both -l and -s are dependent on the kernel being configured to preserve early kernel environments. The default kernel configuration does not preserve these environments. so yeah, donβt expect the default setup to have those lil environments saved π
If the -h option is specified, it will limit the report to kernel probe hints. If an optional variable name is specified, kenv will only report that value. If the -N option is specified, kenv will only display variable names and not their values. If the -u option is specified, kenv will delete the given environment variable. And if the environment variable is followed by an optional value, kenv will set the environment variable to this value. periodt π₯
ngl, -u is the βactually deletes the variableβ option β not a drill, bestie π
If the -q option is set, warnings normally printed as a result of being unable to perform the requested operation will be suppressed. very βquiet luxuryβ of it π
If the -v option is set, the variable name will be printed out for the environment variable in addition to the value when kenv is executed with a variable name. so you get the name and the value, cute π
Variables can be added to the kernel environment using the /boot/loader.conf file, or also statically compiled into the kernel using the statement
env filename
in the kernel config file. The file can contain lines of the form
name = value # this is a comment
where whitespace around βnameβ and β=β, and everything after a β#β character, are ignored. Almost any printable character except β=β is acceptable as part of a name. Quotes are optional and necessary only if the value contains whitespace. iykyk π
π EXAMPLES π
Show kernel probe hints variable names and filter for the uart device
$ kenv -h -N | grep uart
hint.uart.0.at
hint.uart.0.flags
hint.uart.0.irq
hint.uart.0.port
hint.uart.1.at
hint.uart.1.irq
hint.uart.1.port
Show the value of a specific variable:
$ kenv hint.uart.1.at
isa
Same as above but adding the name of the variable in the report:
$ kenv -v hint.uart.1.at
hint.uart.1.at="isa"
Try to delete a variable and suppress warnings if any:
$ kenv -q -u hint.uart.1.at
Set the value of the verbose_loading variable
$ kenv verbose_loading="YES"
verbose_loading="YES"
π§ SEE ALSO π§
π HISTORY π
The kenv utility appeared in FreeBSD 4.1.1. a whole lil legend β
mwah π this page is from Debian, dated June 20, 2021, and itβs KENV(1) β bestie, go forth and inspect those kernel variables ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms