There is command called “tac” that does exactly opposite to what “cat” command does. The “tac” command concatenates and prints all files in reverse order. The following example shows how tac command behaves.

[neo@techpulp ~]# cat data.txt
line 1
line 2
line 3
line 4
line 5
[neo@techpulp ~]#

Let us use “tac” command to reverse all lines:

[neo@techpulp ~]# tac data.txt
line 5
line 4
line 3
line 2
line 1
[neo@techpulp ~]#