How to log out with a command in a gnome-less environment?

You could restart the desktop manager, which is similar to restarting X.

On Ubuntu 11.10:

sudo service lightdm restart

On earlier versions:

sudo service gdm restart

If that fails or you are on a very old system, try:

sudo /etc/init.d/gdm restart

One of these should take you back to the login screen. Be aware that you will not be prompted, so save any work before running this command!


<modkey> + shift + q is the default command for killing the wm client on dwm and awesome. This effectively returns to the logout screen. Tested on a MacBook Air XUbuntu 12.10 with dmw, where it is alt + shift + q.Tested on a ThinkPad running Debian Stretch with awesome 3.5.