I am using Ubuntu 12.04. Is there any way to lock the screen or session from a terminal command or script?
Ubuntu – How to lock the screen from a terminal?
command linelock-screen
command linelock-screen
I am using Ubuntu 12.04. Is there any way to lock the screen or session from a terminal command or script?
Best Answer
Simple:
The following can also work, if the screensaver is set to lock when activate (see screensaver settings), since the command activates the screensaver:
You can add an alias to the command by editing the file
.bashrc
(or.bash_aliases
) in your home directory:and adding the following line:
Then from terminal:
This will activate the alias. From now on, the alias
lock
in a terminal will have the effect of locking the screen.