← 返回命令列表

Linux command

grub 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Enter GRUB shell

sudo grub

Install GRUB to disk

sudo grub-install /dev/sda

Update GRUB configuration

sudo update-grub

Generate config file

sudo grub-mkconfig -o /boot/grub/grub.cfg

Check GRUB version

grub-install --version

说明

GRUB (GRand Unified Bootloader) is the standard bootloader for Linux systems. It loads the kernel and initrd, presenting a boot menu for system selection. GRUB 2 supports multiple filesystems, LVM, RAID, and encrypted partitions. It provides rescue mode for system recovery and scripting for advanced configurations.

参数

--root-directory _DIR_
Install to alternate root.
--boot-directory _DIR_
Boot directory location.
--target _TARGET_
Target platform.
--recheck
Probe devices again.
--removable
Install for removable media.
--help
Display help information.

FAQ

What is the grub command used for?

GRUB (GRand Unified Bootloader) is the standard bootloader for Linux systems. It loads the kernel and initrd, presenting a boot menu for system selection. GRUB 2 supports multiple filesystems, LVM, RAID, and encrypted partitions. It provides rescue mode for system recovery and scripting for advanced configurations.

How do I run a basic grub example?

Run `sudo grub` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --root-directory _DIR_ do in grub?

Install to alternate root.