tac — Print File Lines in Reverse Order

The tac command prints a file from bottom to top. It is similar to cat, but it reverses the order of lines.

Basic use

tac filename.txt

This can be useful when reading logs or text files where the newest lines are at the end.

Example with a log file

tac /var/log/syslog

For large log files, tools like tail, less, or journalctl may be more practical.

Leave a Comment