← 返回命令列表

Linux command

grub-editenv 命令

文本

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

常用示例

Example

grub-editenv /boot/grub/grubenv set default=Ubuntu

Example

grub-editenv /boot/grub/grubenv list

Reset

grub-editenv /boot/grub/grubenv unset saved_entry

说明

grub-editenv manages GRUB's environment block (grubenv), which stores persistent variables across boots. The environment file is typically located at /boot/grub/grubenv or /boot/grub2/grubenv. Common variables include saved_entry (the boot entry to use when GRUB_DEFAULT=saved), next_entry (entry for next boot only, used by grub-reboot), and recordfail (set when a boot fails). This tool enables scripted management of boot configuration without regenerating grub.cfg.

参数

list
List all variables in the environment file
set _NAME=VALUE_
Set a variable to a value
unset _NAME_
Remove a variable
create
Create a new empty environment file

FAQ

What is the grub-editenv command used for?

grub-editenv manages GRUB's environment block (grubenv), which stores persistent variables across boots. The environment file is typically located at /boot/grub/grubenv or /boot/grub2/grubenv. Common variables include saved_entry (the boot entry to use when GRUB_DEFAULT=saved), next_entry (entry for next boot only, used by grub-reboot), and recordfail (set when a boot fails). This tool enables scripted management of boot configuration without regenerating grub.cfg.

How do I run a basic grub-editenv example?

Run `grub-editenv /boot/grub/grubenv set default=Ubuntu` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does list do in grub-editenv?

List all variables in the environment file