How to boot into command line on Ubuntu or Debian

Question: I am running Ubuntu desktop, but I want to boot straight into text-mode console temporarily. What is a convenient way to disable desktop GUI and boot into a terminal?

Linux desktop comes with a display manager (e.g., GDM, KDM, LightDM), which lets the desktop machine automatically boot into a GUI-based login environment. However, what if you want to disable GUI and boot straight into a text-mode console? For example, you are troubleshooting desktop related issues, or want to run a heavy-duty application that does not require desktop GUI.

Note that you can temporarily switch from desktop GUI to a virtual console by pressing Ctrl+Alt+F1 to F6. However, in this case your desktop GUI will be still running in the background, and thus is different from pure text-mode booting.

Here is how to enable text-mode booting on Ubuntu or Debian desktop.

Boot into Command-line Permanently

If you want to boot into command-line permanently, you need to update GRUB configuration which defines kernel booting parameters.

Open a default GRUB config file with a text editor.

$ sudo vi /etc/default/grub

Look for a line that starts with GRUB_CMDLINE_LINUX_DEFAULT, and comment out that line by prepending # sign. This will disable the initial splash screen, and enable verbose mode (i.e., showing the detailed booting procedure).

Then change GRUB_CMDLINE_LINUX="" to:

GRUB_CMDLINE_LINUX="text"

Next, uncomment the line that says "#GRUB_TERMINAL=console".

The updated GRUB defult configuration looks like the following.

Now use update-grub command to re-generate a GRUB2 config file in /boot based on these changes.

$ sudo update-grub

For systemd-enabled desktop only: If your desktop uses systemd (e.g., for Debian 8 or later or Ubuntu 15.04 or later), there is one additional step needed. That is to change the default target from "graphical" target to "multi-user" target. Skip this step if your desktop does not use systemd.

$ sudo systemctl set-default multi-user.target

You can always revert to desktop boot later by restoring GRUB config file and running:

$ sudo systemctl set-default graphical.target

At this point, your desktop should boot into the command line when you reboot it.

Boot into Command-line Temporarily on Older Desktop

If you want to disable desktop GUI and boot in text-mode just one-time, you can use GRUB menu interface. This works only for Debian 7 or earlier or Ubuntu 14.10 or earlier, where systemd is not enabled.

First, power on your desktop. When you see the initial GRUB menu, press 'e'.

This will lead you to the next screen, where you can modify kernel booting parameters. Scroll down the screen to look for a line that begins with "linux", which indicates a list of kernel parameters. Remove from the list "quiet" and "splash". Add "text" in the list instead.

The updated kernel parameter list looks like the following. Press Ctrl+x to continue booting. This will enable one-time console booting in verbose mode.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

16 thoughts on “How to boot into command line on Ubuntu or Debian

  1. Funny, I have always just put an exit line at the beginning of the init script for the display manager. This disabled it, and let me turn it back on when I was done in console only mode.

  2. This does not work in Debian 8 (jessie). The change to systemd is implicated somehow - but after an hour of searching and several different attempts, the only way I've found to reliably boot to text is to uninstall or disable all display managers.

    • Hey,
      At first I was also frustrated with the new systemd but after some research I was able to boot into console as follows:
      cd /lib/systemd/system
      ln -sf multi-user.target default.target

      That's it. Now after reboot system goes to console instead of graphical interface.

      • Thanks! I think I eventually ended up doing something like

        systemctl set-default multi-user.target

        which had similar effects, but forgot to post that back here when I figured it out.

        • Thanks for posting. Returning to Linux after a hiatus, I cannot believe how complicated it has become to simply boot to console, and then startx after logging in if/when a user wishes to run an installed GUI.

      • you made my day. had the same problem. with your additional steps needed. also works now for me with debian 8 🙂 thx mate.

  3. good grief. after reading dozens of other pages and articles and forum threads, this is the first on i found with the answer that worked for me.
    The directions in the main article worked for me after I installed gnome-core on Ubuntu Server 16.04.

    Thank you for posting this.

  4. On Debian 8, this is the only thing you need to do:

    systemctl set-default multi-user.target

    It automatically links the multi-user target and on your next boot you're done. The guide on this one isn't accurate for Deb 8.

  5. Thank you!

    After reading dozens of other posts of the answer (How to boot straight into CLI on Debian 8) this did the job perfectly! Wish we could boost you to the top of the Google search results.

    Top marks!

  6. You may also want to prevent the kernel from changing video modes which can be problematic, especially if you cannot see the login prompt or it is partially off the screen. Add the setting GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" to /etc/default/grub:

    #GRUB_DEFAULT=0
    #GRUB_HIDDEN_TIMEOUT=0
    #GRUB_HIDDEN_TIMEOUT_QUIET=true
    #GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    #for text mode boot up... and also uncomment the "console" terminal
    GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
    #GRUB_CMDLINE_LINUX="text"
    GRUB_TERMINAL=console

Leave a comment

Your email address will not be published. Required fields are marked *