tee 命令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
tee [-ai][--help][--version][文件...]-a或--append 附加到既有文件的后面,而非覆盖它.
-i或--ignore-interrupts 忽略中断信号。
--help 在线帮助。
--version 显示版本信息。
(1)使用 tee 命令将用户输入的数据保存到 myFile 文件,如下:
[hxstrive@localhost ~]$ tee myFile
hi! www.hxstrive.com # 输入的数据
hi! www.hxstrive.com # 回车后 tee 命令反馈的信息
^C # 按 Ctrl+C 退出 tee 命令
# 查看 myFile 内容
[hxstrive@localhost ~]$ cat myFile
hi! www.hxstrive.com(2)使用 tee 命令将用户输入的数据保存到 myFile1 和 myFile2 文件,如下:
[hxstrive@localhost ~]$ tee myFile1 myFile2
hi! www.hxstrive.com # 输入的数据
hi! www.hxstrive.com # 回车后 tee 命令反馈的信息
^C # 按 Ctrl+C 退出 tee 命令
# 查看 myFile1 内容
[hxstrive@localhost ~]$ cat myFile1
hi! www.hxstrive.com
# 查看 myFile2 内容
[hxstrive@localhost ~]$ cat myFile2
hi! www.hxstrive.com更多关于命令详细参考手册,请使用 man 命令或者 --help 参数获取帮助信息