Force Ubuntu boot into terminal by default

So you may ask why would I want to make Ubuntu boot into terminal by default. Well, this post is specifically drafted for Ubuntu server, which is typically recommended to be left at commandline until a GUI environment is absolutely needed. But if have have other reasons to make your Ubuntu boot to command line then knock yourself out. I have set my Ubuntu server to boot to commandline by default for security reasons. Additionally this also reduces stress on my low power home server resources. When you really need a graphical user interface you can make Ubuntu boot to GUI with a simple command. First, I will show you how to make Ubuntu boot into terminal in 14.04 Trusty Tahr Server. This should also work in other flavors of Ubuntu. [Read: Install GUI on Ubuntu server 14.04 Trusty Tahr]

Force Ubuntu Boot into Terminal

To make Ubuntu boot command line by default, you will have to open and edit /etc/default/grub. Open terminal, and open the file using the following command:

sudo nano /etc/default/grub

Find the line that says GRUB_CMLDLINE_LINUX_DEFAULT. By default it should have quotation marks with nothing in between. Add the word "text" within the quotation marks as shown in the picture below.

Ubuntu Boot Into Terminal
Ubuntu Boot Into Terminal - Grub Edit

Save the file by pressing Ctrl X, followed by "Y". Then update Grub using the command sudo update-grub to make Ubuntu boot into terminal on reboot.

Ubuntu Update Grub
Ubuntu Update Grub

Upon reboot, you should Ubuntu boot to commandline by default. You may watch this in action in the video tutorial below.

Video: Make Ubuntu boot to command line by default

How to Start the GUI?

What you want to start your desktop environment or GUI? It's easy, after you login just run the the command below and it should take you to your GUI desktop. [Read: Minimal desktop environment for Linux servers]

startx

If you have multiple desktop environments installed then Ubuntu will start your last used GUI.

Recommended Guides for Ubuntu:

Make Ubuntu Boot to GUI

To reverse the changes and make Ubuntu boot to GUI desktop environment by default, edit the /etc/default/grub file again and remove the word "text" from the quotes for GRUB_CMLDLINE_LINUX_DEFAULT, as shown in the picture below.

Ubuntu Boot To Gui - Grub Default
Ubuntu Boot To Gui - Grub Default

Save (Ctrl X and then "Y" on nano editor) and exit. Upon reboot you should reach the graphical login manager directly.

In summary, some advantages to making Linux boot to command line are more security and less use of hardware resources. So if you run a Ubuntu home server, I strong recommend that you make Ubuntu boot into terminal environment by default and start GUI on demand basis. If you have other thoughts please leave a comment. Enjoy!

Be the 1 in 200,000. Help us sustain what we do.
30 / 150 by Dec 31, 2024
Join Us (starting from just $1.67/month)

Anand

Anand is a self-learned computer enthusiast, hopeless tinkerer (if it ain't broke, fix it), a part-time blogger, and a Scientist during the day. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs.