Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set up boot to enter the Linux command line

Shulou Source: shulou.com Published: 2022-06-01 16:44:21 10月04日 Update

This article introduces the knowledge about "how to set up the boot to enter the Linux command line". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

There may be times when you need or want to start Linux without using the GUI (graphical user interface), i.e. without X, and instead choose the command line. Whatever the reason, fortunately, booting directly into the Linux command line is fairly straightforward, requiring simple changes to boot parameters after other kernel options. This change boots the system to the specified run level.

Why would you do that?

If your system is unable to run Xorg due to invalid configuration or display manager corruption or anything that might cause the GUI to fail to boot properly, Boot to Command Line will allow you to troubleshoot by logging into the terminal (assuming you know what to do) and doing whatever you need to do. Booting to the command line is also a good way to familiarize yourself with the terminal, otherwise you might as well do it for fun.

Access the GRUB menu

At boot time, you need to access the GRUB boot menu. If the menu is not set to display every time you start the computer, you may need to hold down SHIFT before booting the system. In the menu, you need to select the Linux distribution entry, highlight the entry, and press e to edit boot parameters.

Older versions of GRUB follow a similar mechanism. Startup Manager shall provide instructions on how to edit startup parameters.

Specify Run Level

An editor will appear and you will see that GRUB will parse the options to the kernel. Move to the line that starts with linux (older versions of GRUB might be kernel, select it and follow the instructions). This specifies the parameters to parse to the kernel. At the end of the line (which may appear to span multiple lines depending on your terminal resolution), simply specify the run level to boot, i.e. 3 (multi-user mode, plain text).

Pressing Ctrl-X or F10 will start the system using these parameters. Turn it on. Same as before. The only thing that changed was the startup run level.

This is the page after launch:

runlevel

You can specify different runlevels, the default runlevel 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 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 hands-on than using GUI tools. But that's just my personal preference.

"How to set the boot into the Linux command line" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Run command level parameter system user menu kernel terminal management selection personal content graphics situation more item mode version interface Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft vpn Shulou Tech Info OPPO Reno