Hi I have ubuntu server 10.04 installed and I also installed the following:

aptitude install xorg xfce4
aptitude install <name of GUI browser, I use firefox>
aptitude install gedit
aptitude install gnome-terminal

Now when I restart the system it goes to the GUI login, what I am really after is a system that loads the CLI by default and then I can use startx to load the GUI when really necessary. I am trying to learn CLI but I would like to retain access to the GUI for now. And, how can I switch between CLI and GUI anytime?


Modify your file /etc/default/grub with


and do sudo update-grub. The machine will boot in text mode.

To start the graphical interface you do

sudo service gdm start


Starting from Ubuntu 11.10 Oneiric, the default Display Manager is LightDM, so the preceding command becomes:

sudo service lightdm start
  • this worked for me, except the command to start the GUI. Instead, I used this command: startx – code_monk May 4 '14 at 4:12
  • Setting GRUB_CMDLINE_LINUX_DEFAULT to "text" has no effect for me on 14.04. Any clues? – Nickolai Leschov Nov 13 '15 at 22:12
  • the grub file doesn't exist with xubuntu via ubuntu arm 14.04 – Jacksonkr Mar 30 '16 at 21:55

You can either set the display manager, gdm (for Gnome)/kdm (for KDE)/etc, to not start on boot, or you can just remove the packages.

To prevent the display manager from starting, run:

sudo update-rc.d -f remove gdm   #For Gnome
sudo update-rc.d -f remove kdm   #For KDE

or, to remove the display manager:

sudo apt-get purge gdm           #For Gnome
sudo apt-get purge kdm           #For KDE
  • 1
    What does sudo update-rc.d -f remove gdm actually do? As well as out of curiosity, I'm asking because the command needs modification for Ubuntu 14.04: it doesn't work as it is. Replacing gdm with lightdm doesn't work, either. – Nickolai Leschov Nov 13 '15 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.