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?
command line;rhel;boot
You want to make runlevel 3 your default runlevel. From a terminal, switch to root and do the following:[user@host]$ suPassword:[root@host]# cp /etc/inittab /etc/inittab.bak #Make a backup copy of /etc/inittab[root@host]# sed -i 's/id:5:initdefault:/id:3:initdefault:/' /etc/inittab #Make runlevel 3 your default runlevelAnything 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 commandThe sed command is a stream editor (hence the name), you use it to manipulate streams of data, usually through regular expressions. Here, we're telling sed to replace the pattern id:5:initdefault: with the pattern id:3:initdefault: in the file /etc/inittab, which is the file that controls your runlevles. The general syntax for a sed search and replace is s/pattern/replacement_pattern/.The -i option tells sed 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).UpdateTo 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.