The newer generation UEFI motherboards come with UEFI Interactive Shell. The UEFI interactive shell is a simple shell program (like bash) responsible for booting your operating system. You can also use the UEFI interactive shell to run EFI shell commands and scripts. It can be used to update the System Firmware of your motherboard as well.

This article will show you how to access the UEFI interactive shell on UEFI motherboards and use some of the common EFI commands on the UEFI interactive shell. So, let’s get started.

Table of Contents:

  1. Things You Need to Know
  2. Reading USB Thumb Drives from UEFI Shell
  3. Starting the UEFI Interactive Shell
  4. The cls Command
  5. The echo Command
  6. The alias Command
  7. The help Command
  8. The set Command
  9. The map Command
  10. The cd and ls Commands
  11. The cp Command
  12. The mv Command
  13. The rm Command
  14. The edit Command
  15. The exit Command
  16. The reset Command
  17. Other EFI Shell Commands
  18. Output Redirection
  19. Conclusion
  20. References

Things You Need to Know:

I have used 2 different prompts to write the EFI Shell commands in this article.

Shell> – I have used this prompt for the commands that you can run from anywhere.

fs1:*> – I have used this prompt to clarify that you need to select a certain storage device (fs1 in this case) or be in a specific directory before running the commands.

Make sure you keep that in mind while you read this article.

Reading USB Thumb Drives from UEFI Shell:

The UEFI interactive shell can read USB thumb drives if you format it as FAT16 or FAT32. So, suppose you have written some EFI scripts or downloaded any EFI scripts from the official website of your motherboard manufacturer. In that case, you will have to put them in a FAT16 or FAT32 formatted USB thumb drive to access and run them from the UEFI interactive shell.

Starting the UEFI Interactive Shell:

First, shut down your computer. Then, power on your computer. Just after pressing the power button, keep pressing the or key of your keyboard to enter the BIOS/UEFI Firmware of your motherboard.

Then, in the boot selection section of the BIOS/UEFI Firmware of your motherboard, you should find an option to enter the UEFI Interactive Shell.

On my Odyssey X86 single-board computer, the option is in the Save & Exit > UEFI: Built-in EFI Shell, as you can see in the image below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image77.png" data-lazy- height="559" src="data:image/svg xml,” width=”972″>

The option is EFI Internal Shell on my VMware virtual machine, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image79.png" data-lazy- height="478" src="data:image/svg xml,” width=”667″>

When you enter the UEFI Interactive Shell for the first time, it will print all the storage devices that your computer detected, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image78.png" data-lazy- height="437" src="data:image/svg xml,” width=”690″>

Once you press any key other than or wait for 5 seconds, the EFI Shell should be ready to execute commands.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image81.png" data-lazy- height="490" src="data:image/svg xml,” width=”776″>

In the next sections, I will show you how to use some of the most common EFI Shell commands. So, let’s move on.

The cls Command:

cls command is mainly used to clear the outputs of the screen.

You may have many texts on the screen, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image80.png" data-lazy- height="505" src="data:image/svg xml,” width=”746″>

To clear the texts of the screen, run the cls command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image84.png" data-lazy- height="463" src="data:image/svg xml,” width=”713″>

The texts on your screen should be cleared.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image82.png" data-lazy- height="481" src="data:image/svg xml,” width=”727″>

You can also change the background color of the EFI Shell using the cls command.

To change the background color of EFI Shell, run the cls command as follows:

At the time of this writing, the cls command supports the following .

0 – Black

1 – Blue

2 – Green

3 – Cyan

4 – Red

5 – Magenta

6 – Yellow

7 – Light Gray

For example, to change the background color to Blue (1), run the cls command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image88.png" height="29" src="data:image/svg xml,” width=”110″>

The background color should be changed to Blue (1), as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image86.png" data-lazy- height="447" src="data:image/svg xml,” width=”685″>

To change the background color to black, run the cls command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image93.png" height="43" src="data:image/svg xml,” width=”115″>

The background color should be changed to Black (0), as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image90.png" data-lazy- height="228" src="data:image/svg xml,” width=”539″>

The echo Command:

