Davoud Teimouri

Virtualization & Datacenter

[How To]: Linux tac Command – Usage and Examples

Linux tac Command


tac command practically is reverse version of cat command. It means, any result in cat command will be reversed by tac command.

tac is lesser known and less used command in Linux but I want to show you the command usage and some examples.

Usage and Examples


tac command has few options same as cat command, we’ll review some of its options at the below.

Example 1

Comparison cat and tac outputs. In this example, we have a file with the below content:

Now, print the file’s content by tac:

Example 2

Both tac and cat commands has separator option which one of the most important options and the command is represented by the -s switch, which separates the contents of the file based on a string or a keyword from the file.

Example 3

The most important usage of tac command is, that it can provide a great help in order to debug log files, reversing the chronological order of log contents.

Or display the last lines by tac command.

5,137 total views, 108 views today

[How To]: Linux tac Command – Usage and Examples
5 (100%) 2 Votes
Davoud Teimouri is as a professional blogger, vExpert 2015-2016-2017, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

Leave a Reply

Teimouri.net © 2012 Frontier Theme
%d bloggers like this:
Read more:
vSphere 6.5
Supported Servers – vSphere 6.5

Which server brand do you use? HPE, Dell, Fujitsu or any other. It doesn't matter, you should check your server...

Close