How to go to login screen with terminal

6,195

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:

#!/bin/sh
gnome-screensaver-command -l
gdmflexiserver
Share:
6,195

Related videos on Youtube

cortices
Author by

cortices

I code predominantly for Mac & iOS in Swift & ObjC, but I've turned my hand to a fair few languages over the years. The J̵̄ͦͤ̀a͈͔̗̠͈̘͇ͣ͗͆̾̄v̤̬̯͍̱͔̍̋̀ͅa̹͔̤̅ͦ̍̐͗̍͑ ̶̝͍̰͎̿̈́ͨV̫͍̪͍͖ͪ͊̒i̢͉̜̰̫̹̮ͫͪͮr̝̻͙̱̙̺ͣ̑̃ͤ͆t͏͍u͚͎͓̻̅͐͗ͩͦ̓ͨ͞ḁ̸͈ͯͬl̻ͦ͗ ̨͌͗̏ͯ̍M͔̻̣ͧa͖̣̰͔͚͞ͅc͙̜̀̍h̜͓̬̻͓̮i͖̇ͥn̚͜e̶̖͍̼͇ͣ̑̿͂͋̋ haunts my nightmares.

Updated on September 18, 2022

Comments

  • cortices
    cortices over 1 year

    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.

    Thanks

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

    • Michael K
      Michael K over 12 years
      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
      Michael K over 12 years
      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.
    • cortices
      cortices over 12 years
      Anyone? Please?