Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

My Linux version is 2.6.32-47-server (gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1) ) #109-Ubuntu SMP Tue May 7 02:17:05 UTC 2013

I am currently doing a tail -f file and life is good. But that only shows the last X lines. Is it possible for tail to first display the whole file and then behave like tail -f?

I tried tail -500 -f file but that gave me tail: option used in invalid context -- 1
In a sense, it would be like cat file; tail -f file; But showing only the lines that were not displayed since the cat

Is it possible?

share|improve this question

marked as duplicate by Stéphane Chazelas, slm May 13 '14 at 17:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 2 down vote accepted

That's simply:

tail -fn+1 file
share|improve this answer

Another solution is to use the follow feature in less.

less -f file

You can enter follow mode in less by pressing Shift+f. Ctrl+c exits follow mode at which point the less functionality is returned.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.