Tee

来自WordPress中文文档
跳转至: 导航搜索

Linux命令:tee

功能说明: 读取标准输入的数据,并将其内容输出成文件。

语  法:tee [-ai][--help][--version][文件...]
补充说明:tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
参  数:
-a或--append  附加到既有文件的后面,而非覆盖它. 
-i-i或--ignore-interrupts  忽略中断信号。 
--help  在线帮助。 
--version  显示版本信息。

英文版本,欢迎翻译:

ABOUT TEE

Read from an input and write to a standard output or file.

SYNTAX

telnet [OPTION]... [FILE]...

-a --append Append to the given FILEs, do not overwrite. -i ignore interrupt signals. --help Display the help screen. --version Display the version.


EXAMPLES

ls *.txt | wc -l | tee /dev/tty count.txt

In the above example the ls command would list all .htm files in the current directory, take a word count (wc) by the amount of lines (-l) and the output displayed to the /dev/tty (terminal) will be sent to the count.txt.

Note: Because the above example did not take advantage of the -a or append option if the count.txt file already existed it would have been overwritten.