Reverse text files in Linux console(shell)

Default featured post

I had a big list of ips which saved in a text file. This file was not sorted in any order, so I just want to reverse the content of the file and show/save it.

I searched on the net and I found tac command which is included in coreutils of GNU utility. Look at the example,

$ tac myfile.txt > myreversefile.txt

The above command put the reversed list in a new file as myreversefile.txt.

If you want just to see the file in reverse see below example,

$ tac myfile.txt

More information about tac command is available on its man page.