commands
sysctl — Read selected runtime kernel parameters
Read an individual non-sensitive kernel parameter; availability and scope depend on the kernel and namespaces. This reference does not authorize writes. Use a fresh private workspace; No production workload is required.
Formal Syntax & Structure
linux syntaxlinux
sysctl -n KEYParameters & Attributes
| Name | Type | Description |
|---|---|---|
| -n | option | Print value without parameter name. |
| KEY | operand | Read-only dotted parameter name, for example kernel.osrelease; do not append =VALUE. |
Return Value
exit status and output
The -n query prints only the value of the named kernel parameter. A missing or unreadable key produces a failure; successful reading does not imply permission to change it.
Working Example
Example Snippetlinux
test -n "$(sysctl -n kernel.osrelease)" && printf 'release reported\n'