TheOS.IN

Ubuntu Linux shutdown the X server

Recently someone asked me a question – “How do I shutdown the X server, so that I have a command line prompt on the console?

Well answer is very simple use script located at /etc/init.d/ directory. If you are using KDE desktop type the command (make sure you save all the work as following command does not ask confirmation):

sudo /etc/init.d/kdm stop

Within few seconds you should be dropped to a command line prompt on the console. To start GUI type command:

sudo /etc/init.d/kdm start

If you are using GNOME:

sudo /etc/init.d/gdm stop

Again to start GNOME desktop:

sudo /etc/init.d/gdm start

Another way – You can change the current runlevel

From a command line, you can use the init command to go immediately into runlevel 1, which is also known as single user text mode. Open terminal and type the following command:

sudo init 1

Again get back to GUI with init 2 command:

sudo init 2

When you type init 1 command your session will then begin to shut down and bring you into single user text mode. When you type init 2 command your session will then begin to shut down and bring you into GUI mode :)

Pretty easy ahh?

So what are GDM and KDM?

Exit mobile version