Mastering `tee` for Split Output and Log Archiving
Quick Tip
Mastering `tee` for Split Output and Log Archiving
Challenge: You need to see the output of a command in real-time on your terminal AND simultaneously save it to a log file for later analysis.
The Solution: Utilize the `tee` command to duplicate output streams.
your_command | tee output.log
Why it works: The `tee` command reads from standard input and writes to standard output and one or more files. This allows you to “tee” the output to both your terminal and a file simultaneously.
Pro-Tip: Use `tee -a` to append to the log file instead of overwriting it with each execution. For example: `your_command | tee -a full_output.log`
Linux Tips & Tricks | © ngelinux.com | 4/29/2026
