How to view Linux kernel parameters for currently booted system

There are several ways to view Linux kernel parameters for the currently booted system.

  1. sysctl command: The sysctl command can be used to view and modify kernel parameters. To view all kernel parameters, you can use the following command:
sysctl -a
  1. proc filesystem: The proc 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
  1. sysfs filesystem: The sysfs 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
  1. dmesg command: The dmesg command can be used to view the kernel ring buffer, which contains a log of messages from the kernel. You can use the command dmesg | 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>

Leave a Comment