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.
On Ubuntu 12.04 you can use
/usr/lib/indicator-session/gtk-logout-helper --logout
It opens a dialog box. I use it with Awesome Window Manager.
To directly logout, you can also (softly) kill your window manager.
Have you tried
/usr/bin/gnome-session-quit --logout --no-prompt
This works for me in an Awesome WM Gnome session. Since GNOME 3.10 or so the --logout --no-prompt is now needed because I guess the dialog box is gone.