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?

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.


That's simply:

tail -fn+1 file

-f to follow, -n+1 for tail to start from the first line (the beginning of the file).

  • Could you explain the command. I realise that -f follows new updates, but what does the n+1 mean? – Dom Mar 31 '15 at 9:16

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.

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