Viewing Content

tac

Prints files in reverse line order.

tac is cat backwards: it outputs the last line first and the first line last.

Syntax
tac [file...]

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Reverse a file
tac events.log | less

Shows newest-looking lines first when the file is chronological.

Reverse pipeline output
history | tac | head

Shows the most recent shell history entries.

tac Command
FieldDetails
Commandtac
CategoryViewing Content
Primary usePrints files in reverse line order.
Syntaxtac [file...]