linux command tee

Purpose

       Learning linux command  tee,  read from standard input and write to standard output and files

 

Eevironment

       Ubuntu 16.04 terminal

 【Produce

vmuer@vmuer-VirtualBox:/tmp$ ping www.baidu.com | tee ping.log  | grep error
^C
vmuer@vmuer-VirtualBox:/tmp$ cat ping.log 
PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=52 time=6.73 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=52 time=7.04 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=52 time=7.32 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=4 ttl=52 time=6.58 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=5 ttl=52 time=6.49 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=6 ttl=52 time=6.87 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=7 ttl=52 time=6.24 ms

 

原文地址:https://www.cnblogs.com/lianghong881018/p/12743996.html