How can I restart my GUI (X window server) from command line without rebooting the system? Which process(es) do I need to kill and do they automatically restart?

4 Answers 4


All you need to do is restart LightDM as root, like so:

sudo restart lightdm
  • 1
    You should probably mention that you should do this from a TTY (virtual terminal).
    – RolandiXor
    Commented Sep 16, 2016 at 17:19
  • I was guessing from the level of detail of the question that Mr. Wolf knows his way around the terminal. :)
    – Fred Rocha
    Commented Sep 16, 2016 at 18:15
  • 1
    I wasn't just referring to the "terminal", but oh well. (I said virtual for a reason. I mean the thing you get when you press ctrl+alt+f-key-of-your-choice).
    – RolandiXor
    Commented Sep 17, 2016 at 22:30
  • Oh, I see. And what would the advantage be in this case? How would that work? Curious myself now. :)
    – Fred Rocha
    Commented Sep 18, 2016 at 12:35
  • 2024 : restart: command not found
    – JRichardsz
    Commented Jun 2 at 14:06

This worked for me:

sudo service lightdm restart

The worst is that noone mentioned that you must use alt+ctrl+F1 to F6 to switch to terminal. Login there as standard user. Restart x with sudo command and then press alt+ctrl+F7 to go back to GUI.


On Ubuntu 18.04, I do this executing next command:

sudo systemctl restart lightdm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.