Temporarily
If your purpose is to temporarily disable GUI - you can stop the lightdm service with 【sudo service lightdm stop(14.04 and earlier)】
or
【sudo systemctl stop lightdm(since 15.04)】
from tty1.
Permanent
For Ubuntu 14.04 and earlier
1. Open【/etc/default/grub】with the choice of your text editor.
2. Now, you will find the line :
GRUB_CMDLINE_LINUX=" quiet splash"
then,annotate it.
3. Add a new line 【GRUB_CMDLINE_LINUX="text "】
before the line 【GRUB_CMDLINE_LINUX=" "】
4. 【sudo update-grub】
5. Reboot the system.
For Ubuntu 15.04 and newer
choice-one
【sudo systemctl disable lightdm.service】
then reboot the system.
if you want to restart the GUI,
【sudo systemctl start lightdm.service】
Reboot, and you should enter the command line directly.