Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, in X session, I can use Ctrl-Alt-L to lock the screen, so it would ask for password to unlock and prevent somebody from messing with mine computer.

But if I have an open terminal session on one of the tty's (which I can access with Ctrl-Alt-F1, for example) - then it is not locked, and somebody can still use it to do some harm. Is there a way to 'lock' that command line (with some background processes running in it, maybe)?

share|improve this question
up vote 19 down vote accepted

vlock will do as you ask. However, if you want to run background processes, consider screen instead, which will let you also log off and keep processes running in the background, and then reattach -- even when logged in from alternate places.

share|improve this answer
can't get vlock with plugins, it installs without new.so, thus I can't use vlock -na – Sergius May 6 at 6:50

If you run screen in the terminal, you can lock the terminal with the command Ctrl-a x.

share|improve this answer
It is also possible to lock a screen session automatically after becoming idle. Just specify idle 900 lockscreen in your .screenrc to lock the session after being idle for 900 seconds (15 minutes). – scai Jul 30 '13 at 7:35

Check out "binarix". It will lock your Terminal. No need for X or screen.


share|improve this answer

I couldn't get vlock to work un osx, so I created a simple shellscript alternative.


share|improve this answer

if you have installed gnome you can use this command "gnome-screensaver-command -l" to lock your system

share|improve this answer
The OP asked how to lock tty, not X session. – Risto Salminen Oct 24 '13 at 7:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.