Is there a way to lock command line?
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.
If you run screen
in the terminal, you can lock the terminal with the command Ctrl-a x.