How to restart x window (xorg?) when it's dead

Solution 1:

From tty1 you can use the following command to restart only the GUI, without rebooting the system:

sudo service lightdm restart

or

sudo service lightdm stop
sudo service lightdm start

Another useful command in this case can be:

xkill  # or xkill -all

(See man xkill to get to know how it works) and you can create a keyboard shortcut for xkill so you don't need to go in tty1 to use it.