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

I'd like to run this command:

watch -n 1 tail -n 200 log/site_dev.log | grep Doctrine

But it does not run, because "I think" that the grep tries to run on the watch instead of the tail...

Is there a way to do something like

watch -n 1 (tail -n 200 log/site_dev.log | grep Doctrine)

Thanks a lot!

share|improve this question
up vote 82 down vote accepted

Surround the command with quotes

watch -n 1 'tail -n 200 log/site_dev.log | fgrep Doctrine'
share|improve this answer
Thanks for this!!! It works fine – TomShreds May 12 '10 at 19:31
@TomShreds you should give some internet points to tonylo and accept this answer :) – Malcolm Dec 4 '13 at 22:17

I might be wrong, but wouldn't this achieve the same thing more simply?

tail -f -n 200 log/site_dev.log | grep Doctrine
share|improve this answer
WONDERFUL! :) Thanks that is very good! – TomShreds May 12 '10 at 20:18
I agree this may be more efficient as far as CPU is concerned, but in the context of the topic "Using watch with pipes" it doesn't use watch so isn't an answer. This might be a case of a poor example question as watch and pipes seem to appear frequently not in the context of tail. – tudor Jan 20 '14 at 0:07

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.