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.
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.
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.
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.
Use tee to duplicate output. Use redirection to reroute it.