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 have a constantly changing file and I wish to view the first n lines.Is this possible?

share|improve this question
Your file is being written to at the beginning ? Surely the first n lines will always be the same ? – Iain May 12 '11 at 10:23
up vote 10 down vote accepted

No. Use watch with it instead.

share|improve this answer
Specifically the usage would be: watch -n 2 head filename to check watch the head looks like every two seconds. Use watch -d to highlight differences. – Caleb May 12 '11 at 10:32

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.