Linux tee命令用于读取标准输入的数据,并将其内容输出成文件。
tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
➜ ~ tee file
1
1
exit
exit
q
q
^C
➜ ~ cat file
1
exit
q
tee也可以和其他命令配合使用,以到达重定向的目的。相比重定向,tee具有输出反馈,这个功能在某些时候是很有用的,比如系统初始化信息保存到文件并打印。
➜ ~ ls|tee file2
Applications
Desktop
Documents
Downloads
GoProjects
IdeaProjects
Library
Movies
Music
Pictures
Postman
Public
TeamFile
conf
ddsconsole
file
go
logs
vipsrv-logs
➜ ~ cat file2
Applications
Desktop
Documents
Downloads
GoProjects
IdeaProjects
Library
Movies
Music
Pictures
Postman
Public
TeamFile
conf
ddsconsole
file
go
logs
vipsrv-logs