Disable graphics in Ubuntu desktop
Boot in text mode
Edit /etc/default/grub with your favourite editor, e.g. nano:
sudo nano /etc/default/grub
Find this line:
Change it to:
Disable graphical desktop
For systems that use systemd
This is an additional step for systemd releases, e.g. Ubuntu 15.04, the steps above for grub are still necessary.
You need to tell systemd to not load the graphical login manager:
sudo systemctl enable multi-user.target --force sudo systemctl set-default multi-user.target
You will still be able to use X by typing startx after you logged in.
If you are using lightdm as a login manager it can be prevented from loading by disabling it.
You can use an override:
sudo bash -c 'echo "manual" >> /etc/init/lightdm.override'
And to start lightdm on command:
sudo start lightdm
To restore your system so that lightdm is always started on boot:
sudo rm /etc/init/lightdm.override
For more information, the upstart cookbook is your friend: