Compare

tee vs shell redirection

When to duplicate output to both screen and file and when simple redirection is enough.

Shell redirection sends output to a file or stream target. `tee` is useful when you want to write output to a file while still seeing it in the terminal.

Use tee When

You want output written to a file and displayed live at the same time.

You are debugging pipelines or capturing logs without hiding terminal output.

Use Redirection When

You simply want output stored in a file or discarded elsewhere.

You do not need to inspect the stream interactively while it is being written.

Rule of Thumb

Use tee to duplicate output. Use redirection to reroute it.

Want the short version? Browse the compact sheet views and save the commands you use most into a Cheatbook.