The UEFI Shell is a command-line environment that runs inside UEFI firmware, before any operating system is loaded. It lets an administrator browse file systems, inspect devices and memory, edit firmware variables, run EFI applications and execute scripts, all in the pre-boot environment. In the Boot & firmware stage of operating systems, it plays the role that a recovery console or terminal plays after boot.
The shell is itself an EFI application, usually a file named Shell.efi or BOOTX64.EFI, defined by the UEFI Shell Specification and implemented in the open-source TianoCore EDK II project. Some motherboards embed it in firmware, while others require it to be launched from a USB drive or the EFI system partition.
How the UEFI Shell runs in the pre-boot environment
The UEFI Shell runs as a regular UEFI application on top of Boot Services, the firmware interfaces available before an operating system calls ExitBootServices(). It uses firmware protocols for console input and output, block devices, the simple file system and the network, so it needs no drivers of its own for hardware that the firmware already supports.
At startup the shell builds a mapping table that assigns names to devices: fs0:, fs1: for FAT-formatted file systems the firmware can read, and blk0:, blk1: for raw block devices. Commands then address files with paths such as fs0:\EFI\BOOT. If a file named startup.nsh exists on a mapped file system, the shell runs it automatically after a short countdown, usually five seconds.
The table below lists the shell concepts that differ most from an ordinary operating system terminal.
| Concept | Meaning | Example |
|---|---|---|
| Mapping | Short name for a device or file system | fs0:, blk2: |
| Startup script | Script run automatically at shell launch | startup.nsh |
| Script file | Batch file with the .nsh extension | update.nsh |
| EFI application | Executable in PE/COFF format | bootmgfw.efi, grubx64.efi |
| Device handle | Firmware object representing a device | Listed by the dh command |
| UEFI variable | Persistent setting stored in NVRAM | BootOrder, Boot0001 |
Essential UEFI Shell commands
UEFI Shell commands combine familiar file operations with firmware-specific tools. File commands resemble those of DOS and Unix, while others expose information that is normally hidden from the user, such as driver bindings and boot variables.
The following table groups the commands that administrators use most often.
| Command | Purpose | Typical use |
|---|---|---|
map -r | Rebuilds device mappings | Detect a newly inserted USB drive |
ls, cd, cp | Browses and copies files | Inspect the EFI system partition |
bcfg boot | Lists or edits boot entries | Add or reorder a boot option |
dmpstore | Dumps UEFI variables | Back up or examine NVRAM settings |
devices, drivers, dh | Shows devices and driver bindings | Diagnose a disk the firmware cannot see |
memmap | Prints the firmware memory map | Investigate memory reservation issues |
edit, hexedit | Edits text or binary files | Correct a configuration file |
reset | Restarts or powers off the system | Reboot after a firmware change |
Command availability depends on the shell support level defined by the specification. A minimal embedded shell may lack edit or network commands, so administrators often carry a full-featured shell binary on removable media.
UEFI Shell compared with other pre-boot tools
The UEFI Shell is one of several pre-boot interfaces, and each serves a different purpose. The BIOS setup utility changes settings through menus, the boot menu selects a single device, and a bootloader such as GRUB starts an operating system. The shell is the only one that offers scriptable, general-purpose access to firmware services.
The comparison below shows where each tool fits.
| Tool | Interface | Main purpose | Scriptable |
|---|---|---|---|
| UEFI Shell | Command line | Diagnostics, file and variable tasks | Yes, with .nsh scripts |
| BIOS setup utility | Menus | Firmware configuration | No |
| Boot menu | Single list | One-time boot device choice | No |
| GRUB command line | Command line | Loading an OS kernel | Yes, with GRUB scripts |
| Legacy DOS boot disk | Command line | BIOS-era flashing and repair | Yes, with batch files |
Practical uses of the UEFI Shell
The UEFI Shell is most valuable when the operating system cannot start or when a task must happen below the operating system. Typical uses include repairing boot entries, running vendor firmware update tools, testing hardware in manufacturing and starting an operating system loader manually.
- Recovering a lost boot entry by running
bcfg boot addwith the path to the OS loader. - Flashing firmware for motherboards, RAID controllers or network adapters with vendor EFI tools.
- Starting a loader by hand, for example
fs0:\EFI\ubuntu\grubx64.efi, to confirm it works. - Automating factory tests and burn-in with startup scripts on production lines.
- Inspecting the EFI system partition when partition contents are suspected to be damaged.
Many systems no longer show a shell option in their menus. In that case the shell binary can be placed at \EFI\BOOT\BOOTX64.EFI on a FAT32-formatted USB drive, which the firmware treats as removable boot media.
Security risks and limitations
Because the UEFI Shell has unrestricted access to firmware services, it is a powerful attack tool. Anyone with physical access can read disks that are not encrypted, change boot order or modify UEFI variables. With Secure Boot enabled, an unsigned shell binary will not run, and many vendors no longer ship a signed shell for that reason.
The shell also has functional limits: it reads only file systems the firmware supports, usually FAT12, FAT16 and FAT32, so NTFS, ext4 or APFS volumes appear only as raw block devices unless extra drivers are loaded.
The table below pairs common problems with their causes and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Shell refuses to start | Secure Boot blocks an unsigned binary | Use a signed tool or disable Secure Boot temporarily |
| Disk not listed as fs0: | File system is not FAT | Load a file system driver or use FAT32 media |
| New USB drive not visible | Mappings are stale | Run map -r |
| Boot entry change ignored | Firmware rewrites BootOrder | Set the order in setup or update firmware |
| Shell starts unexpectedly | No valid OS loader was found | Repair the EFI system partition |
Put simply
The UEFI Shell is a small text-based control panel built into modern computers. It works before Windows, macOS or Linux starts, at the point when only the motherboard firmware is running.
Think of it as a mechanic’s toolbox for the moments before startup. If the computer cannot find its operating system, a technician can open the shell, look at the disks, fix the list of startup options or update the firmware, and then restart the machine normally.
In practice
A system administrator replaces the system drive of a Linux workstation by cloning it to a larger NVMe SSD. After the swap, the firmware reports that no bootable device was found, because the UEFI boot entry still points to the old disk. The machine has no operating system available to repair itself.
The administrator boots a USB drive containing the UEFI Shell, runs map -r and finds the EFI system partition on fs1:. Running bcfg boot dump confirms the stale entry, and bcfg boot add 0 fs1:\EFI\debian\shimx64.efi "Debian" creates a new one at the top of the boot order. After reset, the workstation boots normally within two minutes, without reinstalling the bootloader or the operating system.