The echo command is used to print a line of text on the EFI Shell.

For example, to print the text Hello World, run the echo command as follows:

Shell> echo “Hello World”

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image92.png" height="33" src="data:image/svg xml,” width=”221″>

As you can see, the text Hello World is printed on the EFI Shell.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image95.png" height="109" src="data:image/svg xml,” width=”301″>

If you wish, you can choose not to use any quotes as well.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image96.png" height="93" src="data:image/svg xml,” width=”222″>

The alias Command:

You can list all the command aliases of the EFI Shell with the alias command.

To list all the command aliases of the EFI Shell, run the alias command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image97.png" height="36" src="data:image/svg xml,” width=”115″>

As you can see, all the EFI Shell command aliases are listed.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image98.png" data-lazy- height="217" src="data:image/svg xml,” width=”550″>

You can also use the alias command to create or delete aliases.

To create a command alias print_hello that runs the command echo Hello World, you can run the alias command as follows:

Shell> alias print_hello “echo Hello World”

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image99.png" data-lazy- height="31" src="data:image/svg xml,” width=”359″>

As you can see, a new alias print_hello is created.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image100.png" data-lazy- height="217" src="data:image/svg xml,” width=”702″>

Now, you can run the print_hello command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image101.png" data-lazy- height="90" src="data:image/svg xml,” width=”313″>

By default, the aliases you create will survive system reboots. That’s a good thing, of course. But if you don’t want your aliases to survive system reboots, you can create a volatile alias using the -v option.

You can create the same alias print_hello as a volatile alias using the -v option as follows:

Shell> alias -v print_hello “echo Hello World”

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image102.png" data-lazy- height="41" src="data:image/svg xml,” width=”383″>

You can delete an alias using the -d option of the alias command.

To delete the alias print_hello, run the alias command using the -d option as follows:

Shell> alias -d print_hello

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image67.png" height="29" src="data:image/svg xml,” width=”233″>

As you can see, the alias print_hello is removed from the alias list.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image68.png" data-lazy- height="200" src="data:image/svg xml,” width=”543″>

The help Command:

The help command is used to find EFI Shell commands using patterns.

For example, to find all the EFI Shell commands that start with m, you can run the help command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image69.png" height="28" src="data:image/svg xml,” width=”124″>

All the EFI Shell commands that start with m are listed, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image70.png" data-lazy- height="181" src="data:image/svg xml,” width=”620″>

In the same way, you can find all the EFI Shell commands that end with m as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image71.png" height="28" src="data:image/svg xml,” width=”125″>

All the EFI Shell commands that end with m are listed, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image72.png" data-lazy- height="127" src="data:image/svg xml,” width=”595″>

You can also learn how to use an EFI Shell command, what options they support, and what each option does use the help command. Finally, you can compare it to the Linux man command.

For example, to learn how to use the alias command, run the help command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image73.png" height="35" src="data:image/svg xml,” width=”158″>

A lot of information about the help command should be displayed.

If the help information of a certain command is very long, you can press the and keys of your keyboard to scroll up and down, respectively.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image74.png" data-lazy- height="520" src="data:image/svg xml,” width=”721″>

If the output is way too long, then you will need a pager to read it. Again, you can compare it to the Linux less program. But unlike the Linux less program, the EFI Shell pager scrolls page by page instead of lines.

To use a pager for the help command, use the -b option of the help command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image75.png" height="32" src="data:image/svg xml,” width=”174″>

The usage information of the alias command is displayed in a pager, as you can see in the screenshot below.

You can press to go to the next page.

To close the pager, press q and then press .

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image76.png" data-lazy- height="496" src="data:image/svg xml,” width=”661″>

The set Command:

The set command is used to list all the available environment variables of the EFI Shell.

To list all the available environment variables of the EFI Shell, run the set command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image13-15.png" height="26" src="data:image/svg xml,” width=”94″>

All the environment variables of the EFI Shell are listed, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image14-11.png" data-lazy- height="93" src="data:image/svg xml,” width=”520″>

You can also create your own EFI Shell environment variables.

