tee—replicates the standard output

tee [ –ai ] [ filename ]

tee copies the standard input to the standard output and one or more files, as in ls|tee outfile. Output goes to screen and to outfile.

Example A.47.
date | tee nowfile

EXPLANATION

The output of the date command is displayed on the screen and also stored in nowfile.

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.