How to display the Linux kernel command line parameters given for the current boot?

In the grub.conf configuration file I can specify command line parameters that the kernel will use, i.e.:

kernel /boot/kernel-3-2-1-gentoo root=/dev/sda1 vga=791

After booting a given kernel, is there a way to display the command line parameters that were passed to the kernel in the first place? I’ve found sysctl,

sysctl --all

but sysctl shows up all possible kernel parameters.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

$ cat /proc/cmdline
root=/dev/xvda xencons=tty console=tty1 console=hvc0 nosep nodevfs ramdisk_size=32768 ip_conntrack.hashsize=8192 nf_conntrack.hashsize=8192 ro  devtmpfs.mount=1 
$

Method 2

The kernel also printks them at the beginning of boot, see:

dmesg | grep "Command line"

Sample output:

[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.4.0-112-generic root=/dev/mapper/vg00-root ro

This can be useful information on the serial if you are hacking stuff and the kernel panics instead of booting 🙂

Related: How do I find the boot parameters used by the running kernel? | Ask Ubuntu


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x