Mastering GrUB – Part 4 – Grub Configuration Syntax and Commands

1. Grub Configuration syntax and semantics

GRUB uses a special syntax for specifying disk drives which can be accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish between IDE, ESDI, SCSI, or others. You must know yourself which BIOS device is equivalent to which OS device. Normally, that will be clear if you see the files in a device or use the command ‘search’

1.1 How to specify devices

The device syntax is like this:


‘[]’ means the parameter is optional. DEVICE depends on the disk driver in use. BIOS and EFI disks use either ‘fd’ or ‘hd’ followed by a digit, like ‘fd0’, or ‘cd’. AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.

Memdisk and host are limited to one disk and so it’s refered just by driver name. RAID (md), ofdisk (ieee1275 and nand), LVM (lvm), LDM, virtio (vdsk) and arcdisk (arc) use intrinsic name of disk prefixed by driver name. Additionally just “nand” refers to the disk aliased as “nand”. Conflicts are solved by suffixing a number if necessarry. Commas need to be escaped. Loopback
uses whatever name specified to ‘loopback’ command.

Hostdisk uses names specified in as long as it’s of the form [fhc]d[0-9]* or hostdisk/<OS DEVICE>. For crypto and RAID (md) additionally you can use the syntax <driver name>uuid/<uuid>. For LVM additionally you can use the syntax lvmid/<volume-group-uuid>/<volume-uuid>.


PART-NUM represents the partition number of DEVICE, starting from one. PARTNAME is optional but is recommended since disk may have several top-level partmaps. Specifying third and later component you can access to subpartitions.

The syntax ‘(hd0)’ represents using the entire disk (or the MBR when installing GRUB), while the syntax ‘(hd0,1)’ represents using the first partition of the disk (or the boot sector of the partition when installing GRUB).


If you enabled the network support, the special drives ‘(PROTOCOL[,SERVER])’ are also available. Supported protocols are ‘http’ and ‘tftp’. If SERVER is omitted, value of environment variable ‘net_default_server’ is used. Before using the network drive, you must initialize the network.

If you boot GRUB from a CD-ROM, ‘(cd)’ is available.

1.2 How to mention file paths

There are two ways to specify files, by “absolute file name” and by “block list”.

An absolute file name resembles a Unix absolute file name, using ‘/’ for the directory separator (not ‘\’ as in DOS). One example is ‘(hd0,1)/boot/grub2/grub.cfg’. This means the file ‘/boot/grub2/grub.cfg’ in the first partition of the first hard disk.

If you omit the device name in an absolute file name, GRUB uses GRUB’s “root device” implicitly. So if you set the root device to, say, ‘(hd1,1)’ by the command ‘set root=(hd1,1)’ (*note set::), then ‘/boot/kernel’ is the same as ‘(hd1,1)/boot/kernel’.

On ZFS filesystem the first path component must be VOLUME’@'[SNAPSHOT]. So ‘/rootvol@snap-129/boot/grub2/grub.cfg’ refers to file ‘/boot/grub2/grub.cfg’ in snapshot of volume ‘rootvol’ with name ‘snap-129’. Trailing ‘@’ after volume name is mandatory even if snapshot name is omitted.

1.3 How to specify block lists

A block list is used for specifying a file that doesn’t appear in the filesystem, like a chainloader.

The syntax is ‘[OFFSET]+LENGTH[,[OFFSET]+LENGTH]…’.

Here is an example:


This represents that GRUB should read blocks 0 through 99, block 200,and blocks 300 through 599. If you omit an offset, then GRUB assumes the offset is zero.

Like the file name syntax (*note File name syntax::), if a blocklist does not contain a device name, then GRUB uses GRUB’s “root device”. So ‘(hd0,2)+1’ is the same as ‘+1’ when the root device is ‘(hd0,2)’.

2. GRUB’s user interface

GRUB has both a simple menu interface for choosing preset entries from a configuration file, and a highly flexible command-line for performing any desired combination of boot commands.

GRUB looks for its configuration file as soon as it is loaded. If one is found, then the full menu interface is activated using whatever entries were found in the file. If you choose the “command-line” menu
option, or if the configuration file was not found, then GRUB drops to the command-line interface.

2.1 The flexible command-line interface

The command-line interface provides a prompt and after it an editable text area much like a command-line in Unix or DOS. Each command is immediately executed after it is entered(1) (*note Command-line
interface-Footnote-1::). The commands (*note Command-line and menu entry commands::) are a subset of those available in the configuration file, used with exactly the same syntax.

Cursor movement and editing of the text on the line can be done via a subset of the functions available in the Bash shell:

<C-f> <PC right key> Move forward one character.

<C-b> <PC left key> Move back one character.

<C-a> <HOME> Move to the start of the line.

<C-e> <END> Move the the end of the line.

<C-d> <DEL> Delete the character underneath the cursor.

<C-h> <BS> Delete the character to the left of the cursor.

<C-k> Kill the text from the current cursor position to the end of the line.

<C-u> Kill backward from the cursor to the beginning of the line.

<C-y> Yank the killed text back into the buffer at the cursor.

<C-p> <PC up key> Move up through the history list.

<C-n> <PC down key> Move down through the history list.

When typing commands interactively, if the cursor is within or before the first word in the command-line, pressing the <TAB> key (or <C-i>) will display a listing of the available commands, and if the cursor is
after the first word, the ‘<TAB>’ will provide a completion listing of disks, partitions, and file names depending on the context. Note that to obtain a list of drives, one must open a parenthesis, as ‘root (‘.

Note that you cannot use the completion functionality in the TFTP filesystem. This is because TFTP doesn’t support file name listing for the security.

2.2 The simple menu interface

The menu interface is quite easy to use. Its commands are both reasonably intuitive and described on screen.

Basically, the menu interface provides a list of “boot entries” to the user to choose from. Use the arrow keys to select the entry of choice, then press <RET> to run it. An optional timeout is available to
boot the default entry (the first one if not set), which is aborted by pressing any key.

Commands are available to enter a bare command-line by pressing <c> (which operates exactly like the non-config-file version of GRUB, but allows one to return to the menu if desired by pressing <ESC>) or to
edit any of the “boot entries” by pressing <e>.

If you protect the menu interface with a password (*note Security::), all you can do is choose an entry by pressing <RET>, or press <p> to enter the password.

2.3 Editing a menu entry

The menu entry editor looks much like the main menu interface, but the lines in the menu are individual commands in the selected entry instead of entry names.

If an <ESC> is pressed in the editor, it aborts all the changes made to the configuration entry and returns to the main menu interface.

Each line in the menu entry can be edited freely, and you can add new lines by pressing <RET> at the end of a line. To boot the edited entry, press <Ctrl-x>.

Although GRUB unfortunately does not support “undo”, you can do almost the same thing by just returning to the main menu using <ESC>.

3 GRUB environment variables

GRUB supports environment variables which are rather like those offered by all Unix-like systems. Environment variables have a name, which is unique and is usually a short identifier, and a value, which is an
arbitrary string of characters. They may be set , unset , or looked up by name.

A number of environment variables have special meanings to various parts of GRUB. Others may be used freely in GRUB configuration files.

3.1 Special environment variables

These variables have special meaning to GRUB.

3.1.1 biosnum

When chain-loading another boot loader, GRUB may need to know what BIOS drive number corresponds to the root device so that it can set up registers properly. If the BIOSNUM variable is set, it overrides GRUB’s own means of guessing this.

For an alternative approach which also changes BIOS drive mappings for the chain-loaded system.

3.1.2 check_signatures

This variable controls whether GRUB enforces digital signature validation on loaded files.

3.1.3 chosen

When executing a menu entry, GRUB sets the CHOSEN variable to the title of the entry being executed.

If the menu entry is in one or more submenus, then CHOSEN is set to the titles of each of the submenus starting from the top level followed by the title of the menu entry itself, separated by ‘>’.

3.1.4 cmdpath

The location from which ‘core.img’ was loaded as an absolute directory name. This is set by GRUB at startup based on information returned by platform firmware. Not every platform
provides this information and some may return only device without path name.

3.1.5 color_highlight

This variable contains the “highlight” foreground and background terminal colors, separated by a slash (‘/’). Setting this variable changes those colors.

The default is ‘black/light-gray’.

3.1.6 color_normal

This variable contains the “normal” foreground and background terminal colors, separated by a slash (‘/’). Setting this variable changes those colors. Each color must be a name from the following list:

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

The default is ‘light-gray/black’.

The color support support varies from terminal to terminal.

‘morse’ has no color support at all.

‘mda_text’ color support is limited to highlighting by black/white reversal.

‘console’ on ARC, EMU and IEEE1275, ‘serial_*’ and ‘spkmodem’ are governed by terminfo and support only 8 colors if in modes ‘vt100-color’ (default for console on emu), ‘arc’ (default for console on ARC),
‘ieee1275’ (default for console on IEEE1275). When in mode ‘vt100’ then the color support is limited to highlighting by black/white reversal. When in mode ‘dumb’ there is no color support.

When console supports no colors this setting is ignored. When console supports 8 colors, then the colors from the second half of the previous list are mapped to the matching colors of first half.

‘console’ on EFI and BIOS and ‘vga_text’ support all 16 colors.

‘gfxterm’ supports all 16 colors and would be theoretically extendable to support whole rgb24 palette but currently there is no compelling reason to go beyond the current 16 colors.

3.1.7 debug

This variable may be set to enable debugging output from various components of GRUB. The value is a list of debug facility names separated by whitespace or ‘,’, or ‘all’ to enable all available
debugging output. The facility names are the first argument to grub_dprintf. Consult source for more details.

3.1.8 default

If this variable is set, it identifies a menu entry that should be selected by default, possibly after a timeout. The entry may be identified by number or by id.

For example, if you have:

menuentry ‘Example GNU/Linux distribution’ –class gnu-linux –id example-gnu-linux {


then you can make this the default using:


If the entry is in a submenu, then it must be identified using the titles of each of the submenus starting from the top level followed by the number or title of the menu entry itself, separated by ‘>’. For
example, take the following menu structure:

Submenu 1
Menu Entry 1
Menu Entry 2
Submenu 2
Submenu 3
Menu Entry 3
Menu Entry 4
Menu Entry 5

“Menu Entry 3” would then be identified as ‘Submenu 2>Submenu 3>Menu Entry 3’.

This variable is often set by ‘GRUB_DEFAULT’, ‘grub2-set-default’, or ‘grub2-reboot’.

3.1.9 fallback

If this variable is set, it identifies a menu entry that should be selected if the default menu entry fails to boot. Entries are identified in the same way as for ‘default’.

3.1.10 gfxmode

If this variable is set, it sets the resolution used on the ‘gfxterm’ graphical terminal. Note that you can only use modes which your graphics card supports via VESA BIOS Extensions (VBE), so for example native LCD panel resolutions may not be available. The default is ‘auto’, which selects a platform-specific default that should look reasonable. Supported modes can be listed by ‘videoinfo’ command in GRUB.

The resolution may be specified as a sequence of one or more modes, separated by commas (‘,’) or semicolons (‘;’); each will be tried in turn until one is found.
Each mode should be either ‘auto’, ‘WIDTHxHEIGHT’, or ‘WIDTHxHEIGHTxDEPTH’.

3.1.11 gfxpayload

If this variable is set, it controls the video mode in which the Linux kernel starts up, replacing the ‘vga=’ boot option. It may be set to ‘text’ to force the Linux kernel to boot in normal text
mode, ‘keep’ to preserve the graphics mode set using ‘gfxmode’, or any of the permitted values for ‘gfxmode’ to set a particular graphics mode.

Depending on your kernel, your distribution, your graphics card, and the phase of the moon, note that using this option may cause GNU/Linux to suffer from various display problems, particularly during the early part of the boot sequence. If you have problems, set this variable to ‘text’ and GRUB will tell Linux to boot in normal text mode.

The default is platform-specific. On platforms with a native textmode (such as PC BIOS platforms), the default is ‘text’. Otherwise the default may be ‘auto’ or a specific video mode.

This variable is often set by ‘GRUB_GFXPAYLOAD_LINUX’

3.1.12 gfxterm_font

If this variable is set, it names a font to use for text on the ‘gfxterm’ graphical terminal. Otherwise, ‘gfxterm’ may use any available font.

3.1.13 grub_cpu

In normal mode (*note normal::), GRUB sets the ‘grub_cpu’ variable to the CPU type for which GRUB was built (e.g. ‘i386’ or ‘powerpc’).

3.1.14 grub_platform

In normal mode (*note normal::), GRUB sets the ‘grub_platform’ variable to the platform for which GRUB was built (e.g. ‘pc’ or ‘efi’).

3.1.15 icondir

If this variable is set, it names a directory in which the GRUB graphical menu should look for icons after looking in the theme’s ‘icons’ directory.

3.1.16 lang

If this variable is set, it names the language code that the ‘gettext’ command (*note gettext::) uses to translate strings. For example, French would be named as ‘fr’, and Simplified Chinese as ‘zh_CN’.

‘grub2-mkconfig’ (*note Simple configuration::) will try to set a reasonable default for this variable based on the system locale.

3.1.17 locale_dir

If this variable is set, it names the directory where translation files may be found (*note gettext::), usually ‘/boot/grub2/locale’. Otherwise, internationalization is disabled.

‘grub2-mkconfig’ (*note Simple configuration::) will set a reasonable default for this variable if internationalization is needed and any translation files are available.

3.1.18 menu_color_highlight

This variable contains the foreground and background colors to be used for the highlighted menu entry, separated by a slash (‘/’). Setting this variable changes those colors. For the available color names,
The default is the value of ‘color_highlight’

3.1.19 menu_color_normal

This variable contains the foreground and background colors to be used for non-highlighted menu entries, separated by a slash (‘/’). Setting this variable changes those colors. For the available color names,
The default is the value of ‘color_normal’ .

3.1.20 net_<INTERFACE>_boot_file

3.1.21 net_<INTERFACE>_dhcp_server_name

3.1.22 net_<INTERFACE>_domain

3.1.23 net_<INTERFACE>_extensionspath

3.1.24 net_<INTERFACE>_hostname

3.1.25 net_<INTERFACE>_ip

3.1.26 net_<INTERFACE>_mac

3.1.27 net_<INTERFACE>_rootpath

3.1.28 net_default_interface

3.1.29 net_default_ip

3.1.30 net_default_mac

3.1.31 net_default_server

3.1.32 pager

If set to ‘1’, pause output after each screenful and wait for keyboard input. The default is not to pause output.

3.1.33 prefix

The location of the ‘/boot/grub’ directory as an absolute file name. This is normally set by GRUB at startup based on information provided by ‘grub2-install’. GRUB modules are
dynamically loaded from this directory, so it must be set correctly in order for many parts of GRUB to work.

3.1.34 pxe_blksize

3.1.35 pxe_default_gateway

3.1.36 pxe_default_server

3.1.37 root

The root device name (*note Device syntax::). Any file names that do not specify an explicit device name are read from this device. The default is normally set by GRUB at startup based on the value of

For example, if GRUB was installed to the first partition of the first hard disk, then ‘prefix’ might be set to ‘(hd0,msdos1)/boot/grub’ and ‘root’ to ‘hd0,msdos1’.

3.1.38 superusers

This variable may be set to a list of superuser names to enable authentication support.

3.1.39 theme

This variable may be set to a directory containing a GRUB graphical menu theme. This variable is often set by ‘GRUB_THEME’

3.1.40 timeout

If this variable is set, it specifies the time in seconds to wait for keyboard input before booting the default menu entry. A timeout of ‘0’ means to boot the default entry immediately without displaying the menu;
a timeout of ‘-1’ (or unset) means to wait indefinitely.

If ‘timeout_style’ (*note timeout_style::) is set to ‘countdown’ or ‘hidden’, the timeout is instead counted before the menu is displayed.

This variable is often set by ‘GRUB_TIMEOUT’

3.1.41 timeout_style

This variable may be set to ‘menu’, ‘countdown’, or ‘hidden’ to control the way in which the timeout (*note timeout::) interacts with displaying the menu. See the documentation of ‘GRUB_TIMEOUT_STYLE’ (*note Simple
configuration::) for details.

3.2 The GRUB environment block

It is often useful to be able to remember a small amount of information from one boot to the next. For example, you might want to set the default menu entry based on what was selected the last time. GRUB
deliberately does not implement support for writing files in order to minimise the possibility of the boot loader being responsible for file system corruption, so a GRUB configuration file cannot just create a file in the ordinary way. However, GRUB provides an “environment block” which can be used to save a small amount of state.

The environment block is a preallocated 1024-byte file, which normally lives in ‘/boot/grub2/grubenv’ (although you should not assume this). At boot time, the ‘load_env’ command (*note load_env::) loads
environment variables from it, and the ‘save_env’ command saves environment variables to it. From a running system, the ‘grub2-editenv’ utility can be used to edit the environment block.

For safety reasons, this storage is only available when installed on a plain disk (no LVM or RAID), using a non-checksumming filesystem (no ZFS), and using BIOS or EFI functions (no ATA, USB or IEEE1275).

‘grub2-mkconfig’ uses this facility to implement ‘GRUB_SAVEDEFAULT’

4. Grub Commands

In this section, we list all commands that are available in GRUB.

Commands belong to different groups. A few can only be used in the global section of the configuration file (or “menu”); most of them can be entered on the command-line and can be used either anywhere in the menu or specifically in the menu entries.

In rescue mode, only the ‘insmod’ (*note insmod::),’ls”set’, and ‘unset’ commands are normally available. If you end up in rescue mode and do not know what to do, then *note GRUB only offers a rescue shell::.

4.1 The list of commands for the menu only

The semantics used in parsing the configuration file are the following:

  • The files _must_ be in plain-text format.
  • ‘#’ at the beginning of a line in a configuration file means it is
    only a comment.
  • Options are separated by spaces.
  • All numbers can be either decimal or hexadecimal. A hexadecimal number must be preceded by ‘0x’, and is case-insensitive.

These commands can only be used in the menu:

4.1.1 menuentry

menuentry TITLE [‘–class=class’ …] [‘–users=users’] [‘–unrestricted’] [‘–hotkey=key’] [‘–id=id’] [ARG …] {

This defines a GRUB menu entry named TITLE. When this entry is selected from the menu, GRUB will set the CHOSEN environment variable to value of ‘–id’ if ‘–id’ is given, execute the list of commands given within braces, and if the last command in the list returned successfully and a kernel was loaded it will execute the ‘boot’ command.

The ‘–class’ option may be used any number of times to group menu entries into classes. Menu themes may display different classes using different styles.

The ‘–users’ option grants specific users access to specific menu entries.

The ‘–unrestricted’ option grants all users access to specific menu entries.

The ‘–hotkey’ option associates a hotkey with a menu entry. KEY may be a single letter, or one of the aliases ‘backspace’, ‘tab’, or ‘delete’.

The ‘–id’ may be used to associate unique identifier with a menu entry. ID is string of ASCII aphanumeric characters, underscore and hyphen and should not start with a digit.

All other arguments including TITLE are passed as positional parameters when list of commands is executed with TITLE always assigned to ‘$1’.

4.1.2 submenu

submenu TITLE [‘–class=class’ …] [‘–users=users’] [‘–unrestricted’] [‘–hotkey=key’] [‘–id=id’] {
… }

This defines a submenu. An entry called TITLE will be added to the menu; when that entry is selected, a new menu will be displayed showing all the entries within this submenu.

All options are the same as in the ‘menuentry’ command

4.2 The list of general commands

Commands usable anywhere in the menu and in the command-line.

4.2.1 serial

serial [‘–unit=unit’] [‘–port=port’] [‘–speed=speed’] [‘–word=word’] [‘–parity=parity’] [‘–stop=stop’]

Initialize a serial device. UNIT is a number in the range 0-3 specifying which serial port to use; default is 0, which corresponds to the port often called COM1. PORT is the I/O port where the UART is to be found; if specified it takes precedence over UNIT. SPEED is the transmission speed; default is 9600. WORD and STOP are the number of data bits and stop bits. Data bits must be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data bits and one stop bit. PARITY is one of ‘no’, ‘odd’, ‘even’ and defaults to ‘no’.

The serial port is not used as a communication channel unless the ‘terminal_input’ or ‘terminal_output’ command is used .

4.2.2 terminal_input

terminal_input [‘–append’|’–remove’] [terminal1][terminal2] …

List or select an input terminal.

With no arguments, list the active and available input terminals.

With ‘–append’, add the named terminals to the list of active input terminals; any of these may be used to provide input to GRUB.

With ‘–remove’, remove the named terminals from the active list.

With no options but a list of terminal names, make only the listed terminal names active.

4.2.3 terminal_output

   terminal_output [‘–append’|’–remove’] [terminal1] [terminal2] …

List or select an output terminal.With no arguments, list the active and available output terminals.

With ‘–append’, add the named terminals to the list of active output terminals; all of these will receive output from GRUB.

With ‘–remove’, remove the named terminals from the active list.

With no options but a list of terminal names, make only the listed terminal names active.

4.2.4 terminfo

terminfo [-a|-u|-v][term]

Define the capabilities of your terminal by giving the name of an entry in the terminfo database, which should correspond roughly to a ‘TERM’ environment variable in Unix.

The currently available terminal types are ‘vt100’, ‘vt100-color’,’ieee1275′, and ‘dumb’. If you need other terminal types, please contact us to discuss the best way to include support for these in

The ‘-a’ (‘–ascii’), ‘-u’ (‘–utf8’), and ‘-v’ (‘–visual-utf8’) options control how non-ASCII text is displayed. ‘-a’ specifies an ASCII-only terminal; ‘-u’ specifies logically-ordered UTF-8; and
‘-v’ specifies “visually-ordered UTF-8” (in other words, arranged such that a terminal emulator without bidirectional text support will display right-to-left text in the proper order; this is not
really proper UTF-8, but a workaround).

If no option or terminal type is specified, the current terminal type is printed.

4.3 The list of command-line and menu entry commands

These commands are usable in the command-line and in menu entries. If you forget a command, you can run the command ‘help’.
List available video modes

4.3.1 [

‘[‘ expression ‘]’       Alias for ‘test EXPRESSION’

4.3.2 acpi

acpi[‘-1’|’-2′][‘–exclude=table1,…’|’–load-only=table1,…’][‘–oemid=id’][‘–oemtable=table’][‘–oemtablerev=rev’][‘–oemtablecreator=creator’][‘–oemtablecreatorrev=rev’][‘–no-ebda’] filename …

Modern BIOS systems normally implement the Advanced Configuration and Power Interface (ACPI), and define various tables that describe the interface between an ACPI-compliant operating system and the firmware. In some cases, the tables provided by default only work well with certain operating systems, and it may be necessary to replace some of them.

Normally, this command will replace the Root System Description Pointer (RSDP) in the Extended BIOS Data Area to point to the new tables. If the ‘–no-ebda’ option is used, the new tables will be known only to GRUB, but may be used by GRUB’s EFI emulation.

4.3.3 authenticate

– authenticate [userlist]
Check whether user is in USERLIST or listed in the value of variable ‘superusers’. See *note superusers:: for valid user list format. If ‘superusers’ is empty, this command returns true.

4.3.4 background_color

background_color color

Set background color for active terminal. For valid color specifications see *note Colors: Theme file format. Background color can be changed only when using ‘gfxterm’ for terminal output.

This command sets color of empty areas without text. Text background color is controlled by environment variables COLOR_NORMAL, COLOR_HIGHLIGHT, MENU_COLOR_NORMAL,M_COLOR_HIGHLIGHT. *Note Special environment variables::.

4.3.5 background_image

background_image [[‘–mode’ ‘stretch’|’normal’] file]

Load background image for active terminal from FILE. Image is stretched to fill up entire screen unless option ‘–mode’ ‘normal’ is given. Without arguments remove currently loaded background image. Background image can be changed only when using ‘gfxterm’ for terminal output.

4.3.6 badram

badram addr,mask[,addr,mask…] 

Filter out bad RAM.

This command notifies the memory manager that specified regions of RAM ought to be filtered out (usually, because they’re damaged). This remains in effect after a payload kernel has been loaded by GRUB, as long as the loaded kernel obtains its memory map from GRUB. Kernels that
support this include Linux, GNU Mach, the kernel of FreeBSD and Multiboot kernels in general.

Syntax is the same as provided by the Memtest86+ utility ( a list of address/mask pairs. Given a page-aligned address and a base address / mask pair, if all the bits of
the page-aligned address that are enabled by the mask match with the base address, it means this page is to be filtered. This syntax makes it easy to represent patterns that are often result of memory damage,
due to physical distribution of memory cells.

4.3.7 blocklist

blocklist file Print a block list for FILE.

4.3.8 boot


Boot the OS or chain-loader which has been loaded. Only necessary if running the fully interactive command-line (it is implicit at the end of a menu entry).

4.3.9 cat

  cat [‘–dos’] file

Display the contents of the file FILE. This command may be useful to remind you of your OS’s root partition:

grub> cat /etc/fstab

If the ‘–dos’ option is used, then carriage return / new line pairs will be displayed as a simple new line. Otherwise, the carriage return will be displayed as a control character (‘<d>’) to
make it easier to see when boot problems are caused by a file formatted using DOS-style line endings.

4.3.10 chainloader

  chainloader [‘–force’] file

Load FILE as a chain-loader. Like any other file loaded by the filesystem code, it can use the blocklist notation to grab the first sector of the current partition with ‘+1’. If you specify the option ‘–force’, then load FILE
forcibly, whether it has a correct signature or not. This is required when you want to load a defective boot loader, such as SCO UnixWare 7.1.

4.3.11 clear

   clear Clear the screen.

4.3.12 cmosclean

  cmosclean byte:bit

Clear value of bit in CMOS at location BYTE:BIT. This command is available only on platforms that support CMOS.

4.3.13 cmosdump

Dump: CMOS contents

Dump full CMOS contents as hexadecimal values. This command is available only on platforms that support CMOS.

4.3.14 cmostest

 cmostest byte:bit

Test value of bit in CMOS at location BYTE:BIT. Exit status is zero if bit is set, non zero otherwise. This command is available only on platforms that support CMOS.

4.3.15 cmp

  cmp file1 file2

Compare the file FILE1 with the file FILE2. If they differ in size, print the sizes like this:

Differ in size: 0x1234 [foo], 0x4321 [bar]

If the sizes are equal but the bytes at an offset differ, then print the bytes like this:

Differ at the offset 777: 0xbe [foo], 0xef [bar]

If they are completely identical, nothing will be printed.

4.3.16 configfile

configfile file

Load FILE as a configuration file. If FILE defines any menu entries, then show a menu containing them immediately. Any environment variable changes made by the commands in FILE will not be preserved after ‘configfile’ returns.

4.3.17 cpuid

cpuid [-l]

Check for CPU features. This command is only available on x86 systems.

With the ‘-l’ option, return true if the CPU supports long mode (64-bit).

If invoked without options, this command currently behaves as if it had been invoked with ‘-l’. This may change in the future.

4.3.18 crc

crc arg ...

Alias for ‘hashsum –hash crc32 arg …’. See command ‘hashsum’ for full description.

4.3.19 cryptomount

cryptomount device|’-u’ uuid|’-a’|’-b’

Setup access to encrypted device. If necessary, passphrase is requested interactively. Option DEVICE configures specific grub device (*note Naming convention::); option ‘-u’ UUID configures device with specified UUID; option ‘-a’ configures all detected encrypted devices; option ‘-b’ configures all geli containers that have boot flag set.

GRUB suports devices encrypted using LUKS and geli. Note that necessary modules (LUKS and GELI) have to be loaded manually before this command can be used.

4.3.20 date

date [[year-]month-day] [hour:minute[:second]]

With no arguments, print the current date and time.

Otherwise, take the current date and time, change any elements specified as arguments, and set the result as the new date andtime. For example, ‘date 01-01’ will set the current month and day to January 1, but leave the year, hour, minute, and second unchanged.

4.3.21 linux

devicetree file

Load a device tree blob (.dtb) from a filesystem, for later use by a Linux kernel. Does not perform merging with any device tree supplied by firmware, but rather replaces it completely.

4.3.22 distrust

distrust pubkey_id

Remove public key PUBKEY_ID from GRUB’s keyring of trusted keys. PUBKEY_ID is the last four bytes (eight hexadecimal digits) of the GPG v4 key id, which is also the output of ‘list_trusted’. Outside of GRUB, the key id can be obtained using ‘gpg –fingerprint’).  These keys are used to validate signatures when environment variable ‘check_signatures’ is set to ‘enforce’, and by some invocations of ‘verify_detached’

4.3.23 drivemap

drivemap ‘-l’|’-r’|[‘-s’] from_drive to_drive

Without options, map the drive FROM_DRIVE to the drive TO_DRIVE. This is necessary when you chain-load some operating systems, such as DOS, if such an OS resides at a non-first drive. For convenience, any partition suffix on the drive is ignored, so you can safely use ${root} as a drive specification.

With the ‘-s’ option, perform the reverse mapping as well, swapping the two drives.

With the ‘-l’ option, list the current mappings.

With the ‘-r’ option, reset all mappings to the default values.

For example:

drivemap -s (hd0) (hd1)

4.3.24 echo

echo [‘-n’] [‘-e’] string …

Display the requested text and, unless the ‘-n’ option is used, a trailing new line. If there is more than one string, they are separated by spaces in the output. As usual in GRUB commands, variables may be substituted using ‘${var}’.

The ‘-e’ option enables interpretation of backslash escapes. The following sequences are recognised:

  • ‘\\’ backslash
  • ‘\a’ alert (BEL)
  • ‘\c’ suppress trailing new line
  • ‘\f’ form feed
  • ‘\n’ new line
  • ‘\r’ carriage return
  • ‘\t’ horizontal tab
  • ‘\v’ vertical tab

When interpreting backslash escapes, backslash followed by any other character will print that character.

4.3.25 eval

  eval string …

Concatenate arguments together using single space as separator and evaluate result as sequence of GRUB commands.

4.3.26 export

export envvar

Export the environment variable ENVVAR. Exported variables are visible to subsidiary configuration files loaded using ‘configfile’.

4.3.27 false


Do nothing, unsuccessfully. This is mainly useful in control constructs such as ‘if’ and ‘while’ (*note Shell-like scripting::).

4.3.28 gettext

gettext string

Translate STRING into the current language.

The current language code is stored in the ‘lang’ variable in GRUB’s environment (*note lang::). Translation files in MO format are read from ‘locale_dir’ (*note locale_dir::), usually ‘/boot/grub2/locale’.

4.3.29 gptsync

gptsync device [partition[+/-[type]]] …

Disks using the GUID Partition Table (GPT) also have a legacy Master Boot Record (MBR) partition table for compatibility with the BIOS and with older operating systems. The legacy MBR can onlyrepresent a limited subset of GPT partition entries.

This command populates the legacy MBR with the specified PARTITION entries on DEVICE. Up to three partitions may be used.

TYPE is an MBR partition type code; prefix with ‘0x’ if you want to enter this in hexadecimal. The separator between PARTITION and TYPE may be ‘+’ to make the partition active, or ‘-‘ to make it inactive; only one partition may be active. If both the separator and type are omitted, then the partition will be inactive.

4.3.30 halt

halt ‘–no-apm’

The command halts the computer. If the ‘–no-apm’ option is specified, no APM BIOS call is performed. Otherwise, the computer is shut down using APM.

4.3.31 hashsum

hashsum ‘–hash’ hash ‘–keep-going’ ‘–uncompress’ ‘–check’ file [‘–prefix’ dir]|file …

Compute or verify file hashes. Hash type is selected with option ‘–hash’. Supported hashes are: ‘adler32’, ‘crc64’, ‘crc32′,’crc32rfc1510’, ‘crc24rfc2440’, ‘md4’, ‘md5’, ‘ripemd160’, ‘sha1’,‘sha224’, ‘sha256’, ‘sha512’, ‘sha384’, ‘tiger192’, ‘tiger’,’tiger2′, ‘whirlpool’. Option ‘–uncompress’ uncompresses files before computing hash.

When list of files is given, hash of each file is computed and printed, followed by file name, each file on a new line.

When option ‘–check’ is given, it points to a file that contains list of HASH NAME pairs in the same format as used by UNIX ‘md5sum’ command. Option ‘–prefix’ may be used to give directory where files are located. Hash verification stops after the first mismatch was found unless option ‘–keep-going’ was given. The exit code ‘$?’ is set to 0 if hash verification is successful. If it fails, ‘$?’ is set to a nonzero value.

4.3.32 help

 help [pattern …]

Display helpful information about builtin commands. If you do not specify PATTERN, this command shows short descriptions of all available commands.
If you specify any PATTERNS, it displays longer information about each of the commands whose names begin with those PATTERNS.

4.3.33 initrd

initrd file

Load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory. This may only be used after the ‘linux’ command (*note linux::) has been run.

4.3.34 initrd16

initrd16 file

Load an initial ramdisk for a Linux kernel image to be booted in 16-bit mode, and set the appropriate parameters in the Linux setup area in memory. This may only be used after the ‘linux16’ command has been run.

This command is only available on x86 systems.

4.3.35 insmod

  insmod module

Insert the dynamic GRUB module called MODULE.

4.3.36 keystatus

  keystatus [‘–shift’] [‘–ctrl’] [‘–alt’]

Return true if the Shift, Control, or Alt modifier keys are held down, as requested by options. This is useful in scripting, to allow some user control over behaviour without having to wait for a keypress.

Checking key modifier status is only supported on some platforms.If invoked without any options, the ‘keystatus’ command returns true if and only if checking key modifier status is supported.

4.3.37 linux

linux file …

Load a Linux kernel image from FILE. The rest of the line is passed verbatim as the “kernel command-line”. Any initrd must be reloaded after using this command.

On x86 systems, the kernel will be booted using the 32-bit boot protocol. Note that this means that the ‘vga=’ boot option will not work; if you want to set a special video mode, you will need to use GRUB commands such as ‘set gfxpayload=1024×768’ or ‘set gfxpayload=keep’ (to keep the same mode as used in GRUB) instead. GRUB can automatically detect some uses of ‘vga=’ and translate
them to appropriate settings of ‘gfxpayload’. The ‘linux16’ command (*note linux16::) avoids this restriction.

4.3.38 linux16

linux16 file …

Load a Linux kernel image from FILE in 16-bit mode. The rest of the line is passed verbatim as the “kernel command-line”. Any initrd must be reloaded after using this command.

The kernel will be booted using the traditional 16-bit boot protocol. As well as bypassing problems with ‘vga=’ described in, this permits booting some other programs that implement the Linux boot protocol for the sake of convenience.
This command is only available on x86 systems.

4.3.39 list_env

list_env [‘–file’ file]

List all variables in the environment block file. The ‘–file’ option overrides the default location of the environment block.

4.3.40 list_trusted


List all public keys trusted by GRUB for validating signatures.The output is in GPG’s v4 key fingerprint format (i.e., the output of ‘gpg –fingerprint’). The least significant four bytes (last eight hexadecimal digits) can be used as an argument to ‘distrust’. , for more information about uses for these keys.

4.3.41 load_env

load_env [‘–file’ file] [‘–skip-sig’][whitelisted_variable_name] …

Load all variables from the environment block file into the environment.

The ‘–file’ option overrides the default location of the environment block.

The ‘–skip-sig’ option skips signature checking even when the value of environment variable ‘check_signatures’ is set to ‘enforce’ (*note check_signatures::).

If one or more variable names are provided as arguments, they are interpreted as a whitelist of variables to load from the environment block file. Variables set in the file but not present
in the whitelist are ignored.

The ‘–skip-sig’ option should be used with care, and should always be used in concert with a whitelist of acceptable variables whose values should be set. Failure to employ a carefully constructed whitelist could result in reading a malicious value into critical environment variables from the file, such as setting ‘check_signatures=no’, modifying ‘prefix’ to boot from an unexpected location or not at all, etc.

When used with care, ‘–skip-sig’ and the whitelist enable an administrator to configure a system to boot only signed configurations, but to allow the user to select from among multiple configurations, and to enable “one-shot” boot attempts and “savedefault” behavior.

4.3.42 loadfont

loadfont file …

Load specified font files. Unless absolute pathname is given, FILE is assumed to be in directory ‘$prefix/fonts’ with suffix ‘.pf2’ appended.

4.3.43 loopback

loopback [‘-d’] device file

Make the device named DEVICE correspond to the contents of the filesystem image in FILE. For example:

loopback loop0 /path/to/image
ls (loop0)/

With the ‘-d’ option, delete a device previously created using this command.

4.3.44 ls

ls [arg …]

List devices or files.With no arguments, print all devices known to GRUB.

If the argument is a device name enclosed in parentheses, then print the name of the filesystem of that device.

If the argument is a directory given as an absolute file name, then list the contents of that directory.

4.3.45 lsfonts


List loaded fonts.

4.3.46 lsmod


Show list of loaded modules.

4.3.47 md5sum

md5sum arg …

Alias for ‘hashsum –hash md5 arg …’. See command ‘hashsum’

4.3.48 module

module [–nounzip] file [arguments]

Load a module for multiboot kernel image. The rest of the line is passed verbatim as the module command line.

4.3.49 multiboot

multiboot [–quirk-bad-kludge][–quirk-modules-after-kernel] file …

Load a multiboot kernel image from FILE. The rest of the line is passed verbatim as the “kernel command-line”. Any module must be reloaded after using this command (*note module::).

Some kernels have known problems. You need to specify -quirk-* for those. -quirk-bad-kludge is a problem seen in several products that they include loading kludge information with invalid data in
ELF file. GRUB prior to 0.97 and some custom builds prefered ELF information while 0.97 and GRUB 2 use kludge. Use this option to ignore kludge. Known affected systems: old Solaris, SkyOS.

-quirk-modules-after-kernel is needed for kernels which load at relatively high address e.g. 16MiB mark and can’t cope with modules stuffed between 1MiB mark and beginning of the kernel.
Known afftected systems: VMWare.

4.3.50 nativedisk


Switch from firmware disk drivers to native ones. Really useful only on platforms where both firmware and native disk drives are available. Currently i386-pc, i386-efi, i386-ieee1275 and x86_64-efi.

4.3.51 normal

normal [file]

Enter normal mode and display the GRUB menu.

In normal mode, commands, filesystem modules, and cryptography modules are automatically loaded, and the full GRUB script parser is available. Other modules may be explicitly loaded using ‘insmod’.

If a FILE is given, then commands will be read from that file. Otherwise, they will be read from ‘$prefix/grub.cfg’ if it exists.

‘normal’ may be called from within normal mode, creating a nested environment. It is more usual to use ‘configfile’

4.3.52 normal_exit


Exit normal mode. If this instance of normal mode was not nested within another one, then return to rescue mode.

4.3.53 parttool

parttool partition

commands Make various modifications to partition table entries. Each COMMAND is either a boolean option, in which case it must be followed with ‘+’ or ‘-‘ (with no intervening space) to enable or disable that option, or else it takes a value in the form ‘COMMAND=VALUE’.

Currently, ‘parttool’ is only useful on DOS partition tables (also known as Master Boot Record, or MBR). On these partition tables, the following commands are available:

‘boot’ (boolean) – When enabled, this makes the selected partition be the active (bootable) partition on its disk, clearing the active flag on all other partitions.

‘type’ (value) – Change the type of an existing partition. The value must be a number in the range 0-0xFF (prefix with ‘0x’ to enter it in hexadecimal).

‘hidden’ (boolean) – When enabled, this hides the selected partition by setting the “hidden” bit in its partition type code; when disabled,unhides the selected partition by clearing this bit. This is useful only when booting DOS or Wwindows and multiple primary FAT partitions exist in one disk.

4.3.54 password

password user clear-password

Define a user named USER with password CLEAR-PASSWORD.

4.3.55 password_pbkdf2

password_pbkdf2 user hashed-password

Define a user named USER with password hash HASHED-PASSWORD. Use’grub2-mkpasswd-pbkdf2′ to generate password hashes.

4.3.56 play

play file | tempo [pitch1 duration1] [pitch2 duration2] …

Plays a tune

If the argument is a file name (*note File name syntax::), play the tune recorded in it. The file format is first the tempo as an unsigned 32bit little-endian number, then pairs of unsigned 16bit little-endian numbers for pitch and duration pairs.

If the arguments are a series of numbers, play the inline tune.

The tempo is the base for all note durations. 60 gives a 1-second base, 120 gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce a rest.

4.3.57 probe

probe [‘–set’ var]’–driver’|’–partmap’|’–fs’|’–fs-uuid’|’–label’ device

Retrieve device information. If option ‘–set’ is given, assign result to variable VAR, otherwise print information on the screen.

4.3.58 pxe_unload


Unload the PXE environment, This command is only available on PC BIOS systems.

4.3.59 read

read [var]

Read a line of input from the user. If an environment variable VAR is given, set that environment variable to the line of input thatas read, with no terminating newline.

4.3.60 reboot


Reboot the computer.

4.3.61 regexp

regexp [‘–set’ [number:]var] regexp string

Test if regular expression REGEXP matches STRING. Supported regular expressions are POSIX.2 Extended Regular Expressions. If option ‘–set’ is given, store NUMBERth matched subexpression in variable VAR. Subexpressions are numbered in order of their opening parentheses starting from ‘1’. NUMBER defaults to ‘1’.

4.3.62 rmmod

rmmod module

Remove a loaded MODULE.

4.3.63 save_env

save_env [‘–file’ file] var …

Save the named variables from the environment to the environment block file. *Note Environment block::.

The ‘–file’ option overrides the default location of the environment block.

This command will operate successfully even when environment variable ‘check_signatures’ is set to ‘enforce’, since it writes to disk and does not alter the behavior of GRUB based on any contents of disk that have been read.

It is possible to modify a digitally signed environment block file from within GRUB using this command, such that its signature will no longer be valid on subsequent boots. Care should be taken in such advanced configurations to avoid rendering the system unbootable.

4.3.64 search

search [‘–file’|’–label’|’–fs-uuid’] [‘–set’ [var]][‘–no-floppy’] name

Search devices by file (‘-f’, ‘–file’), filesystem label (‘-l’,’–label’), or filesystem UUID (‘-u’, ‘–fs-uuid’).

If the ‘–set’ option is used, the first device found is set as the value of environment variable VAR. The default variable is ‘root’.

The ‘–no-floppy’ option prevents searching floppy devices, which can be slow.

The ‘search.file’, ‘search.fs_label’, and ‘search.fs_uuid’ commands are aliases for ‘search –file’, ‘search –label’, and ‘search –fs-uuid’ respectively.

4.3.65 sendkey

sendkey [‘–num’|’–caps’|’–scroll’|’–insert’|’–pause’|’–left-shift’|’–right-shift’|’–sysrq’|’–numkey’|’–capskey’|’–scrollkey’|’–insertkey’|’–left-alt’|’–right-alt’|’–left-ctrl’|’–right-ctrl’ ‘on’|’off’]… [‘no-led’] keystroke

Insert keystrokes into the keyboard buffer when booting. Sometimes an operating system or chainloaded boot loader requires particular keys to be pressed: for example, one might need to press a particular key to enter “safe mode”, or when chainloading another boot loader one might send keystrokes to it to navigate its menu. You may provide up to 16 keystrokes (the length of the BIOS keyboard buffer). Keystroke names may be upper-case or lower-case letters, digits, or taken from the following table:


As well as keystrokes, the ‘sendkey’ command takes various options that affect the BIOS keyboard status flags. These options take an ‘on’ or ‘off’ parameter, specifying that the corresponding status flag be set or unset; omitting the option for a given status flag will leave that flag at its initial state at boot. The ‘–num’, ‘–caps’, ‘–scroll’, and ‘–insert’ options emulate setting the corresponding mode, while the ‘–numkey’, ‘–capskey’,’–scrollkey’, and ‘–insertkey’ options emulate pressing and holding the corresponding key. The other status flag options are self-explanatory.

If the ‘–no-led’ option is given, the status flag options will have no effect on keyboard LEDs.

If the ‘sendkey’ command is given multiple times, then only the last invocation has any effect.

Since ‘sendkey’ manipulates the BIOS keyboard buffer, it may cause hangs, reboots, or other misbehaviour on some systems. If the operating system or boot loader that runs after GRUB uses its own keyboard driver rather than the BIOS keyboard functions, then ‘sendkey’ will have no effect.

This command is only available on PC BIOS systems.

4.3.66 set

set [envvar=value]

Set the environment variable ENVVAR to VALUE. If invoked with no arguments, print all environment variables with their values.

4.3.67 sha1sum

sha1sum arg …

alias for ‘hashsum –hash sha1 arg …’. See command ‘hashsum’

4.3.68 sha256sum

sha256sum arg …

Alias for ‘hashsum –hash sha256 arg …’. See command ‘hashsum’

4.3.69 sha512sum

sha512sum arg …

Alias for ‘hashsum –hash sha512 arg …’. See command ‘hashsum’

4.3.70 sleep

sleep [‘–verbose’] [‘–interruptible’] count

Sleep for COUNT seconds. If option ‘–interruptible’ is given, allow <ESC> to interrupt sleep. With ‘–verbose’ show countdown of remaining seconds. Exit code is set to 0 if timeout expired and to 1 if timeout was interrupted by <ESC>.

4.3.71 source

source file

Read FILE as a configuration file, as if its contents had beenincorporated directly into the sourcing file. Unlike ‘configfile’ any environment variable changes made by the commands in FILE will be preserved after ‘source’ returns, and the menu will not be shown immediately.

4.3.72 test

test expression

Evaluate EXPRESSION and return zero exit status if result is true,non zero status otherwise.

EXPRESSION is one of:

the strings are equal
the strings are not equal
STRING1 is lexicographically less than STRING2
STRING1 is lexicographically less or equal than STRING2
STRING1 is lexicographically greater than STRING2
STRING1 is lexicographically greater or equal than STRING2
INTEGER1 is equal to INTEGER2
INTEGER1 is greater than or equal to INTEGER2
INTEGER1 is greater than INTEGER2
INTEGER1 is less than or equal to INTEGER2
INTEGER1 is less than INTEGER2
INTEGER1 is not equal to INTEGER2
INTEGER1 is greater than INTEGER2 after stripping off common non-numeric PREFIX.
INTEGER1 is less than INTEGER2 after stripping off common non-numeric PREFIX.
FILE1 ‘-nt’ FILE2
FILE1 is newer than FILE2 (modification time). Optionally numeric BIAS may be directly appended to ‘-nt’ in which case it is added to the first file modification time.
FILE1 ‘-ot’ FILE2
FILE1 is older than FILE2 (modification time). Optionally numeric BIAS may be directly appended to ‘-ot’ in which case it is added to the first file modification time.
‘-d’ FILE
FILE exists and is a directory
‘-e’ FILE
FILE exists
‘-f’ FILE
FILE exists and is not a directory
‘-s’ FILE
FILE exists and has a size greater than zero
the length of STRING is nonzero
STRING is equivalent to ‘-n STRING’
the length of STRING is zero
both EXPRESSION1 and EXPRESSION2 are true
either EXPRESSION1 or EXPRESSION2 is true

4.3.73 true


Do nothing, successfully. This is mainly useful in control constructs such as ‘if’ and ‘while’ .

4.3.74 trust

trust [‘–skip-sig’] pubkey_file

Read public key from PUBKEY_FILE and add it to GRUB’s internal list of trusted public keys. These keys are used to validate digital signatures when environment variable ‘check_signatures’ is set to ‘enforce’. Note that if ‘check_signatures’ is set to ‘enforce’ when ‘trust’ executes, then PUBKEY_FILE must itself be properly signed. The ‘–skip-sig’ option can be used to disable
signature-checking when reading PUBKEY_FILE itself. It is expected that ‘–skip-sig’ is useful for testing and manual booting.

4.3.75 unset

unset envvar

Unset the environment variable ENVVAR.

4.3.76 uppermem

This command is not yet implemented for GRUB 2, although it is planned.

4.3.77 verify_detached

verify_detached [‘–skip-sig’] file signature_file [pubkey_file]

Verifies a GPG-style detached signature, where the signed file is FILE, and the signature itself is in file SIGNATURE_FILE. Optionally, a specific public key to use can be specified using PUBKEY_FILE. When environment variable ‘check_signatures’ is set to ‘enforce’, then PUBKEY_FILE must itself be properly signed by an already-trusted key. An unsigned PUBKEY_FILE can be loaded by specifying ‘–skip-sig’. If PUBKEY_FILE is omitted, then public keys from GRUB’s trusted keys are tried.

Exit code ‘$?’ is set to 0 if the signature validates successfully. If validation fails, it is set to a non-zero value.

4.3.78 videoinfo

videoinfo [[WxH]xD]

List available video modes. If resolution is given, show only matching modes.

4.4 The list of networking commands

4.4.1 net_add_addr


Configure additional network INTERFACE with ADDRESS on a network CARD. ADDRESS can be either IP in dotted decimal notation, or symbolic name which is resolved using DNS lookup. If successful, this command also adds local link routing entry to the default subnet of ADDRESS with name INTERFACE’:local’ via INTERFACE.

4.4.2 net_add_dns

net_add_dns SERVER

Resolve SERVER IP address and add to the list of DNS servers used during name lookup.

4.4.3 net_add_route


Add route to network with address IP as modified by PREFIX via either local INTERFACE or GATEWAY. PREFIX is optional and defaults to 32 for IPv4 address and 128 for IPv6 address. Route is identified by SHORTNAME which can be used to remove it.

4.4.4 net_bootp

net_bootp [CARD]

Perform configuration of CARD using DHCP protocol. If no card name is specified, try to configure all existing cards. If configuration was successful, interface with name CARD’:dhcp’ and configured address is added to CARD. If server provided gateway information in DHCP ACK packet, it is added as route entry with the name CARD’:dhcp:gw’. Additionally the following DHCP options are recognized and processed:

‘1 (Subnet Mask)’  Used to calculate network local routing entry for interface CARD’:dhcp’.
‘3 (Router)’                 Adds default route entry with the name CARD’:dhcp:default’ via gateway from DHCP option. Note that only option with single route is accepted.
‘6 (Domain Name Server)’  Adds all servers from option value to the list of servers used during name resolution.
’12 (Host Name)’                 Sets environment variable ‘net_'<CARD>’_dhcp_hostname’ to the value of option.
’15 (Domain Name)’            Sets environment variable ‘net_'<CARD>’_dhcp_domain’ to the value of option.
’17 (Root Path)’                  Sets environment variable ‘net_'<CARD>’_dhcp_rootpath’ to the value of option.
’18 (Extensions Path)’ Sets environment variable ‘net_'<CARD>’_dhcp_extensionspath’ to the value of option.

4.4.5 net_del_addr

net_del_addr INTERFACE

Remove configured INTERFACE with associated address.

4.4.6 net_del_dns

 net_del_dns ADDRESS

Remove ADDRESS from list of servers used during name lookup.

4.4.7 net_del_route

net_del_route SHORTNAME

Remove route entry identified by SHORTNAME.

4.4.8 net_get_dhcp_option

net_get_dhcp_option VAR INTERFACE NUMBER TYPE

Request DHCP option NUMBER of TYPE via INTERFACE. TYPE can be one of ‘string’, ‘number’ or ‘hex’. If option is found, assign its value to variable VAR. Values of types ‘number’ and ‘hex’ are converted to string representation.

4.4.9 net_ipv6_autoconf

net_ipv6_autoconf [CARD]

Perform IPv6 autoconfiguration by adding to the CARD interface with name CARD’:link’ and link local MAC-based address. If no card is specified, perform autoconfiguration for all existing cards.

4.4.10 net_ls_addr


List all configured interfaces with their MAC and IP addresses.

4.4.11 net_ls_cards


List all detected network cards with their MAC address.

4.4.12 net_ls_dns


List addresses of DNS servers used during name lookup.

4.4.13 net_ls_routes


List routing entries.

4.4.14 net_nslookup

net_nslookup NAME [SERVER]

Resolve address of NAME using DNS server SERVER. If no server is given, use default list of servers.



I have started ( aka in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' You can connect me at -

1 Response

  1. October 6, 2015

    […] Mastering GrUB – Part 4 – Grub Configuration Syntax and Commands […]

What is in your mind, about this post ? Leave a Reply

  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us