FAQ
overflow

Great Answers to
Questions About Everything

QUESTION

I have a growing log file for which I want to display only the last 15 lines. Here is what I know I can do:

tail -n 15 -F mylogfile.txt

As the log file is filled, tail appends the last lines to the display. I am looking for a solution that only displays the last 15 lines and get rid of the lines before the last 15 after it has been updated. Would you have an idea?

Thank you!

{ asked by Marc-Olivier Titeux }

ANSWER

It might suffice to use watch:

$ watch tail -n 15 mylogfile.txt
{ answered by William Pursell }
Tweet