The kernel command line is the text string of parameters that a bootloader hands to the Linux kernel at boot, telling it which root file system to mount, which init program to start, how to configure consoles and which subsystems to enable or tune. In system initialization on Linux, it is the first configuration the kernel reads, long before any configuration file on disk becomes available.
The parameters, also called kernel parameters, are space-separated words or key=value pairs such as root=UUID=..., quiet or systemd.unit=rescue.target. Because they act before user space exists, they are the primary tool for recovery, debugging and hardware workarounds, and a single wrong value can leave a machine unable to boot.
How the kernel command line reaches the kernel
The kernel command line travels from the bootloader to the kernel in memory, not from a file the kernel opens. A bootloader such as GRUB or systemd-boot assembles the string from its configuration, places it in a memory area described by the boot protocol, and jumps to the kernel entry point. On UEFI systems with a unified kernel image, the string can instead be embedded in the image itself and protected by Secure Boot signatures.
Once running, the kernel parses the string in two passes. Early parameters, registered with early_param, are processed before memory management and most drivers start, which is why options such as mem= or earlyprintk work at all. Ordinary parameters are matched against built-in handlers and module parameters later. Anything the kernel does not recognize is forwarded to the init process, either as an argument or as an environment variable.
The running system exposes the exact string in `/proc/cmdline`, which is the authoritative way to confirm what the kernel actually received. The table below summarizes where the string comes from on common setups.
| Boot method | Where the string is defined | How it is changed |
|---|---|---|
| GRUB 2 | GRUB_CMDLINE_LINUX in /etc/default/grub | Regenerate grub.cfg with the distribution tool |
| systemd-boot | options line in loader entry files | Edit the entry or /etc/kernel/cmdline |
| Unified kernel image | Embedded .cmdline section | Rebuild and re-sign the image |
| Kernel built-in | CONFIG_CMDLINE at compile time | Recompile the kernel |
| Device tree | chosen/bootargs node | Edit the device tree or bootloader variables |
Parameter syntax and namespaces
Kernel parameters follow a simple but strict syntax: words are separated by spaces, values are attached with an equals sign, and lists inside a value use commas. Double quotes allow spaces inside a value. A double dash (`–`) ends kernel parsing, and everything after it is passed unchanged to init.
Parameters for drivers compiled into the kernel use a `module.parameter=value` form, for example i915.enable_psr=0. The same setting for a loadable module is normally placed in /etc/modprobe.d, but the dotted form on the command line also works because the module loader reads it. Init systems define their own namespaces, so systemd reads `systemd.`-prefixed options and the initramfs reads `rd.`-prefixed options.
The following table lists widely used parameters and the stage that consumes them.
| Parameter | Consumer | Effect |
|---|---|---|
root= | Kernel or initramfs | Selects the root file system device |
ro / rw | Kernel | Mounts root read-only or read-write initially |
init= | Kernel | Runs a different program as PID 1 |
console= | Kernel | Directs messages to a terminal or serial port |
quiet / loglevel= | Kernel | Controls how many messages appear on screen |
rd.break | initramfs | Stops in a shell before switching root |
systemd.unit= | systemd | Boots into a specific target |
splash | Plymouth | Shows the graphical boot screen |
Kernel command line compared with related boot settings
The kernel command line is one of several configuration layers during boot, and confusing them is a frequent source of settings that seem to be ignored. It acts earliest and is volatile per boot, while sysctl and module configuration apply later from files on disk.
| Mechanism | When it applies | Typical use |
|---|---|---|
| Kernel command line | Before and during kernel startup | Root device, early hardware options, init choice |
| initramfs configuration | Before the real root is mounted | Storage, encryption and network root setup |
| sysctl settings | After user space starts | Runtime tunables under /proc/sys |
| modprobe.d options | When a module loads | Persistent driver parameters |
| systemd target | During service startup | Which group of units to start |
Some tunables exist in both worlds. A setting under /proc/sys can often be given on the command line with the `sysctl.` prefix in recent kernels, which helps when the value must be in force before the sysctl service runs. As a rule, use the command line only for what cannot wait until user space.
Editing kernel parameters safely
There are two ways to change kernel parameters: a temporary edit for a single boot and a persistent change in the bootloader configuration. Temporary edits are made at the boot menu, for example by pressing e on a GRUB entry, appending the parameter and booting. They vanish on the next restart, which makes them the safest way to test a new value.
Persistent changes require editing the bootloader source and regenerating the boot configuration. Distributions differ in the tool: some use update-grub, others grub2-mkconfig, and tools such as grubby or kernelstub edit entries directly. Forgetting the regeneration step is the most common reason a change has no effect.
| Situation | Recommended approach | Reason |
|---|---|---|
| Testing a new value | Temporary boot menu edit | Reverts automatically on reboot |
| Permanent hardware workaround | Bootloader default options | Applies to every installed kernel |
| One kernel version only | Edit that specific entry | Avoids affecting other kernels |
| Signed unified kernel image | Rebuild with new cmdline | Embedded string cannot be edited at boot |
| Fleet of servers | Configuration management | Keeps parameters consistent and audited |
Limitations, risks and common mistakes
The kernel command line has an architecture-dependent length limit, commonly 2,048 bytes on x86 and sometimes less in older bootloaders, so long lists of options may be truncated silently. It is also readable by every user through /proc/cmdline, so it must never contain secrets such as passwords or keys.
- Typos are silently ignored: an unknown parameter is passed to init instead of producing an error.
- Duplicate parameters usually resolve to the last occurrence, which can override intended values.
- Security-sensitive options such as
init=/bin/shor disabling mitigations bypass protections, so bootloader menus should be password-protected on exposed machines. - Copying parameters from forums without understanding them often leaves obsolete workarounds active for years.
- Editing only one entry may leave fallback or newly installed kernels without the fix.
In plain words
When a Linux computer starts, a small program called the bootloader starts the kernel, which is the core of the operating system. Along with it, the bootloader passes a short line of instructions, much like a note attached to a package: where the main disk is, whether to show messages, and which program should start next.
The kernel reads this note before anything else is ready. That is why it is so useful when something is broken, and why a wrong instruction can stop the computer from starting. The key idea is simple: the kernel command line is the very first set of instructions the system follows.
A real-world example
An administrator at a small hosting company forgets the root password on a virtual server running a systemd-based distribution. She opens the serial console, interrupts GRUB, presses e on the default entry and appends rd.break to the line that starts with linux. The machine stops in an initramfs emergency shell before the real root is mounted.
She remounts /sysroot read-write, changes into it with chroot, sets a new password, schedules an SELinux relabel and reboots. Because the parameter was added only for that boot, the next start is completely normal. The whole recovery takes about ten minutes and requires no rescue media and no change to the stored configuration, which is exactly the advantage of a temporary kernel command line edit.