tac – reverse file cat
tac [options] file […]
The tac program prints the given files, but starting from the end of file, in reverse line order. It is useful for quickly examining the last few lines of a log file in most-recent order. Available options are:
-s startexpr Start printing at the first line that matches the given REX expression. By default tac will start printing with the last line of the file.
-e endexpr End printing with the first line that matches the given REX expression. By default tac will print until the start of the file is reached. Note: Since tac reads the file backwards by default, the startexpr will occur after the endexpr in the original file, even though it appears first in the output.
-n lines Read at most this many lines from the file. This includes any lines read but not printed before the startexpr matches. It is a “safety limit” to avoid reading through all of a very large log file if the start or end expressions are not found.
-f Read forward from the start of the file (like cat) instead of backwards from the end.