Site icon New Generation Enterprise Linux

Effortless Output Splitting with `tee`

Quick Tip

Effortless Output Splitting with `tee`

Challenge: You need to view the output of a command on your terminal *and* simultaneously save that output to a file for later analysis. Manually copying and pasting is tedious and error-prone.

The Solution: Use the `tee` command.

your_command | tee output.log

Why it works: `tee` reads from standard input and writes to standard output (so you see it on your screen) and also to one or more files. It acts like a “T” junction for data streams.

Pro-Tip: To append to an existing file instead of overwriting it, use `tee -a output.log`.

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

0 0 votes
Article Rating
Exit mobile version