How one can View and Change Boot Sequence in Linux Terminal

Do you need to change the startup sequence of your Linux system without rebooting? How to change it in the terminal.

Set the Linux startup sequence from the terminal

Have you ever had to change your startup sequence through the terminal? Maybe you're doing this remotely over SSH, or you may not be able to get into the BIOS during that two-second sweet spot when your computer is first turned on. This article explains how to easily change the boot order from the terminal.

Display the startup sequence

Assuming your computer supports EFI (Extensive Firmware Interface), which is close to almost all computers these days, you can view the current startup sequence through the terminal with the following command:

uefi motherboard

efibootmgr -v

This will show all of the boot devices on your computer and look something like:

BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,0004,0005,0003
Boot0000 * Ubuntu HD (…) / file ( EFI UBUNTU SHIMX64.EFI)
Boot0003 * Hard disk BBS (…)
Boot0004 * UEFI: JetFlashTranscend 32GB 1100 …
Boot0005 * UEFI: JetFlashTranscend 32 GB 1100, partition 1 …

The first line shows the current device that was booted from, the third line shows the current startup sequence of the computer and the following lines list each bootable device.

Notice the numbers like 000, 003, etc. In this example we see that the current boot sequence is the Ubuntu installation, followed by the hard drive and the two different partitions on a 32GB USB drive.

Change start sequence

Choose your new startup sequence using the device numbers and change your startup sequence with the following command:

sudo efibootmgr -o 5,0,4,3

Using the example above, this command would change the boot sequence to test the USB drive first, followed by the main installation of Ubuntu.

It's that simple. You can now use a terminal to change the boot sequence on any Linux computer without going into the BIOS the first time you turn on the computer.

Photo credit: Logan Weaver / Unsplash

Linux USB

Running Linux from a USB Drive: Are You Doing It Right?

Did you know it is possible to fully install Linux on a USB drive? How to Create a Linux USB PC in Your Pocket!

About the author

Matt Dizak
(8 articles published)

By Matt Dizak

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive deals!

One more step …!

Please confirm your email address in the email we just sent you.

Leave a Reply

Your email address will not be published. Required fields are marked *