Server Fault is a question and answer site for system and network administrators. 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've queued a backgrounded command via

command 1 && command 2 &

command 1 is currently running, however I need to make sure command 2 is never executed.

If I need to kill command 1 in order to ensure this, that is fine.

Is this possible?

share|improve this question
up vote 2 down vote accepted

If you want to kill command1, then that will work. Otherwise you may be able to just rename command2 to something else - then when the shell tries to execute it, it won't find the command:

$ mv command2 command2.old
share|improve this answer
so killing the PID of command 1 will cause command 2 to never execute? – pstanton Mar 31 '11 at 21:40
Yes, that's what the && does. If you wanted it to continue even if command1 doesn't complete successfully, you'd replace && with ||. – EEAA Mar 31 '11 at 21:41
ah nice. the old logical operator. learn something every day! – pstanton Mar 31 '11 at 21:44

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.