Concatenate and print files in reverse.

Synopsis

tac [FILE]...

Description

Writes each FILE to standard output with the order of the lines reversed. If no FILE is given, or FILE is -, reads standard input.

Examples

$ printf 'a\nb\nc\n' | tac

Print c, b, a.

$ tac log.txt

Print a log file with its most recent lines first.

Notes

The opposite of cat: reverses line order rather than concatenating unchanged. Different from rev, which reverses characters within each line.

See Also

cat, rev, sort