Is there a way to log out & log back in as another user or the same user, all from the command line? I have seen solutions that use killall
or pkill
, etc., to kill all processes running as the logged-in user.
This certainly works, and logs me out, but when I log back in I find that all of my processes have been killed, as I totally did not expect after running that command. All my terminals are closed, as well as my browser, etc. It is as if my desktop were started fresh from being powered off.
On the other hand, when I "lock" the computer by using the context menu on the top-right corner of the screen, and then log back in, everything I had open is still open, and all of my processes have not been killed. In this context menu, "logging out" means "killing all processes and starting fresh", which is what I do not want, and "locking" is "logging out but not stopping all processes so that when you log back in everything is still open", which is what I want.
How do I lock the computer, without fully logging out, directly from the command line? Or at least, how does the context menu at the top right corner of the screen do it? What command(s) does it run internally, and how can I emulate that without confirmation?
I am on Ubuntu 15.04 x64
with hardware from System76
, if this helps at all.
--force-logout
. – trysis Jun 10 '15 at 04:33gnome-session-quit
allows lock, which is what I really want, but not, that I can tell, inno-prompt
mode: here, it just allows logout, which I don't want. – trysis Jun 10 '15 at 04:40gnome-session-quit --help
), but it logs out, too. – trysis Jun 10 '15 at 04:44