Mastering `tee` for Split Output and Log Archiving

Quick Tip

Mastering `tee` for Split Output and Log Archiving

Challenge: You’re running a command and want to see its output on your terminal while simultaneously saving it to a log file for later analysis.

The Solution: Use the `tee` command to duplicate standard output.

your_command | tee /path/to/your/logfile.txt

Why it works: `tee` reads from standard input and writes to both standard output (so you see it) and one or more files (saving it). This allows for real-time monitoring and persistent logging in a single step.

Pro-Tip: Use `tee -a` to append to the log file instead of overwriting it: `your_command | tee -a /path/to/your/logfile.txt`

Linux Tips & Tricks | © ngelinux.com | 4/26/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments