Tac - A command to print files in reverse
Probably one of the very first commands we come across while learning Linux/Unix is “cat”. It is used to concatenate multiple files and throw them all on the standard output i.e. print them on a terminal. Not many know this, but there exists a twin of cat, named “tac”, which is similar to it but does everything in reverse - kind of an “evil twin” ;).
Here is a simple example. Lets say we have a file with the following contents(this is usually what we use cat for).
[shredder12]$ cat file
line 1
line 2
now tac will do exactly the reverse
[shredder12]$ tac file
line 2
line 1





. 





















1 Comment
Post new comment