Text and processing

The tee command

Shows the output on screen and saves it to a file at the same time. It is the 'T' of a pipeline: it writes to two places.

Syntax

comando | tee archivo

Most useful options

-aAppends instead of overwriting

Copy-ready examples

$ echo hola | tee nota.txtSee and save at once

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

Typical mistakes

  • Without -a, tee overwrites the file just like the > operator.

Related commands

FAQ

Why use it if I already have >?

So you do not lose the on-screen output: with > you see nothing.

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