I am using 32-bit Red Hat Linux in my VM. I want to boot it to command-line mode, not to GUI mode. I know that from there I can switch to GUI mode using startx
command. How do I switch back to command-line mode?
How to boot Linux to command-line mode instead of GUI
bootcommand linerhel
Best Answer
Update: The answer below is now obsolete
For a lot of distros now, the default is systemd rather than sysvinit. The answer below was written with sysvinit in mind. The more-up-to-date answer (and the one you should use if you have systemd as your init system) is golem's answer.
sysvinit answer (obsolete on most current distros):
You want to make runlevel 3 your default runlevel. From a terminal, switch to root and do the following:
Anything after (and including) the second
#
on each line is a comment for you, you don't need to type it into the terminal.See the Wikipedia page on runlevels for more information.
Explanation of
sed
commandsed
command is a stream editor (hence the name), you use it to manipulate streams of data, usually through regular expressions.sed
to replace the patternid:5:initdefault:
with the patternid:3:initdefault:
in the file/etc/inittab
, which is the file that controls your runlevles. The general syntax for ased
search and replace iss/pattern/replacement_pattern/
.-i
option tellssed
to apply the modifications in place. If this were not present,sed
would have outputted the resulting file (after substitution) to the terminal (more generally to standard output).Update
To switch back to text mode, simply press CTRL+ALT+F1. This will not stop your graphical session, it will simply switch you back to the terminal you logged in at. You can switch back to the graphical session with CTRL+ALT+F7.