Home » Linux tac Command

Linux tac Command

by Online Tutorials Library

Linux tac command

The ‘tac’ command is the reverse of the ‘cat’ command. It is also known as ‘cat’ backward. It will display the file content in reverse order. It prints the last line first, then second last and so on. Such way, it prints the first line at last.

Syntax:

Example:

Linux tac command

Look at the above snapshot; we have displayed the file ‘count’ with both the commands ‘cat’ and ‘tac’ to show the difference between the two.


To Separate The Content

The ‘tac –separator’ command will separate the content from the mentioned string or keyword from the rest of the file content.

Syntax:

Example:

Linux tac separator

Look at the above snapshot, in the first example; we have separated the content of file ‘count’ from the string “two” to the rest of the content with the help of ‘tac count –separator “two” ‘ command. Then, we separated the content from the string “five” and “one” in the next examples.

Next TopicLinux more

You may also like