The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

ttac - Reverse Output





The tac command is the reverse of the cat command, and its action is to reverse the order of lines in a file. This means that the first line becomes the last line, and the last line becomes the first line.

The syntax of the tac command is as follows:
tac [OPTIONS] [FILE] .

Some common options for the tac command include:


For example:
$ seq 1 5 | tac ←Reverse the sequence 1 to 5
5
4
3
2
1
$ tac file ←Read a file in reverse order

For more detailed option parameters, please refer to the provided link.