Console mode (i.e., all-text mode) can be both useful and convenient in Linux and other Unix-like operating systems. Fortunately, there are several simple ways to access a console and then return to a GUI (graphical user interface), which is the default type of user interface on most computers today.
There are a few good reasons that command line interfaces (CLI) are available on modern operating systems in spite of the strong preference for GUIs by most ordinary users. One is that many users find the command line to be more convenient than the GUI for some operations once they become familiar with it. Another is that it allows numerous tasks to be performed that are impossible or inconvenient with GUIs. Moreover, sometimes the command line is all that is available to work on a highly specialized system or to repair a damaged system.
A CLI is an all-text mode interface. It is provided in console mode, but it can also be obtained in GUI mode by opening a terminal window, which is a window that contains only text and emulates console mode. Terminal windows have several advantages over console mode, including the ability to have multiple terminal windows open simultaneously, the ability to easily move and resize them and the ability to keep other types of windows (e.g., those containing word processor documents or images) open on the screen at the same time.
Despite these advantages, there are also situations in which it can be preferable to open a console. One is the (fortunately relatively rare) situation in which the entire GUI has frozen or otherwise stopped functioning properly and thus it is necessary to try to repair it. Although rebooting (i.e., restarting the computer) is an option in such circumstances, it can result in the loss of both unsaved data and user time. Also, some advanced users may feel very comfortable with the console for most operations and only require a GUI for some specialized tasks such as surfing the web or processing images. In addition, some users may be most comfortable with a GUI but desire to become familiar with the console in case they really need it some day.
One way to access a console is to have the computer boot (i.e., start up) directly into it by default instead of into a GUI. This can be accomplished by modifying the /etc/inittab file manually with a text editor to change the runlevel from 5 (which represents the GUI) to 3 (which represents the console). Each runlevel designates a different system configuration and allows access to a different combination of services. Then, when the user wants to switch to the GUI, all that is necessary is to type the following command at the command line and press the ENTER key:
This causes the X server to be launched, and the standard GUI thus appears within a matter of seconds. An X server is a program in the X Window System that runs on local machines (i.e., the computers used directly by users) and handles access to the graphics cards, display screens and input devices (typically a keyboard and mouse) on those computers on behalf of the GUI. The X Window System is the default software package for managing GUIs on Unix-like operating systems. The default user interface can later be changed back to a GUI by again editing /etc/inittab to change the runlevel back to 5.
A quicker and more flexible way to change from a GUI to a console or visa versa is to use the telinit command, which immediately modifies the runlevel. Thus, for example, to exit the GUI and enter a console, all that is necessary is to open a terminal window, log in as the root (i.e., administrative) user, and then issue the following command:
The fastest and most flexible way of switching back and forth between a GUI and a console is to use simple keyboard commands. That is, the GUI can be closed immediately and replaced by a console by simultaneously pressing three keys: the CTRL key, the ALT key and any one of the function keys from F1 through F6. It is not necessary to be the root user or to open a terminal window. This is particularly useful for emergencies such as a frozen GUI when it is impossible to use a terminal window to correct the situation.
It is easy to return to the GUI from a console that has been brought up on the display screen using the above key combination. All that is necessary is to simultaneously press the CTRL, ALT and F7 keys. The startx command should not be used in this situation because the X server is already running; it just is not being shown on the display screen.
Sometimes when the GUI is frozen or otherwise not performing properly, merely the act of switching out of the GUI into the console and then switching back to the GUI is sufficient to solve the problem. At other times, it will will be necessary to take additional steps while in console mode, such as attempting to locate the specific program that is causing the problem and then terminating that program.
Created December 24, 2005.