tac [options] file [...]
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 startexprStart printing at the first line that matches the given REX expression. By default
tacwill start printing with the last line of the file.
-e endexprEnd printing with the first line that matches the given REX expression. By default
tacwill print until the start of the file is reached. Note: Since
tacreads the file backwards by default, the
startexprwill occur after the
endexprin the original file, even though it appears first in the output.
-n linesRead at most this many
linesfrom the file. This includes any lines read but not printed before the
startexprmatches. 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.
-fRead forward from the start of the file (like
cat) instead of backwards from the end.
Show all of today's web server hits from the log, since midnight. Note that
13/Apr/1999 is yesterday's date:
tac -e '13/Apr/1999' /usr/local/httpd/logs/transfer.log