tee

Official Description

Reads from standard input and writes to standard output and files.

Syntax

tee [-ai] file...
				

Options

-a appends output to file.

-i ignores INT signal.

Oddities

If one target file is unavailable, the output continues to the others.

Example

 $ ls -l b* -r-x-w-r-x 1 obrien obrien 47 Nov 26 12:19 buzz -rwxrwxr-- 1 obrien obrien 90 Nov 26 12:45 buzz1 -r-x-w-r-x 1 obrien users 47 Nov 27 13:31 buzz10 -rwxrwxr-- 1 obrien obrien 152 Nov 26 12:48 buzz2 -rwxrwxr-- 1 obrien obrien 116 Nov 26 14:07 buzz3 -rwxrwxr-- 1 obrien obrien 165 Nov 26 14:08 buzz4 $ $ ls -l b* > some_file # Can't see output when redirected $ $ ls -l b* | tee some_file # Pipe it to tee and it will do both # (redirect and display) -r-x-w-r-x 1 obrien obrien 47 ...

Get Korn Shell Programming by Example 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.