Text and processing

The tac command

Shows a file with the lines in reverse order: the last first. It is 'cat' backwards.

Syntax

tac [archivo]

Copy-ready examples

$ seq 1 3 | tacReverse the order

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • On huge files it loads everything into memory to reverse.

Related commands

FAQ

What is it for in practice?

To read logs starting from the most recent entry.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course