1. Introduction

In this tutorial, let’s look at how we can change the default boot option from a graphical interface to the command-line mode. After BIOS POST is completed, the GRUB bootloader takes over and loads the necessary files required to start our operating system and complete the system startup. During this process, GRUB waits for a few seconds to take input. Otherwise, it boots to the default operating system.

There are two major GRUB releases, legacy GRUB and GRUB 2. Legacy GRUB is the old version that was dropped in 2005 at version 0.97. Since then, GRUB 2 has taken over. However, most Linux distros that use GRUB 2 still name it GRUB. GRUB supports several useful features like booting multiple operating systems on a single PC, live configuration editing, and rescue mode. It also allows us to change the default boot option to our preferred one. This can either be the graphical interface or text-mode/command-line. 

2. Temporarily Booting to the Command-Line 

We can temporarily boot into a command-line during startup by accessing the GRUB menu. This can be achieved with the following steps.

2.1. Accessing the Grub Menu

First, we access the GRUB menu during boot by repeatedly pressing the escape button. For systems with BIOS firmware, we need to hold the shift key immediately. Once the GNU GRUB screen appears, the first entry of the menu should be selected already (when selected, it has an asterisk on the left side): 5 during boot hold shift box 1

2.2. Editing the Kernel Parameters

To start editing the kernel parameters, we press the ‘e’ key to get the following screen:image showinf the screen shown after pressing the e key We use the down arrow key to navigate and scroll down to the following line: 5 linux statemtnt box On finding it, we use the left arrow key to move to the end of the line where we add a new space followed by the number 3. We should not add anything else after 3. After these changes, it should look similar to this:

 linux      /boot/vlmlinuz-5.13.0-51-generic root=UUID=731597f6-ff21-48c3-ac3c-e7dfb0403fad ro quiet spalsh $vt_handoff 3

2.3. Saving and Booting to Command-Line Mode

To save the change we made, we press ctrl +x or F10. This will boot into text mode or command-line mode. After booting, the system prompts us to enter the username followed by the password. Successful login brings us a command-line: 5 successfull login into console box We can restore our graphical interface by running either of the following:

$ sudo init 5
$ sudo reboot

3. Permanently Booting to the Command-Line

Before permanently booting to command-line mode, we have to find out which system is used to initialize our computer processes at startup. In older systems, we either had SYS V init, BSD init, or LSB init. Recent systems use systemd. To find out, let’s run the following command:

$ cat /proc/1/comm

If the output is systemd, then we use the following commands to permanently change to command-line mode:

$ sudo systemctl set-default multi-user.target
$ sudo reboot

Upon reboot, the computer opens a command-line option similar to the one above. To restore our system to the graphical interface, we can run the following commands:

$ sudo systemctl set-default graphical.target
$ sudo reboot

If the output of cat /proc/1/comm is “init”, then we have to edit the grub configuration file at /etc/default/grub. We can use any editor to modify this file:

$ sudo vi /etc/default/grub
$ sudo nano /etc/default/grub

Let’s look for the following line and change it:

GRUB_CMDLINE_LINUX_DEFAULT="text"

We also have to uncomment the following line:

GRUB_TERMINAL=console

For the changes to take effect, let’s run the following commands:

$ sudo update-grub
$ sudo reboot

4. Conclusion

In this article, we’ve learned how to change from a graphical interface to a command-line mode. Though changing to command-line mode is a preference issue. But in some instances, it might be the only option we have. For example, when the GUI fails or has problems and cannot complete startup, we can use the command-line mode to troubleshoot. Other times we might run into systems with low system resources that cannot support GUI and the only option is using the command-line. We can always switch back to the graphical interface.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.