Print files in reverse with coreutils ‘tac’ and ‘rev’ commands

tac_revSometimes it would be useful to print file contents or output of previously executed command in reverse. There are two little utilities that are part of Linux coreutils: tac and rev.

TAC concatenates and prints files in reverse (last line first). REV reverses lines of a file: it copies the specified files to the standard output, reversing the order of characters in every line.


Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *