← 返回命令列表

Linux command

kexec 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Load

kexec -l [path/to/kernel] --initrd=[path/to/initrd] --command-line=[arguments]

Example

kexec -l [path/to/kernel] --initrd=[path/to/initrd] --reuse-cmdline

Execute

kexec -e

Unload

kexec -u

说明

kexec allows the system to boot directly into a new kernel without going through the BIOS/UEFI and bootloader. This enables faster reboots and is essential for kdump (kernel crash dumping). The process involves loading a kernel into memory with -l, then executing it with -e. This bypasses hardware initialization, significantly reducing reboot time.

参数

-l, --load _KERNEL_
Load a new kernel into memory
-e, --exec
Execute the currently loaded kernel
-u, --unload
Unload the loaded kernel
--initrd _FILE_
Specify initramfs/initrd image
--command-line _ARGS_
Kernel command line arguments
--reuse-cmdline
Use current kernel's command line
-p, --load-panic
Load kernel for crash dump (kdump)

FAQ

What is the kexec command used for?

kexec allows the system to boot directly into a new kernel without going through the BIOS/UEFI and bootloader. This enables faster reboots and is essential for kdump (kernel crash dumping). The process involves loading a kernel into memory with -l, then executing it with -e. This bypasses hardware initialization, significantly reducing reboot time.

How do I run a basic kexec example?

Run `kexec -l [path/to/kernel] --initrd=[path/to/initrd] --command-line=[arguments]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -l, --load _KERNEL_ do in kexec?

Load a new kernel into memory