0% found this document useful (0 votes)
18 views6 pages

Boot Linux in Command Line Mode Instead of GUI

This tutorial explains how to change the default boot option from a graphical interface to command-line mode in Linux using the GRUB bootloader. It covers both temporary and permanent methods for booting into command-line mode, including editing kernel parameters and modifying GRUB configuration files. The document also highlights scenarios where command-line mode may be necessary, such as troubleshooting GUI failures or using systems with limited resources.

Uploaded by

vignesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views6 pages

Boot Linux in Command Line Mode Instead of GUI

This tutorial explains how to change the default boot option from a graphical interface to command-line mode in Linux using the GRUB bootloader. It covers both temporary and permanent methods for booting into command-line mode, including editing kernel parameters and modifying GRUB configuration files. The document also highlights scenarios where command-line mode may be necessary, such as troubleshooting GUI failures or using systems with limited resources.

Uploaded by

vignesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Boot Linux in

Command Line
Mode Instead of
GUI
Skip Ad

Last updated: June 1, 2023

Written by:baeldung

 Administration

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):

2.2. Editing the Kernel Parameters


To start editing the kernel parameters, we press the ‘e’ key to get the following screen:

We use the down arrow key to navigate and scroll down to the following line:
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
Copy

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:
We can restore our graphical interface by running either of the following:
$ sudo init 5
$ sudo rebootCopy

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/commCopy
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 rebootCopy
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 rebootCopy
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/grubCopy
Let’s look for the following line and change it:
GRUB_CMDLINE_LINUX_DEFAULT="text"Copy
We also have to uncomment the following line:
GRUB_TERMINAL=consoleCopy
For the changes to take effect, let’s run the following commands:
$ sudo update-grub
$ sudo rebootCopy

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.

You might also like