Getting into the Linux Shell is like diving into a black hole for new Linux users. Once in, it can seem impossible to get back out without going thermonuclear and restarting the computer.
Here are a couple of ways you can get out of the Linux shell and back into your graphical desktop. This article also explains how to stop and start your display manager.
Ubuntu and other Linux distros give you six possible command-line terminals to use. Pressing any function key from F1 to F6 in combination with Ctrl+Alt will give you access to those terminals. You can log into each of these terminals either as yourself or another user and run up to 6 virtual displays. Any activated display can be viewed by pressing Ctrl+Alt in combination with any function key from F7 to F12. Terminal F1 is typically used with display F7, F2 is typically used with F8, and so on up to terminal F6 which corresponds to the display accessed by Ctrl+Alt+F12.
Displays are numbered 0 to 5. For example, Ctrl+Alt+F7 corresponds with display 0 and Ctrl+Alt+F12 corresponds with display number 5. More about this is shown in the section on Multiple Displays (the site is being restructured. This link will be corrected in a couple of hours).
|Function Key to Enter TTY (Ctrl+Alt+)||F1||F2||F3||F4||F5|
|Function Key to View Display (Ctrl+Alt+)||F6||F7||F8||F9||F10|
If your desktop is already running, unhide it
When you drop to a shell from a desktop environment will not necessarily kill the running desktop manager or window manager. Dropping to shell usually only hides the desktop. You can get back into a hidden desktop by pressing Ctrl+Alt+F7.
Starting (and stopping) a new desktop environment
The failsafe environment
The X Windows System, X, provides an option for running a default desktop environment as provided by your desktop manager. This is handy to know when your regular graphical desktop will not load.
The default X GUI environment lacks a user’s usual desktop settings. It is loaded by the following command-line instruction:
The default desktop environment loaded by startx can be overridden on a per user basis by telling Linux which desktop manager to load. This is done by editing the .xsession and .xinitrc scripts found in a user’s home directory e.g /user/home/.xinitrc.
The files .xsession and .xinitrc are discusses in more detail in the article about running Multiple Displays on your Linux desktop.
The regular desktop environment
You can start your regular desktop environment by initializing your display manager (login manager). The commands for starting and stopping different display managers are in Table 2.
|Desktop Manager||Example Distro||Start Command||Stop Command|
|GNOME||Ubuntu||start gdm||stop gdm|
|KDE||Kubuntu||start kdm||stop kdm|
|*Ubuntu||*Ubuntu||start lightdm||stop lightdm|
|LXDE||Lubuntu||start ldm||stop ldm|
|X||start xdm||stop xdm|
Only one desktop session can run on a display at any one time so make sure your regular desktop session is stopped before you try to start another. For instance, if you used KDE with the K Display Manager (KDM) and you need to restart your desktop session, you would first stop your display manager with “sudo stop kdm” then restart it with “start kdm”.
Ubuntu, Kubuntu and several more Ubuntu based distros now use the Light Display Manager (LightDM) instead of kdm and gdm etc…
Some older versions of Ubuntu use a longer command-line instruction to start and stop display managers. The old command took the form:
/etc/init.d/[display manager] start/stop
For example, to start kdm you would type
and to stop it