To create an EFI Shell environment variable file with the content boot.img, run the set command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image15-9.png" height="38" src="data:image/svg xml,” width=”226″>

The environment variable file is set, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image16-7.png" data-lazy- height="115" src="data:image/svg xml,” width=”501″>

By default, the EFI Shell environment variables you create will survive system reboots. However, you can create volatile EFI Shell environment variables using the set command’s -v option if you don’t want that.

For example, to create the same file environment variable as a volatile environment variable, run the set command as follows:

Shell> set -v file image.boot

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image17-5.png" height="33" src="data:image/svg xml,” width=”249″>

You can remove EFI Shell environment variables as well.

To remove the EFI Shell environment variable file, run the set command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image18-4.png" data-lazy- height="27" src="data:image/svg xml,” width=”153″>

The file environment variable should no longer be available, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image19-3.png" data-lazy- height="95" src="data:image/svg xml,” width=”521″>

The map Command:

The map command prints the mapping table of all the storage devices of your computer. From the mapping table, you can find the device name of the storage devices of your computer. To access a storage device from the EFI Shell, you will need the device name of that storage device.

To list all the storage devices of your computer from the EFI Shell, run the map command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image20-1.png" height="30" src="data:image/svg xml,” width=”92″>

All the storage devices and their name should be listed, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image21-1.png" data-lazy- height="532" src="data:image/svg xml,” width=”768″>

If you insert a new storage device like a USB thumb drive on your computer, it won’t automatically be listed in the mapping table. Instead, you will have to refresh the mapping table manually.

You can refresh the mapping table of the EFI Shell using the -r option of the map command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image22-1.png" height="34" src="data:image/svg xml,” width=”119″>

The mapping table of the EFI Shell should be refreshed, and your new storage device should be listed in the new mapping table, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image1-57.png" data-lazy- height="448" src="data:image/svg xml,” width=”741″>

The cd and ls Commands:

You can select a storage device using the name of the storage device.

For example, to select the storage device fs1, you can run the following command:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image2-56.png" height="37" src="data:image/svg xml,” width=”110″>

The prompt should be changed to fs1:> as you can see in the screenshot below.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image3-57.png" height="99" src="data:image/svg xml,” width=”280″>

Now, you can list all the files and directories you have on the storage device fs1 (the current working directory) as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image4-55.png" height="39" src="data:image/svg xml,” width=”90″>

As you can see, all the files and directories of the storage device fs1 are listed.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image5-48.png" data-lazy- height="205" src="data:image/svg xml,” width=”474″>

You can also use relative directory paths with the ls command to list the files and directories of that directory.

For example, to list the files and directories of the scripts directory (relative to your current working directory), you can run the ls command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image6-44.png" data-lazy- height="32" src="data:image/svg xml,” width=”149″>

The files and directories of the scripts directory should be listed.

The scripts directory is empty in my case.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image7-36.png" data-lazy- height="225" src="data:image/svg xml,” width=”388″>

You can use absolute paths with the ls command as well.

For example, to list all the files and directories of the fs0 storage device, run the ls command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image8-30.png" height="34" src="data:image/svg xml,” width=”128″>

All the files and directories of the fs0 storage device should be listed, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image9-28.png" data-lazy- height="195" src="data:image/svg xml,” width=”434″>

You can list files and directories recursively using the -r option of the ls command.

For example, to list all the files and directories of the fs0 storage device recursively, run the ls command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image10-22.png" height="27" src="data:image/svg xml,” width=”146″>

All the files and directories of the fs0 storage device should be listed recursively, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image35-1.png" data-lazy- height="397" src="data:image/svg xml,” width=”457″>

If the file and directory listing is too long to fit on the screen, you can use the -b option of the ls command to use a pager.

You can list all the files and directories of the fs0 storage device recursively and use a pager for the output as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image36-1.png" height="31" src="data:image/svg xml,” width=”168″>

The ls command should use a pager to display the output, as shown in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image37-1.png" data-lazy- height="514" src="data:image/svg xml,” width=”561″>

You can use the cd command to navigate to a different directory of your selected storage device. This will make your commands shorter as you won’t have to type in long directory paths.

