簡明Linuxコマンドラインメモ:tee
1255 ワード
標準入力を標準出力と1つ以上のファイルにコピー
tee [options] file-list
file-listはtee出力を受信するためのファイルパスリストであり、file-listが存在しない場合に作成されます.
-a上書きではなく作成したファイルにデータを追加
-i割り込み信号を無視
ファイルを作成してデータを書き込みます.cat>fileと同じように使用しますが、データを書き込むだけでなくteeも印刷されます.
ctrl+D終了
ファイルにデータを追加し、標準出力に印刷します.cat>>fileと同じように使用します.
tee [options] file-list
パラメータ
file-listはtee出力を受信するためのファイルパスリストであり、file-listが存在しない場合に作成されます.
オプション
-a上書きではなく作成したファイルにデータを追加
-i割り込み信号を無視
例
tee
$ tee a.txt
hello world
hello world
$ cat a.txt
hello world
ファイルを作成してデータを書き込みます.cat>fileと同じように使用しますが、データを書き込むだけでなくteeも印刷されます.
ctrl+D終了
tee -a
$ tee -a a.txt
this is the last time
this is the last time
$ cat a.txt
hello world
this is the last time
ファイルにデータを追加し、標準出力に印刷します.cat>>fileと同じように使用します.