tee

Read from standard input and write to both standard output and files.

What it does

tee splits output: it sends data to the screen and to one or more files at the same time.

Quick Start

ls | tee output.txt
echo "hello" | tee file.txt

Examples

# Append instead of overwrite
echo "log entry" | tee -a logfile.txt

# Capture command output while viewing it
make | tee build.log

Notes