How to kill the X server and end up with a CLI?
Andrew Mclaughlin
Is it possible to kill the GUI and end up with a CLI since the GUI runs on the top of the shell?
I have check the question belowHow to kill and to start the X server?
Magic keys restarted the GUI and I ended up with the login menu but not a CLI I am using Ubuntu 12.04 , I dont want to use virtual terminal I just want to prove to myself that the GUI runs on top of the shell and I can always exit the GUI to the shell
Thanks
2 Answers
To shut down your X session type in the command line:
sudo service lightdm stopSo you will end up in the virtual terminal #7. You then can hit Ctrl+Alt+F1 - Ctrl+Alt+F6 to get a login prompt. For terminal #7 (Ctrl+Alt+F7) there is no tty started because it's meant for the x server.
Edit:
If you want to end of in a shell, then create a file called /etc/init/tty7.conf with content:
# tty7 - getty
#
# This service maintains a getty on tty7 from the point the system is
# started until it is shut down again.
start on runlevel [23] and not-container
stop on runlevel [!23]
respawn
exec /sbin/getty -8 38400 tty7After creating this file reboot the system, and then when you perform sudo service lightdm stop you will end up in a login shell.
That solution brings your "GUI" back because you have the lightdm service running. Run sudo stop lightdm. That command will stop your lightdm service, kill X server and bring the console.
Once in the console, if you want to start your X11 session again, run sudo start lightdm.