For example, to navigate to the scripts directory of the selected storage device fs1, you can run the cd command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image38-1.png" data-lazy- height="31" src="data:image/svg xml,” width=”152″>

The current working directory should be changed to fs1:scripts, as you can see in the screenshot below.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image39-1.png" height="104" src="data:image/svg xml,” width=”168″>

To go back one directory – to the parent directory, you can run the cd command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image40.png" height="31" src="data:image/svg xml,” width=”164″>

You should be one directory upward, as you can see in the screenshot below.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image41.png" height="78" src="data:image/svg xml,” width=”216″>

The cp Command:

The cp command is used to copy files from one storage device to another or within the same storage device.

I have a hello.txt file in the storage device fs1, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image42.png" data-lazy- height="212" src="data:image/svg xml,” width=”451″>

To make a new copy of hello.txt, run the cp command as follows:

fs1:> cp hello.txt hello2.txt

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image43.png" data-lazy- height="113" src="data:image/svg xml,” width=”363″>

A new file hello2.txt should be created, and the contents of the hello.txt file should be copied to the hello2.txt file.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image44.png" data-lazy- height="235" src="data:image/svg xml,” width=”568″>

If you want to copy the hello.txt file to the scripts directory on the same storage device using a relative directory path, run the cp command as follows:

fs1:> cp hello.txt scripts

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image34-1.png" data-lazy- height="93" src="data:image/svg xml,” width=”403″>

As you can see, the hello.txt file is copied into the scripts directory.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image25-1.png" data-lazy- height="237" src="data:image/svg xml,” width=”570″>

You can also use an absolute path to copy the hello.txt file to the scripts directory as follows:

fs1:> cp hello.txt scripts

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image26-1.png" height="36" src="data:image/svg xml,” width=”248″>

As the file already exists, the cp command will ask you whether you want to overwrite it.

If you want to overwrite the file, press y and then press .

If you don’t want to overwrite the file, press n and then press .

If you want to overwrite all the files that already exist, press a and then press .

If you don’t know what to do, press c and press to cancel the copy operation.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image27-1.png" data-lazy- height="73" src="data:image/svg xml,” width=”482″>

The hello.txt file should be copied to the scripts directory.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image28-1.png" data-lazy- height="152" src="data:image/svg xml,” width=”485″>

In the same way, if you want to copy the hello.txt file to the root directory of another storage device fs0, you can run the cp command as follows:

fs1:> cp hello.txt fs0:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image29-1.png" data-lazy- height="91" src="data:image/svg xml,” width=”366″>

As you can see, the hello.txt file is copied to the root of the fs0 storage device.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image30-1.png" data-lazy- height="212" src="data:image/svg xml,” width=”600″>

You can also recursively copy the contents of a directory to another directory or storage device using the -r option of the cp command.

To recursively copy the contents of the fs0:EFI directory to the storage device fs1, run the cp command as follows:

Shell> cp -r fs0:EFI fs1:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image31-1.png" height="27" src="data:image/svg xml,” width=”238″>

All the files and directories in the fs0:EFI directory should be copied to the storage device fs1, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image32-1.png" data-lazy- height="476" src="data:image/svg xml,” width=”546″>

As you can see, the ubuntu and BOOT directories from the fs0:EFI directory are recursively copied to the fs1 storage device.

Shell> ls fs0:EFI

Shell> ls fs1:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image33-1.png" data-lazy- height="504" src="data:image/svg xml,” width=”649″>

If you want to copy the fs0:EFI directory as well as the contents of that directory to the fs1 storage device, run the cp command as follows:

Shell> cp -r fs0:EFI fs1:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image23-1.png" data-lazy- height="479" src="data:image/svg xml,” width=”590″>

As you can see, the fs0:EFI directory is recursively copied to the fs1 storage device.

Shell> ls fs0:

Shell> ls fs1:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image24-1.png" data-lazy- height="471" src="data:image/svg xml,” width=”657″>

The mv Command:

The mv command works the same way as the cp command. The only difference is that the mv command moves the files or directories from the source to the destination instead of copying them.

