Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I am trying to lock and suspend from the terminal. I tried:

pmi action suspend | at now + 1 min

And then typed


But both that and vlock kill the running command. Is there a way to lock the terminal and than get the computer to suspend using only Terminal commands?

share|improve this question… – Raja Feb 11 '13 at 15:03
This command only seems to work in a terminal running side the GUI. When I try and run it from a virtual terminal it dosn't work also it does not lock the virtual terminal itself. – JGreen Feb 11 '13 at 18:43
Have you tried pm-suspend from the pm-utils package? – Attila O. Feb 12 '13 at 2:09
up vote 2 down vote accepted

I use sudo -v;gnome-screensaver-command --lock;sleep 10;sudo pm-suspend, with the sleep long enough for me to put the kbd and mouse away. Look at man pm-action for other commands (pm-hibernate,pm-suspend-hybrid), and be aware that hibernate doesn't work with encrypted swap.

share|improve this answer

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.