Back to the command reference

tac

FilesBeginner In simulator In real Linux

Print files in reverse line order

Name: tac: cat spelled backwards

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

tac is cat in reverse: it prints the lines of a file from last to first. Handy for seeing the newest log entries first.

Syntax

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

Common options

-s / --separator STRINGSeparate records with STRING instead of newlines

Examples

  • $ tac app.log | head

    See the newest log lines first

    Explain

Related