Home  >  Article  >  System Tutorial  >  How to boot into the Linux command line

How to boot into the Linux command line

WBOY
WBOYforward
2024-05-08 09:13:11569browse

Maybe sometimes you need or want to start Linux without using the GUI (graphical user interface), that is, without X, but choose the command line. Whatever the reason, fortunately, booting directly into the Linux command line is very simple and requires a simple change in the boot parameters after the other kernel options. This change boots the system to the specified runlevel.

How to boot into the Linux command line

Why do you do this?

If your system is unable to run Xorg due to an invalid configuration or a corrupted display manager or any condition that would prevent the GUI from booting properly, booting to the command line will allow you to troubleshoot by logging into a terminal (assuming you know how do) and can do anything you need to do. Booting into the command line is also a great way to get familiar with the terminal, or you can do it just for fun.

Accessing the GRUB menu

At boot time, you need to access the GRUB boot menu. If the menu is not set to appear each time the computer is started, you may need to hold down the SHIFT key before the system starts. In the menu, you need to select the Linux distribution entry. With the entry highlighted, press Next e Edit boot parameters.
How to boot into the Linux command line

Older GRUB versions follow a similar mechanism. The startup manager should provide instructions on how to edit startup parameters.

Specify run level

An editor will appear and you will see the options that GRUB will parse to the kernel. Move to the line starting with linux (older GRUB versions may be kernel, select it and follow the instructions). This specifies the parameters to be parsed to the kernel. At the end of the line (which may span multiple lines depending on your terminal resolution), simply specify the runlevel you want to boot, which is 3 (multi-user mode, plain text).
How to boot into the Linux command line
Pressing Ctrl-X or F10 will start the system with these parameters. Booting up is the same as before. The only thing that changes is the startup runlevel.

This is the page after startup:
How to boot into the Linux command line

Runlevel

You can specify different run levels, the default run level is 5 (multi-user graphical interface). 1 Boot into "single user" mode, which boots into the root shell. 3 provides a multi-user command line system.

Switch from command line

At some point, you may want to run the display manager to use the GUI again, the quickest way is to run this:

$ sudo init 5

It's that simple. Personally, I find the command line more exciting and intuitive than using GUI tools. However, this is just my personal preference.

The above is the detailed content of How to boot into the Linux command line. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete