tac - concatenate and print files in reverse.
On this page we only give you a short introduction with a few examples. We encourage you to read the manual (
Output a file's content
$ tac file.txt .... and here it ends This is a simple text file Hi there folks
Read from stdin
$ tac Hi this is the first line and this is the second .. and I press control-d to close the file .. and I press control-d to close the file and this is the second Hi this is the first line
Read from stdin and redirect to file
$ tac > file.txt Hi there This is just some text /John Doe
.. don't forget to press control-d. If we output the file
file.txt using cat we get:
$ cat file.txt /John Doe This is just some text Hi there
.... and, of course, as a fun exercise we get the following if we use
tac to output the content of the file.
$ tac file.txt Hi there This is just some text /John Doe