How to view Linux kernel parameters for currently booted system

How do I display or view Linux kernel parameters for currently running/booted kernel? How can I see Linux kernel command line parameters?

To display the Linux kernel command line parameters given for the current booted system use any one of the following Linux commands:
sysctl -a
sysctl -a | more
## use the grep command/egrep command to filter out data ##
sysctl -a | grep 'something'
cat /proc/cmdline

How to view Linux kernel parameters using /proc/cmdline

On Linux, one can use a boot manager such as lilo or grub. One can pass arguments or parameters to the Linux kernel at boot time. Often you need to configure grub. All such parameters stored in /proc/cmdline file. To display/view current kernel parameters use the cat command:
cat /proc/cmdline
Sample outputs:

BOOT_IMAGE=/boot/vmlinuz-4.15.0-42-generic root=/dev/sda ro console=tty0 console=ttyS0,19200n8 splash

The above entry from /proc/cmdline file shows the parameters passed to the kernel at the time it is started. I booted my Linux server using /boot/vmlinuz-4.15.0-42-generic kernel image. My hard disk named /dev/sda act as root device to find /boot/vmlinuz-4.15.0-42-generic. Further, I configured serial console access via tty0/ttyS0 and speed set to 19200n8.

See Linux kernel parameters

A freshly booted Linux system can use the following command for the same purpose:
dmesg | grep "Command line"
Sample outputs:

[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.8 root=UUID=2381eff1-9677-4a04-9faa-323247ec2f83 ro quiet splash vt.handoff=1

How to display Linux kernel parameters or arguments using the sysctl

Sometimes you need to set up or update your Linux kernel parameters. The default values for particular kernel parameters on Linux may not be sufficient for running software. Often Linux kernel tunned using the sysctl command.

How to see all kernel parameters

Run the following sysctl command:
sudo sysctl -a
Use the grep command or more command as pager/filter for sysctl:
sudo sysctl -a | more
sudo sysctl -a | less
sudo sysctl -a | grep 'foo'
sudo sysctl -a | grep net.ipv4.ip_forward

How to modify Linux kernel parameters

Edit the /etc/sysctl.conf file or other files in /etc/sysctl.d/ directory. For example, use a text editor such as nano command/vim command:
$ sudo vi /etc/sysctl.d/my-security.conf
Append the following settings:

## Reboot the machine soon after a kernel panic
## Addresses of mmap base, heap, stack and VDSO page are randomized
## Ignore bad ICMP errors

Save and close the file in vim. Finally, run the following command load in sysctl settings:
$ sudo sysctl -p


This page explained how to check what are the current Linux kernel parameter settings using the sysctl command and /proc/cmdline file. For more info see:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • nmorrison Aug 6, 2020 @ 12:41

    You have a Type on the text for editing the sysctl conf file:
    sudo vi /etc//etc/sysctl.conf.d/my-security.conf
    of course would be :
    sudo vi /etc/sysctl.conf.d/my-security.conf;

    For those who are new and are copy & paste admins, would struggle. When Teaching others about Linux , Your Site is the highest safe Site for reference material. Keep up the good work.

    • 🐧 Vivek Gite Aug 6, 2020 @ 18:02

      Thanks for the heads up. The page has been updated.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum