This post has already been read 7237 times!

GRUB's Command Line Interface (CLI) is one of GRUB's most useful and powerful features. GRUB is actually a miniature operating system in its own right and it can take a rich variety of commands and provide useful feedback to the user. GRUB's CLI Mode is one thing that sets GRUB head and shoulders above all other boot loaders or boot managers.

Keyboard Shortcuts
'ctrl' + 'alt' + 'del' reboot immediately
'c' (from the GRUB menu) = change into CLI mode
'tab' try to guess what the user is trying to type and autocomplete the word
- works in CLI mode or edit mode - extremely useful
'tab','tab' try to guess what the user is trying to type and offer a list of possibilities - works in CLI mode or edit mode - extremely useful
'esc' (from CLI or edit mode) =  change to menu mode (main menu)
down arrow (in menu) = move the cursor down a line
up arrow (in menu) = move the cursor up a line
'e' (from the GRUB menu) = enter edit mode (edit the selected entry)
left or right arrow (in edit mode) = move the cursor left or right - to select what to edit
'ctrl' + 'x' (from edit mode) = boot the selected entry
'ctrl' + 'c' (from edit mode) = switch to CLI mode
'Print Screen SysRq' make the BIOS beep



915resolution acpi
background_image badram blocklist boot
cat chainloader clear cmp
configfile cpuid crc
date drivemap dump
echo efiemu_loadcore efiemu_prepare efiemu_unload
exit export
false functional_test

gettext gptsync
halt handler hashsum

hdparm hello
help hexdump
initrd initrd16 insmod
keystatus kfreebsd kfreebsd_loadenv kfreedsb_module_elf
kfreebsd_module kopenbsd knetbsd
linux linux16 list_env load_env
loadfont loopback ls lsfonts
lsmmap lspci lsmod
md5sum module multiboot multiboot2
normal normal_exit
parser.grub parser.rescue parttool password
password_pbkdf2  play probe pxe_unload
read read_byte read_dword reader.normal
reader.rescue reboot root rmmod
save_env search serial set
setpci sha256sum sha512sum
sleep source
terminal_output terminal_input terminfo

test true
unset usb
vbeinfo vbetest videotest
write_byte write_dword write_word
xnu_devprop_load xnu_kernel xnu_kernel164 xnu_kext
xnu_kextdir xnu_mkext xnu_ramdisk xnu_resume
xnu_splash xnu_uuid
zfs-bootfs zfsinfo

Usage: 915resolution
Intel VBE editor

-h, --help display this help and exit
-u, --usage display this usage and exit

You probably need to insert the 915resolution module before you can use 915resolution, see insmod.

Useage: acpi [-1 | -2]  [ --exclude=table1,table2|--load-only=table1,table2] filename1 [filename2] [...]
Load host acpi tables and tables specified by arguements

-x,  --exclude Don't load host tables specified by comma separated list
-n, --load-only Load only tables specified by comma separated list
-1, --v1 Expose v1 tables
-2, --v2 Expose v2 and v3 tables
-o, --oemid Set OEMID of RSDP, XSDT and RSDT
-t, --oemtable Set OEMTABLE ID of RSDP, XSDT and RSDT
-r, --oemtablerev Set OEMTABLE revision of RSDP, XSDT and RSDT
-c, --oemtablecreator Set creator feild of RSDP, XSDT and RSDT
-d, --oemtablecreatorrev Set creator revision of RSDP, XSDT and RSDT
-e, --no-ebda Don't update EBDA. May fix failures or hangs on some BIOSes, but makes it ineffective with OS not receiving RSDP from GRUB
-h, --help Display this help and exit
-u, --usage Display the usage of this command and exit

ACPI is an acronym for 'Advanced Configuration and Power  Interface',  ACPI - Wikipedia link

- Load a background image for the active terminal in one of the following formats : [gfxterm]

  •  [tga] : 24 or 32 bits, RLE or uncompressed.
  •  [jpeg] : (probably only supports DCT-Integer-8bit, 1x1)
  •  [png] : 8-bit depth RGB or RGBA (i.e 3*8=24 bits of 4*8=32bits), Uncompressed or "Deflated", Unfiltered, Non-interlaced.

For example, if your background images are in /boot/grub,

grub> background_image /boot/grub/<tab>

(take a look around in /boot/grub for splashimages by pressing your tab key)

grub> background_image /boot/grub/Windbuchencom.tga

type the first three or so letters of the splashimage you want to load and press 'tab', then press 'enter'.     . . .  be prepared to wait a minute before your splashimage will appear.

For some types of image files we may need to insert a module to enable GRUB to use a particular file format before loading the file. For example, we need to load the jpeg module before loading a .jpg image. See the insmod command.
For image files larger than the default 648x480 we would also probably want to check what screen resolutions we can use first with vbeinfo and set the screen resolution with the set  command. GRUB might only display the top right-hand corner of the image if the image file is too large for the display settings.
It's possible to look at images located anywhere in the file system.

To get rid of a background image and have an empty background so you can see your text properly,
just type the background_image command without any arguments,

grub> background_image

your background image will disappear!

For more on background images, see: Splashimages for GRUB2

blocklist FILE
- find a file's physical location on a disk (sectors)

grub> blocklist (hd0,3)/boot/grub/stage2

This command is for finding out the physical location of a file on a disk, in sectors.

A blocklist is useful for describing the physical location of code or data on a disk, especially when this code may be located in 'raw' areas of the disk, not addressed by any file system.

A simple example of a blocklist would be: (hd0)0+1 , that would indicate the beginning of sector 0 (zero), and the space following it for 1 (one) sector.
Very often that's shortened to '(hd0)+1', and the zero in implied. However, when you want to specify a number of sectors that doesn't begin at the start of a device or partition, you need to tell GRUB what sector to start looking at, and the number of sectors following it that you want to refer to.

Blocklist format is already explained pretty well in the GNU GRUB (Legacy) Manual, 13.3.1 blocklist  - GNU GRUB  Manual 0.97.

Usage: badram ADDR1,MASK1[ADDR2,MASK2[,...]]
declare memory regions as bad ram

- Actually boot the specified operating system
(You should specify the kernel and module first, then issue the boot command last).
This command is implicit (implied) at the end of grub.cfg menu entries.

- Load an openbsd kernel.

cat  FILE
- Show the contents of a file.
FILE can be an absolute filename or a blocklist

example 1

grub> cat 279192+237

Where: 279192+237 was the location of a file previously determined with the blocklist command.
(This one is a stupid example because it just makes a lot of text scroll up the screen, too fast to read, but it demonstrates one way to use the blocklist command. I'll think of a better example later).

example 2

grub> cat /etc/fstab

The text from your /etc/fstab file should appear should be displayed after you enter this command.

example 3

grub> cat (hd0,3)/etc/lsb-release
DISTRIB_DESCRIPZTION="Ubuntu jaunty (development branch)"

This is a useful command for those of us who have a lot of different operating systems. When you think you remember which partition contains the operating system you want to boot, you can query it with this command to confirm your opinion.
It would be faster to use the 'search' command if you know your file system LABELS.

TIP: If you want to use the cat command to read large files, try using the set command and set pager=1 so you can control the text and stop it from scrolling too fast.

chainloader FILE
- chainload a device
- syntax: chainloader (hd0)

Prepare to boot another boot loader.
[chain] -f, --force : force chainloading, ignoring invalid partition signature (!= 0xaa55).

grub> chainloader (hd0)+1grub> boot

This boots another boot loader by the code in whatever device or file you specified.
Remember, FILE can be an absolute filename or a blocklist.

This command may not won't work if you specify an empty sector or file, or if the code in that file is corrupted or somehow incompatible. There needs to be some boot loader code in the file or device (sector) you specify.

If it doesn't work, try a different file or sector or try loading the kernel and initrd.img directly.

Here's an example of a chainloader command in action,

grub> chainloader (hd0, <tab>
Possible partitions are:
Partition hd0,1: Filesystem type ext2, Label KARMIC, Last mofication time 2009-12-23 04:02:13 Wednesday, UUID 6d6af125-7087-4frb6-afbc-14ddeeb465b8
Partition hd0,2: Filesystem type ext2, Label JAUNTY, Last mofication time 2009-12-25 04:39:45 Friday, UUID 6d6af125-7087-4frb6-afbc-14ddeeb465b8
Partition hd0,3: Filesystem type ext2, Label INTREPID, Last mofication time 2009-12-25 04:39:45 Friday, UUID 6d6af125-7087-4frb6-afbc-14ddeeb465b8
Partition hd0,5: Filesystem type ext2, Label HARDY, Last mofication time 2009-12-28 10:577:17 Monday, UUID 6d6af125-7087-4frb6-afbc-14ddeeb465b8
Partition hd0,6: Unknown filesystemgrub> chainloader (hd0,2)+1
grub> boot

When your screen is filled up with text and it's looking rather messy, you can use the clear command to quickly empty it and return you to a fresh, clean blank screen with your grub> _ prompt at the top.

cmp  FILE1 FILE2  ........................................ -  compares file1 with file2
FILE can be an absolute path and filename or a blocklist.
example 1

grub> cmp 279192+237 279429[0-116]
Compare '279192+237' and '279429[0-116]':
Differ in size: 121344 [279192+237], 596329 [279429[0-116]]

Where: 279192+237 and 279429[0-116] were the locations of two files previously determined with the blocklist command.

grub> cmp /boot/vmlinuz-2.6.27-7-generic /boot/vmlinuz-2.6.27-9-generic
Compare '/boot/vmlinuz-2.6.27-7-generic' and
Differ in size: 2244464 [/boot/vmlinuz-2.6.27-7-generic], 2244304 [/boot/vmlinuz-2.6.27-9-generic]

The results of comparing an older kernel with a newer one. The cmp command tell us they're different in size, and by exactly how much. If they were identical it would not have given any output.

configfile FILE ......
- load a grub.cfg file - make convenient use of the commands and information already typed into the file
- You would likely need to use the search command to find a /boot/grub/grub.cfg first.

If successful, GRUB will present the boot menu from the grub.cfg and you can utilize the commands already there to boot any operating system listed.
This will only work if the other operating system's configuration file is compatible with GRUB2.
If not, you should try the chainloader command, or a direct boot approach instead.

grub> configfile (hd0,2)/boot/grub/grub.cfg

cpuid ............................................................. - Check for CPU features.
Running 'cpuid -h' will list the available CPUID tests.
Currently the only available test is -l  (long-mode) - check for long mode flag.
example use,

grub> cpuid
Check for CPU features-l, --long-mode       check for long mode flag (default)
-h, --help            display this help and exit
-u, --usage           display the usage of this command and exit

Usage: crc FILE
Calculate the crc32 checksum of a file

You probably need to insert the crc module before you can use crc, see insmod.

Usage: date [[year-] month-day] [hour:minute[:second]]
Command to display/set current datetime

This commands tells you the current date and time according to the motherboard's BIOS clock.

grub>  date
2009-12-28 13:10:15 Monday

Usage: drivemap -l | -r | [-s] grubdev osdisk
Manage the BIOS drive mappings

-l, --list show the current mappings
-r, --reset reset all mappings to the default values
-s, --swap perform both direct and reverse mappings
-h, --help display this help and exit
-u, --usage display the usage of this command and exit

Usage: dump ADDR
- dump memory
You probably need to insert the dump module before you can use dump, see insmod.

Usage: echo [-e] [-n] STRING
- Display a line of text

-n do not output the trailing newline
-e enable interpretation of backslash escapes
-h, --help display this help and exit
-u, --usage display the usage of this command and exit


grub> echo echo


The exit command can be used to exit from CLI Mode and  return your to the normal GRUB Menu.
To use it, type the command and then press your enter key twice.

export [ENVVAR]
- export an environmental variable

font FILE
-  Specify one or more font files to display.

You need to use fonts which have been made in pff or pf2 file format and compatible with GRUB2 using the grub-mkfont command, or get them already made from somewhere, such as a website or repository.
This didn't seem to work yet, at least not for me the last time I tried.
I get 'error: Invalid font magic'.

Link to more info: gfxterm - GRUB Wiki

Here's an interesting link: GRUB Graphical Menu Development Journal -

freebsd FILE [OPTS] [ARGS...]
-  Load a freebsd kernel.

freebsd_loadenv FILE
- Load freebsd env.

freebsd_module [FILE [type=module_type] [ARGS...]]

Usage: gptsync DEVICE [PARTITION[+/-[TYPE]]] ...
Fill hybrid MBR of GPT drive DEVICE, specified partitions will be a part of hybrid mbr. Up to 3 partitions are allowed.
TYPE is am MBR type, + means that partition is active. Only one partition can be active.

You probably need to insert the gptsync module before you can use gptsync, see insmod.

-  shuts down the computer immediately, if possible using APM

  -n --no-apm do not use APM to halt the computer

What is 'APM'? -  Advanced Power Management - Wikipedia, the free encyclopedia

handler [class [handler]]
List or select a class handler

Usage: hdparm [OPTIONS] DISK
Get/set ATA disk parameters

-B, --apm set Advnaced Power Management
(1=low, ..., 254=high,  255=off)
-C, --power check power mode
-F, --security-freeze freeze ATA security settings until reset
-H, --health check SMART health status
-M, --aam set Automatic Acoustic Management
(0=off,   128=quiet, ..., 254=fast
-S, --standby-timeout set standby timeout
(0=off,   1=5s, 2=10s, ..., 240=20m, 241=30m, ...)
-y, --standby set drive to standby mode
-Y, --sleep set drive to sleep mode
-i, --identify print drive identity and settings
-I, --dumpid
dump contents of ATA IDENTIFY sector
disable/enable SMART (0/1)
-q, --quiet do not print messages
-h, --help display this help and exit
-u, --usage display the usage of this help and exit

You probably need to insert the hdparm module before you can use hdparm, see insmod.


grub>  hdparm -H (hd0)
error: ATA pass through not available

I'm not too sure if I'm doing this right yet, there must be something more I don't know.

- prints 'Hello World'

grub> hello
Hello World

help [PATTERN]

If you just type 'help' by itself, it will just show you a list of available commands.

If you want to find out about one of those commands, type 'help <name-of-command>'.

For example, 'help echo', will give you more information about the 'echo' command.

If you type 'help help', you can get more information about the 'help' command.

The 'help' command is useful for reminding us what each command is used for, the proper syntax for using the command with options, and what options are available.

TIP: The 'help' command is the most important command in this whole page because if you can use the help command it will help you find out how to use all the rest of them.


grub> help date
Usage: date [[year-] month-day] [hour:minute[:second]
Command to display/set the current datetime

hexdump [options] file or device
- hexdump [ -s offset ] [-n length] { FILE | (mem) }
* Dump the contents of a file or memory.

-s offset    --skip offset skip offset bytes from the beginning of file
-n length  --length length read only length bytes

Example: Print the MBR on screen,

hexdump (hd0)0+1

initrd FILE
- Load an initrd.img


initrd     /initrd.img

An initrd.img is a file used to help the kernel get started.
We normally load the kernel with the linux command first before we use the initrd command to load the initrd.img which matches the kernel.

Please read this link: initrd - Wikipedia, the free encyclopedia

The name implies it's probably related to another command: linux16, see linux16 .

insmod MODULE
-  Insert a module.
The various instructions for GRUB2 are either built-in, or implemented as external modules, which have to be loaded before use.

  • The argument can be either a file or a module name.
  • The required disk, partition and filesystem modules required to read the modules on disk should be already loaded (or preloaded in core.img) in order to be able to load extra modules from disk.
  • If a module is specified by it's name, the matching filename is searched in the folder pointed by the variable prefix (like (hd0,1)/boot/grub/).


insmod /boot/grub/play.mod

(Read the (7)grub_modules page).

Usage: keystatus [--shift] [--ctrl]  [--alt]
Check key modifier status

-s, --shift check Shift key
-c, --ctrl check Control key
-a, --alt check Alt key
-h, --help display this help and exit
-u, --usage display this usage and exit

You probably need to insert the keystatus module before you can use keystatus, see insmod

linux  FILE [ARGS...]
-  Load a Linux kernel - Load a linux kernel. [_linux]


linux     /vmlinux root=/dev/sda1 ro quiet splash

For loading special kinds of kernels that the regular linux command, (above) doesn't cater for, such as 16-bit (b)zImage images like memtest86+.

One example of the use of the linux16 command is here: Run From GRUB2 - (PLOP Boot Manager).

For a second example, here is how to boot a floppy disk image from GRUB2.
For the full context see HOWTO: Flash BIOS, The Ubuntu Way - ciscosurfer - Ubuntu Web Forums,

linux16 (hd0,1)/boot/memdisk
initrd16 (hd0,1)/boot/biosupdate.img

There is also a multiboot compliant kernel game,


First you might need to use the ls command (below), to find a font file in your hard disk drive.
See also, How to Change the GRUB Menu Font .


loadfont (hd1,6)/boot/grub/walshes.pf2

You may use the lsfonts command (further below), to see if it worked. The lsfonts command will give you a list of  the fonts currently loaded.

I tried using the set command to see if I would be able to actually change the font that appears in the CLI Mode GRUB or in the GRUB Menu, but so far I have not been successful. Probably it's my own fault.
I hope to have an update for this sometime soon.

ls [-1| -h|-a] [FILE]
List devices and files

-l, --long show a long list with more detailed information
 -h, --human-readable print sizes in a human readable format
-a, --all list all files
--help list this help and exit
-u, --usage display the usage of this command and exit

The ls command is one of the first commands to try if you want to use GRUB to take a look around inside a computer. When you know what's there you can decide what you want to try to boot.

If given no options, ls lists all the devices currently known to the BIOS in the computer,

(hd0) (hd0,0) (hd0,1)  (hd0,2)  (hd0,3)  (hd0,5)  (hd0,6)  (hd1)  (hd1,1) (hd1,5) (fd0)

When given the path and name of a partition, ls can display information about the file system,

ls -lh (hd0,1)
Partition hd0,1: Filesystem type ext2, Label OCZ-KARMIC, Last modification time 2009-12-28 07:59:36 Monday, UUID 2ee1e3a3-f03a-4690-8310-7c3236786563

When given the path and name of a directory, ls can list the contents,

ls -lh (hd0,1)/

DIR 2009-11-24 19:03:59 Tuesday lost+found/
DIR 2009-10-28 21:02:21 Wednesday var/
DIR 2009-10-28 20:17:21 Sunday etc/
DIR 2009-12-27 07:29:22 Sunday media/
DIR 2009-12-12 00:02:15 Saturday bin/
DIR 2009-12-27 07:57:52 Sunday boot/
DIR 2009-11-24 19:12:53 Tuesday dev/
DIR 2009-11-24 19:12:42 Tuesday home/
DIR 2009-12-27 07:34:55 Sunday lib/
DIR 2009-10-20 00:04:56 Tuesday mnt/
DIR 2009-10-28 20:55:17 Wednesday opt/
DIR 2009-10-20 00:04:56 Tuesday proc/
DIR 2009-12-12 19:39:00 Saturday root/
DIR 2009-12-27 07:34:55 Sunday sbin/
DIR 2009-10-19 23:05:22 Monday selinux/
DIR 2009-10-28 20:55:17 Wednesday srv/
DIR 2009-10-19 15:18:00 Monday sys/
DIR 2009-12-27 20:17:21 Sunday tmp/
DIR 2009-12-27 07:57:27 Sunday usr/
3.71M 2009-12-05 23:34:07 Saturday vmlinuz
7.29M 2009-12-05 23:34:07 Saturday initrd.img
7.29M 2009-11-24 20:02:35 Tuesday initrd.img.old
3.71M 2009-11-24 20:02:35 Tuesday vmlinuz.old

As you can see from the information listed above, we have found a Linux operating system.

List the loaded fonts

- List all PCI devices. [lspci] The output looks like "00:00.0 8086:27a0.0 Device Class".

example output,

grub> lspci
00:00.0 1106:3148 Host Bridge
00:01.0 1106:b091 PCI-PCI Bridge
00:0b.0 11c1:044cc Communication controller
00:10.0 1106:3038 Serial Bus Controller
00:10.1 1106:3038 Serial Bus Controller
00:10.2 1106:3038 Serial Bus Controller
00:10.3 1106:3104 Serial Bus Controller
00:10.0 1106:3177 ISA Bridge
00:10.0 1106:0571 IDE Controller
00:10.0 1106:3059 Multimedia Audio Device
00:10.0 1106:3065 Ethernet Controller
00:10.0 1106:9696 VGA Controller

loopback  [-d| -p] DEVICENAME FILE
- Make a device from a file
- Loopback allows mounting a file as if it were a disk (i.e turn a disk image in a virtual device).
check the loopback command implemented by this module, in (5)grub.cfg)

Here's a web page about how to use the loopback command to boot an .iso file containing a bootable Linux CD image when the bootable .iso is located in a hard drive,
Boot an ISO via Grub2 - Mika's Blog

See also,
MultiBoot USB with Grub2 (boot directly from iso files) - panticz - thanks pxwpxw for the link.

I tried following the example in Mika's Blog and I was able to get that to work.
I used a parted magic live cd instead of grml though.
I copied my parted magic live cd .iso file into my /boot partition first, to make the file path simpler. (I'm using a separate /boot because I have a LUKS encrypted LVM / file system).

Then I rebooted and entered CLI Mode GRUB and ...

loopback loop (hd2,5)/pmagic-3.4.iso

Where: my /boot partition, or the partition I stored the .iso file in is 3rd hard disk, partition 5.

linux (loop)/pmagic/bzImage isofrom=/dev/sdc5/pmagic-3.4.iso root=/dev/ram0 livecd boot=live quiet vga=791 noeject noprompt sleep=0 tmpfs_size=220M ramdisk_size=25000

Where: the partition I stored the .iso file in is /dev/sdc5

For the special kernel boot options, mount the .iso beforehand and take a look around for the Live CD's boot loader. Look for a folder called 'grub' or 'isolinux', most CDs use isolinux, but a few use GRUB. Look for a menu.lst or grub.cfg file or a file called isolinux.cfg, you will find boot entries in those files which use all kinds of special boot options. You can note down the options you like and use the same options now.

initrd   (loop)/pmagic/initrd

This booted the .iso file from my hard disk drive and now the entire Parted Magic is running in RAM!   Success is sweet!

I did it, can you?

- List modules
- The various instructions for GRUB2 are either built-in, or implemented as external modules, which have to be loaded before use.
(Read the (7)grub_modules page).

grub> lsmod
Name     Ref   Count   Dependencies
tga      1             bitmap
terminal           1          normal
vbe      1             video
gfxterm  1             font,normal,bitmps,video
bitmap   4
video    4
font     3              normal
_chain   1
biosdisk            1
pc       1
reiserfs            2
fshelp   3

module  FILE [ARGS...]
(Read the (7)grub_modules page).
GRUB2 has a modular design, so we can add new modules or upgrade old modules to add more functionality.
Each module is designed to perform some function.
There are modules for each command, modules for the video diplay, understanding file systems, providing the fonts, and so on. These modules can be 'inserted' when needed.
If you're trying to do something in GRUB and you get an error 'not loaded', try using the insmod command to insert the module amd then try the command again, see insmod

- Load a multiboot kernel - Load a Multiboot kernel. [_multiboot]

netbsd   FILE [OPTS]

openbsd FILE [OPTS]
Set active handler

Set active handler

play  FILE
- Play a sound - you need to specify some kind of a sound file which you may have stored in your computer somewhere, (in a file system).
- I don't know if it plays .ogg music or mp3 or some other sound format ?
- so far I can get it to make beeps from the motherboard speaker
- maybe for newer computer with better motherboard speakers ?

read  [ENVVAR]
- read an environmental variable

- reboot

-  Enter rescue mode - Go into the rescue mode.

rmmod  - Remove a module - Remove (unload) a module.  (Read the (7)grub_modules page).

search [-f | -l | -s] NAME
- Search devices

-f by  filename
-l by filesystem label


search -l INTREPID
hd0,2search -f /boot/grub/menu.lst
hd0,2 hd0,3 hd0,5

search -f /boot/grub/grub.conf

serial [-f|-l|-s] NAME
-  Configure a serial port.

-u, --unit Set the serial port unit
-p, --port Set the serial port unit
-s --speed Set the serial port speed
-w --word Set the serial port word
-r --parity Set the serial port parity
-t --stop Set the serial port stop bits
-h --help help
--usage serial [OPTIONS...]

Here's a link for those who aren't sure what a serial port is, Serial Port - wikipedia

When no options are specified, this command lists the  environmental variables  you have presently in place.

grub> set

If an option is specified, this command can set a variable -   var=value ...... - Set a variable

An 'environmental variable' is something like the normal foreground/background colors for your menu and the highlight foreground/background colors.
If you're displaying a splashimage, you can use only use black for your background (second) color, especially for the 'normal' two colors, because black means transparent. Colors will hide the splashimage.
eg color_normal anycolor/black anycolor/anycolor
Where: 'anycolor' means any color from the list of available colors.
Colors we can choose from include, black (meaning transparent), blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow, white.

 white  blue  magenta  cyan
 light-gray  yellow  red  light-magenta
 dark-gray  green  light-blue  light-red
 black  light-cyan  light-green  brown


grub> set color_normal=red/green

This has caused my GRUB 'environment' to be changed.

Another environmental variable we can set is 'pager=1',

grub> set pager=1

this setting is useful when we're using commands that produce a lot of text on the screen. Normally the text will scroll up our monitors out of control and disappear off the top of the screen before we have time to take in the information.  Sometimes the pause key will work to hold the text, but more often not. With the pager=1 setting, we can control it and view one page at a time.

The opposite of set is unset.

- sleep [-v] [-i] NUMBER_OF_SECONDS
* Wait for a specified number of seconds. [sleep]

-v, --verbose Verbose Countdown (display remaining seconds during count down)
-i, --interruptible Countdown is interruptible by pressing escape key

example output,

sleep -v 10

type 'sleep 10', and nothing appears on the screen for 10 seconds

type 'sleep -v 10', and you will see the number of seconds displayed counting down from 10 to 0.

type 'sleep -i -v10',  and you can press your 'Esc' key at any time to return to your main boot menu.

I imagine the sleep function should be useful for setting your computer to wait for some amount of time before booting up, or having GRUB run some other command(s).

source  FILE
- Load another config file without changing context.

terminal  [TERM...]
Prints what terminals are available and which one you're using right now.
example output,

Available terminal(s): gfxterm console
Current terminal: gfxterm

terminfo  [TERM]
-Set terminfo type

- evaluate an expression

unset [VAR]
- Unset an environmental variable

Another way to unset an environmental variable when in Command Line Mode is to chainload the same GRUB by it's own MBR or boot sector. See the chainloader command.

- Test USB support

List compatible VESA BIOS extension video modes. [vbeinfo @i386]

This command is the recommended command for finding out what will be the maximum resolution we can set for our display, and and therefore determines the size of our splashimages.

TIP: This command, (and a few of the other commands), will cause about three pages of text to go scrolling up the monitor screen faster than most humans can read. You may use your 'pause' key to pause the scrolling and take your time to read the text. When ready, just press 'enter' for the next page of text to scroll up.
Another idea is to use the set command, set pager=1

Test VESA BIOS Extension 2.0+ support. [vbetest @i386]
The mode to test is specified in variable $vbe_mode, which defaults to 0x101 (640x480 8bpp) jpeg file format restriction : unknown (8-bit precision only ?).

Test video subsystem. [videotest]
To set the screen resolution, you should set the variable $vbe_mode before loading vbe and/or gfxmterm
(default mode is 0x101 i.e. 640x480 8bpp) Test your graphics

- I entered the command by itself - nothing happened (black screen) until I pressed 'enter', then some colored squares appear.
Any key cancels. - have to 'Ctrl'+'Alt'+'Del' to reboot.

ARGS - arguements, like options - kernel options,
external link: BootOptions - Ubuntu Community Docs
also: Kernel Parameters - list of kernel boot parameters -

Linux device names are like /dev/sda1
or use the GRUB device naming syntax like (hd0,1)

EXPRESSION - see regex (7) manpage - Ubuntu Manuals
or see Bio::DB::Expression.3pm - Ubuntu Manuals

ENVAR - short for environmental variable - wikipedia

For example,

variable = value
0 = ?
color_highlight = yellow/blue
color_normal = red/green
gfxmode = 640x480
prefix = (hd0,2)/boot/grub
root = (hd0,2)
default = 0
pager = 1

Colors we can choose from include, black (meaning transparent), blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow, white.

 white  blue  magenta  cyan
 light-gray  yellow  red  light-magenta
 dark-gray  green  light-blue  light-red
 black  light-cyan  light-green  brown


FILE - there are two ways to specify a file,

  • by an absolute file name
  • by a blocklist

An 'absolute file name' just means the device name (in GRUB terms, like : (hd0,1), followed by the path to a file, and the filename.

An example of an 'absolute file name' would be: (hd0,1)/boot/grub/grub.cfg

You can specify the '(hd0,1)' part of it every time to be sure, but if you're feeling a little bit lazy and you leave that bit out, GRUB will assume you're referring to the '/boot/grub/grub.cfg' in whatever device GRUB currently has set as it's 'root' device.

A 'blocklist', on the other hand, is capable of  describing the physical location of code or data on  'raw' areas of the disk, (not addressed by any file system), and areas that are addressed by a file system as well. It's kind of like putting GRUB in four-wheel drive. GRUB can go anywhere.
This might also be useful if you want to tell GRUB the location of a file that happens to be in a file system that GRUB doesn't recognize, such as NTFS. (Maybe there's an image of a boot sector you left in there that you now decided you suddenly need as a device to boot from, or something unusual like that).

A simple example of a blocklist would be: (hd0)0+1 , that would indicate the beginning of sector 0 (zero), and the space following it for 1 (one) sector.

Blocklist format is already explained pretty well in the GNU GRUB (Legacy) Manual, 13.3.1 blocklist  - GNU GRUB  Manual 0.97.

Source: - 11 Filesystem syntax and semantics -GNU GRUB Manual 0.97

LABEL - disk label or file system label. You can 'label' your file systems with commands like e2label, reiserfstune with the -l option, and other commands for various other file systems.
If you use Gnome Partition Editor, aka 'GParted', you can do this from the right-click menu.
It's very handy to have your file systems labeled, especially if you have several of them.
It's also extremely convenient to have your USB flash memory disks file systems labelled too.

PATTERN - for the 'help' command you're supposed to type the name of another command after it which you would like to find out more information about.

MODULE -  Most commands are only available when the corresponding module is loaded (except built-in commands). The various instructions for GRUB2 are either built-in, or implemented as external modules, which have to be loaded before use.  lsmod

Here's a list of modules in my /boot/grub/,

acpi.mod affs.mod afs_be.mod afs.mod aout.mod ata.mod
ata_pthru.mod at_keyboard.mod
befs_be.mod befs.mod biosdisk.mod bitmap.mod blocklist.mod boot.mod
bsd.mod bufio.mod
cat.mod cpuid.mod crc.mod cmp.mod configfile.mod cpio.mod
datehook.mod date.mod datetime.mod dm_nv.mod drivemap.mod
echo.mod efiemu.mod elf.mod ext2.mod extcmd.mod
fat.mod font.mod fs_file.mod fshelp.mod fs_uuid.mod
gfxterm.mod gptsync.mod gzio.mod
handler.mod halt.mod hdparm.mod hello.mod help.mod hexdump.mod
hfs.mod hfsplus.mod
jfs.mod jpeg.mod
loopback.mod lsmmap.mod ls.mod lspci.mod lvm.mod linux16.mod
linux.mod loadenv.mod
memdisk.mod mdraid.mod memrw.mod minicmd.mod minix.mod mmap.mod
msdospart.mod multiboot.mod
ntfscomp.mod normal.mod ntfs.mod
part_msdos.mod part_apple.mod part_gpt.mod part_sun.mod part_amiga.mod parttool.mod
password.mod pci.mod play.mod png.mod probe.mod part_acorn.mod
pxecmd.mod pxe.mod
raid5rec.mod raid6rec.mod raid.mod read.mod reboot.mod reiserfs.mod
serial.mod search.mod setjmp.mod sfs.mod sh.mod sleep.mod
tar.mod terminfo.mod test.mod tga.mod true.mod
udf.mod ufs1.mod ufs2.mod uhci.mod usb_keyboard.mod usb.mod
usbms.mod usbtest.mod
vbeinfo.mod vbe.mod vbetest.mod vga.mod vga_text.mod video_fb.mod
video.mod videotest.mod
xfs.mod xnu.mod xnu_uuid.mod
zfs.mod zfsinfo.mod

Comments are closed.

Post Navigation