Tail -f starting from the whole file

I would like to follow the file, but it tail -f

always starts with the last 10 lines. Is there a way to output the entire file and then follow?

My goal is to find all occurrences of a string in the log, eg tail -f streaming_log | grep "string"

. But also includes all the previous lines.

I know what I can do tail -f -n 10000 file

, but I don't want to count the rows first.

+3


source to share


1 answer


-n +<line>

allows you to specify a start line ( 1

):



tail -f -n +1 file  # output entire file, then wait for new content

      

+4


source







All Articles