Disable X.Org in Ubuntu | Stop X Server from Starting

Transitioning Ubuntu Desktop to Server Mode
If you have an Ubuntu system originally set up with the Ubuntu Desktop environment, but desire to operate it as a server, resources can be conserved by preventing the graphical interface from automatically launching. This approach is also beneficial when system administration tasks require command-line access outside of the graphical user interface.
Choosing to disable rather than uninstall the graphical packages allows for occasional GUI access when needed. Disabling X.Org is achieved by preventing the Gnome Display Manager (GDM) from starting.
Disabling the Graphical Environment
To disable GDM, execute the following command in your terminal:
sudo update-rc.d -f gdm remove
Following a system reboot, you will encounter a text-based login prompt instead of the familiar graphical desktop.

Temporarily Running the Graphical Interface
Should you need to utilize the graphical environment while it's disabled, simply enter this command at the command prompt, ensuring you are logged in as your standard user:
startx
The initial gray screen will disappear once the Gnome desktop environment has fully initialized.
Re-enabling X.Org
To restore the graphical environment, execute this command from the terminal:
sudo update-rc.d -f gdm defaults

Upon restarting your system, the graphical login prompt will reappear, allowing access to the desktop environment.