tee
Read from stdin and write to both stdout and one or more files simultaneously.
Synopsis
tee [OPTION]... [FILE]...
Examples
echo 'log entry' | tee log.txt
command | tee -a output.log
make 2>&1 | tee build.log
echo 'data' | sudo tee /etc/config
Common options
| Flag | Description |
|---|---|
| -a | Append to files instead of overwriting |
| -i | Ignore interrupt signals |
About tee
The `tee` command read from stdin and write to both stdout and one or more files simultaneously. Text processing commands transform, format, and generate text output.
Linux's philosophy of small composable tools shines here — these commands are designed to be piped together to build complex text-processing workflows. They are indispensable for scripting, log analysis, and data transformation tasks.
The command accepts 2 commonly used flags shown above, though the full set of options is available in the man page (`man tee`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Text Processing Commands
Other commands in the Text Processing category