I want to make a simple script to go to the login screen and sleep the display on 11.10, as I find the login screen much prettier than the 'lock screen' prompt. However, I cannot find a single reference to switching to the login screen (without logging out) from a terminal or shell script.

I would also appreciate suggestions for sleeping the display after switching to the login screen, or as one whole script if possible.


edit: This is with Unity 3D (as far as I know), I don't really know what the difference between that and Gnome is.

  • I post it as a comment as it did not work on my machine but maybe on yours. The gnome-session-save command without arguments should do it, however, it doesnt. WHen using gnome-session-save --logout-screen, you get the change user option. Maybe someone can help further with this information...
    – Michael K
    Dec 15, 2011 at 8:57
  • my machine says it can't find the command, are you sure that is a command for unity 3d? As far as I know they (gnome and unity) are two different display managy thingies, maybe you can correct me.
    – cortices
    Dec 18, 2011 at 0:14
  • I am not an expert with gnome / unity etc. I am still using gnome classic and will soon turn away from ubuntu and head to Lubuntu with lxde window manager, because I cannot see a clear line in ubuntu's window manager choices.
    – Michael K
    Dec 19, 2011 at 7:58
  • Anyone? Please?
    – cortices
    Dec 29, 2011 at 4:01

1 Answer 1


You can do the following:

gnome-screensaver-command -l ; gdmflexiserver

gnome-screensaver-command -l will lock your session, and gdmflexiserver will take you to the login screen. Your session will be locked, but will unlock automatically when you enter your password at the login screen.

As a script:

gnome-screensaver-command -l

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .