Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How can I suspend a whole command sequence in bash or zsh (or maybe some other shell)?

For example, if I run:

sleep 100; echo foo

and press Ctrl + Z, sleep is suspended and put into background, but echo then runs immediately.

I would like the latter not to happen, i.e. echo should run after sleep was resumed and completed.

share|improve this question

Execute them from subshell:

( sleep 100 ; echo foo ; )

And ctrl+z will freeze whole subshell, not just one command:

[1]+  Stopped                 ( sleep 100; echo foo ; )
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.