There are several ways to view Linux kernel parameters for the currently booted system.
sysctl
command: Thesysctl
command can be used to view and modify kernel parameters. To view all kernel parameters, you can use the following command:
sysctl -a
proc
filesystem: Theproc
filesystem contains a wealth of information about the system and the kernel. To view kernel parameters, you can use the following command:
cat /proc/sys/kernel/<parameter_name>
For example, to view the maximum number of open file descriptors, you can use the command:
cat /proc/sys/fs/file-max
sysfs
filesystem: Thesysfs
filesystem is another place where kernel parameters can be viewed. To view kernel parameters, you can use the following command:
cat /sys/kernel/<parameter_name>
For example, to view the maximum number of open file descriptors, you can use the command:
cat /sys/kernel/file-max
dmesg
command: Thedmesg
command can be used to view the kernel ring buffer, which contains a log of messages from the kernel. You can use the commanddmesg | grep kernel
to view kernel related message from the buffer.
The above commands will display the current value of the specified kernel parameter. Note that some parameters can only be viewed and not modified, while others can be modified by writing a new value to the file. If you want to change a parameter, you can use the same commands but with the echo
command to change the value. For example echo new_value > /proc/sys/kernel/<parameter_name>