As the mv command and the cp command are similar, I will not explain them here. Just read The cp Command section and replace the cp commands with the mv command. You will be good to go.

There is another use case for the mv command. The mv command is used to rename files and directories as well.

For example, to rename the file hello2.txt to hello3.txt, run the mv command as follows:

fs1:> mv hello2.txt hello3.txt

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image59.png" height="27" src="data:image/svg xml,” width=”264″>

The hello2.txt should be renamed to hello3.txt.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image60.png" data-lazy- height="117" src="data:image/svg xml,” width=”363″>

As you can see, the hello2.txt file is no longer in the fs1 storage device and was renamed to hello3.txt.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image61.png" data-lazy- height="296" src="data:image/svg xml,” width=”630″>

In the same way, you can rename a directory using the mv command.

For example, to rename the directory ubuntu to debian, run the mv command as follows:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image62.png" data-lazy- height="115" src="data:image/svg xml,” width=”393″>

As you can see, the ubuntu directory is renamed to debian.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image63.png" data-lazy- height="292" src="data:image/svg xml,” width=”646″>

The rm Command:

The rm command is used to remove files and directories from your storage devices.

To remove a file hello3.txt from the fs1 storage device, run the rm command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image64.png" height="32" src="data:image/svg xml,” width=”173″>

The hello3.txt file should be removed.

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image65.png" height="127" src="data:image/svg xml,” width=”254″>

As you can see, the hello3.txt file is not in the fs1 storage device anymore.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image66.png" data-lazy- height="270" src="data:image/svg xml,” width=”458″>

In the same way, you can remove the debian directory from the fs1 storage device as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image56.png" height="27" src="data:image/svg xml,” width=”143″>

As you’re removing a directory that may contain other files and directories, the rm command asks you whether you want to remove them. This is a safety measure so that you don’t accidentally delete important files.

To confirm the removal operation, press y and then press .

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image57.png" data-lazy- height="54" src="data:image/svg xml,” width=”346″>

The debian directory and its contents should be removed.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image58.png" data-lazy- height="327" src="data:image/svg xml,” width=”388″>

As you can see, the debian directory is not available in the fs1 storage device anymore.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image49.png" data-lazy- height="250" src="data:image/svg xml,” width=”445″>

The edit Command:

The EFI Shell comes with a basic text editor program called EFI Editor. It is very useful as you can edit configuration files very easily from the EFI Shell.

You can open the hello.txt file from the fs1 storage device with the EFI Editor program as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image50.png" height="31" src="data:image/svg xml,” width=”186″>

The hello.txt file should be opened with the EFI Editor program. You can edit your text/configuration file from here.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image51.png" data-lazy- height="490" src="data:image/svg xml,” width=”661″>

Once you’ve edited the hello.txt file, press followed by to save the file.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image52.png" data-lazy- height="504" src="data:image/svg xml,” width=”662″>

The file hello.txt should be saved.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image53.png" data-lazy- height="507" src="data:image/svg xml,” width=”659″>

To close the EFI Editor program, press .

If you have unsaved changes, the EFI Editor program will ask you whether you want to save them.

Press y to save the changes and close the EFI Editor program.

Press n to discard the changes and close the EFI Editor program.

Press c if you’ve changed your mind and don’t want to close the EFI Editor program anymore.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image54.png" data-lazy- height="505" src="data:image/svg xml,” width=”681″>

The EFI Editor program has many other amazing features. Unfortunately, it is out of the scope of this article to show them all.

You can look at the bottom of the EFI Editor program, and you should find all the information you need to use the other features of the EFI Editor program. In addition, you can compare the EFI Editor program with the nano text editor of Linux. It’s amazing.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image55.png" data-lazy- height="538" src="data:image/svg xml,” width=”694″>

The exit Command:

The exit command is used to close the EFI Shell go back to the BIOS/UEFI Firmware of your motherboard.

To close the EFI Shell, run the exit command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image45.png" height="29" src="data:image/svg xml,” width=”102″>

It would be best if you were back to the BIOS/UEFI Firmware of your motherboard, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image46.png" data-lazy- height="499" src="data:image/svg xml,” width=”677″>

