I want to output the last 3000 lines of a log file.

In other words: I do not want to print the first 3000 lines of the log file: Instead I want to print the last 3000 lines of a log file.

I know tacprints out to the terminal screen the log file in its entirety in reverse order. But I do not want to print out the entire file. I looked at the available options and it appears that tac cannot print out a certain number of lines.

Ultimately: I do not care if the last 3000 lines are printed out in ascending order or descending order: I just want to be able to see the last 3000 lines.



1 Answer 1


you can use:

tail -n 3000 | tac

if you want reverse order, otherwise, just

tail -n 3000

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .