In 12.04 How do you kill the X server from the command line and from the GUI interface and how do you start it from the virtual terminal?
-a means it will kill all display instances. For more information run
startx but this command is to start an instance and not the server itself. For more information run
man xint and
I don't believe it's possible to kill Xserver from GUI, and even if it were, it would not be the right way to do it.
On Ubuntu 22.04 (and a few previous versions) you can add a hotkey to your gnome session to kill the x server. Install gnome-tweaks via
sudo apt install gnome-tweaks and then open it (logo button and then "tweaks" and enter) then goto "Keyboard & Mouse" -> "Additional Layout Options" -> "Key sequence to kill the X server" -> "Ctrl+Alt+Backspace"