The reset Command:

The reset command is used to reset or restart your computer.

To restart your computer from the EFI Shell, run the reset command as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image47.png" height="29" src="data:image/svg xml,” width=”112″>

The reset command can also be used to shut down your computer.

To shut down your computer from the EFI Shell, run the reset command with the -s option as follows:

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image48.png" height="37" src="data:image/svg xml,” width=”135″>

Other EFI Shell Commands:

There are many other EFI Shell commands. It is out of the scope of this article to cover them all. But, you can read the EFI Shell documentation[1] to learn about them. You can also use the help command to find out the available EFI Shell commands. You can use the help command to read the documentation of the EFI Shell commands as well. The EFI Shell documentation is very extensive and full of information and examples. It is also very simple and easy to follow. You should not have any trouble reading it.

Output Redirection:

Just like bash and other Linux shells, the EFI Shell also supports output redirection. Thus, you can redirect the output of an EFI Shell command to a file using the output redirection feature of the EFI Shell.

For example, you can redirect the output of the echo “Hello World” command to a file message.txt as follows:

fs1:> echo “Hello World” > message.txt

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image83.png" data-lazy- height="35" src="data:image/svg xml,” width=”327″>

A new file message.txt should be created, as you can see in the screenshot below.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image85.png" data-lazy- height="215" src="data:image/svg xml,” width=”623″>

As you can see, it has the content Hello World.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image87.png" data-lazy- height="493" src="data:image/svg xml,” width=”662″>

If you want to append (add to the end of a file) the output of another command echo “Good Luck” (let’s say) to the message.txt file, you can use the >> symbol instead of the > symbol as follows:

fs1:> echo “Good Luck” >> message.txt

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image89.png" data-lazy- height="38" src="data:image/svg xml,” width=”316″>

As you can see, the text Good Luck is added to the end of the message.txt file.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image91.png" data-lazy- height="506" src="data:image/svg xml,” width=”670″>

In the same way, you can redirect the output of the help map command to a file map-help.txt as follows:

fs1:> help map > map-help.txt

<img alt="" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image94.png" height="37" src="data:image/svg xml,” width=”257″>

As you can see, a new file map-help.txt is created.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image12-16.png" data-lazy- height="229" src="data:image/svg xml,” width=”471″>

As you can see, the output of the help map command is redirected to the map-help.txt file.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/image11-17.png" data-lazy- height="505" src="data:image/svg xml,” width=”674″>

NOTE: When you do output redirection, you must remember the difference between the > and >> symbol. It is very important. If you don’t have enough knowledge of these symbols, you may lose important data.

Let’s say you’ve run the following command on EFI Shell:

Here, the > symbol will redirect the output of the command to the file. If the file does not exist, it will be created. If the file does exist, the file’s contents will be replaced with the command’s output. This is very important to remember.

Now, let’s say you’ve run the EFI Shell command above using the >> symbol as follows:

Here, the >> symbol will append (add to the end of the file) the command’s output to the file if the file exists. If the file does not exist, it will be created, and the command’s output is added to the file.

So, if the file does not exist, the > and >> symbol will do the same thing – create the file and add the command’s output to the file.

If you have many files on your storage device, it’s not too difficult to make a mistake and lose important data. So, I recommend using the >> symbol instead of the > symbol for output redirection unless you have specific requirements. Then, it will do the same thing. This way, if you make mistakes, you can always remove the extra lines that were appended to the file to go back to the previous state.

Conclusion:

This article shows you how to start the UEFI Interactive Shell and use the common EFI Shell commands. I have also shown you how to use the output redirection feature of the EFI Shell. Finally, I have shown you how to access your computer’s storage devices from the EFI Shell and how to create, copy, move, rename, and edit files from the EFI Shell. This article should help you get started with the UEFI Interactive Shell and EFI Shell commands.

References:

[1] Shell Command Reference Manual – Intel

[2] Basic Instructions for Using the Extensible Firmware Interface (EFI)

About the author

<img alt="" data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/06/echo/photo2-150×150.png" height="112" src="data:image/svg xml,” width=”112″>

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.