< Previous | Contents | Next >
tee – Read From Stdin And Output To Stdout And Files
In keeping with our plumbing metaphor, Linux provides a command called tee which creates a “tee” fitting on our pipe. The tee program reads standard input and copies it to both standard output (allowing the data to continue down the pipeline) and to one or more files. This is useful for capturing a pipeline's contents at an intermediate stage of process- ing. Here we repeat one of our earlier examples, this time including tee to capture the
[me@linuxbox ~]$ ls /usr/bin | tee ls.txt | grep zip
bunzip2 bzip2 gunzip gzip unzip zip zipcloak zipgrep zipinfo zipnote zipsplit
[me@linuxbox ~]$ ls /usr/bin | tee ls.txt | grep zip
bunzip2 bzip2 gunzip gzip unzip zip zipcloak zipgrep zipinfo zipnote zipsplit