Skip to content
Unix Server Solutions
  • Server
  • Apple
  • Database
  • Ubuntu
  • Linux

Ubuntu – How to boot into the console and then launch the Ubuntu desktop from it

bootcommand linegnomeloginunity

At the Ubuntu login page I have to hit Ctrl+Alt+F1 to be able to login as an user using the command line.

But how do I get to the command line first and then start the Ubuntu desktop from it?

Best Answer

To return to the login screen

Press Ctrl+Alt+F7 to return to the login screen. You can exit your terminal session on tty1 by typing exit before you do that.

Doing startx -- :1 will start another X session under terminal tty1, logging you in directly (use :2, etc. for even more displays). Note that logging into multiple sessions as the same user is not recommended and could lead to system instability.


To skip the login screen completely, boot into the console and then start the GUI, you must modify GRUB:

  • sudo nano /etc/default/grub
  • Change line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="text"
  • Ctrl-X, press Y and then Enter to save and exit.
  • sudo update-grub
  • Reboot and you should come up directly in tty1 -- no need to press Ctrl-Alt-F1.
  • Login, and then startx to boot into the default desktop, or
    • unity for Unity
    • unity-2d-shell for Unity 2D
    • gnome-shell for Gnome
    • sudo service lightdm start to get the login screen (if you fix it :)

Related Solutions

Ubuntu – How to “show desktop” from command line

There is a useful command line application called xdotool which amongst other stuff, allows you to send keystrokes.

Thus - to mimic Control+Alt+D (or Super+D, or whatever the combination is you need), you can use one of the following commands:

xdotool key ctrl+alt+d
xdotool key ctrl+super+d
xdotool key super+d

To install:

sudo apt-get install xdotool
Ubuntu – How to disable compiz and enable metacity with the command-line

Running metacity --replace from a virtual console doesn't work because it doesn't know which X11 display to attach to. The default behavior is to attach to the display it runs in...and a shell running in a virtual console isn't on any X11 display.

Instead, you must manually specify the display. It will be :0 unless you've configured your X11 display differently. (Even if you have multiple monitors, it will still be :0 unless you've changed your X11 configuration.)

To do that, use this command:

metacity --display=:0 --replace

If that does't work, then try manually killing the compiz process first. To do that:

  1. Run killall compiz. Wait a few seconds. Perhaps compiz will respond to this signal and terminate.

  2. Run killall -KILL compiz. This almost always ensures that compiz will be immediately terminated.

Step 1 is optional, but can help processes free some resources and finish up some kinds of important actions (like writing buffered data to files).

Related Question
  • Ubuntu – How to “show desktop” from command line
  • Ubuntu – How to disable compiz and enable metacity with the command-line
  • Ubuntu – How to install and launch the Gnome desktop from a Xenial 16.04 command line