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

How do you make the escaping work so that the & is actually running the first command in the background?

# foo param1 param2 >> run.out &; tail -f run.out
share|improve this question
up vote 15 down vote accepted

Just drop the semicolon:

# foo param1 param2 >> run.out & tail -f run.out
share|improve this answer
It helps to think of the ampersand as a variant of the semicolon, which it is, really. – Teddy Oct 7 '09 at 4:52

You could use nohup:

nohup cmd & 

tail -f nohup.out
share|improve this answer

You need to put the backgrounded command in ()'s.

(ls -R / >>/tmp/list & ); tail -f /tmp/list

Sadly, this really backgrounds it. You won't be able to us %1 to get to its PID.

share|improve this answer

I just ran into this question as well, and solved it this way:

`foo param1 param2 >> run.out &` ; tail -f run.out

I don't know if the semantics are different.

For this specific case, the following is also useful:

foo param1 param2 | tee -a run.out
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.