Linux and Unix tac command

Quick links

About tac
Syntax
Examples
Related commands
Linux and Unix main page

About tac

Concatenate and print files in reverse.

Syntax

tac [OPTION]... [FILE]...

-b, --beforeattach the separator before instead of after
-r, --regexinterpret the separator as a regular expression
-s, --seperator=STRINGuse STRING as the separator instead of newline
--helpdisplay this help and exit
--versionoutput version information and exit

Examples

tac file1.txt > file2.txt

Reverses the data in file1.txt and outputs the results into file2.txt.

Related commands

cat