「Linux入門」teeコマンドの使い方

1.標準入力をファイルに保存
# tee test.txt
this is a test
this is a test
# cat test.txt
this is a test

2.標準出力をファイルに保存
# echo “yamada,21,engineer " | tee test.csv
yamada,21,engineer
# cat test.csv
yamada,21,engineer

3.標準エラー出力をファイルに保存
# ping 172.17.3.11 2>&1 | tee save.txt
PING 172.17.3.11 (172.17.3.11) 56(84) bytes of data.
From 172.17.0.1 icmp_seq=1 Destination Host Unreachable
# cat save.txt
PING 172.17.3.11 (172.17.3.11) 56(84) bytes of data.
From 172.17.0.1 icmp_seq=1 Destination Host Unreachable

Linux

Posted by arkgame