每日聚焦:Linux tee命令详解

时间:2023-03-13 09:01:21       来源:PHP中文网


(相关资料图)

本教程操作环境:linux5.9.8系统、Dell G3电脑。

linux 命令:tee 详解

tee 的功能是从标准输入读取,再写入标准输出和文件。

用法:tee [OPTION]... [FILE]...

使用示例:

默认功能和追加功能:

[root@server dir]# echo "This is a sentence." | tee outputThis is a sentence.[root@server dir]# cat outputThis is a sentence.[root@server dir]# echo "This is another sentence." | tee -a outputThis is another sentence.[root@server dir]# cat outputThis is a sentence.This is another sentence.[root@server dir]# echo "This is a unique sentence." | tee outputThis is a unique sentence.[root@server dir]# cat outputThis is a unique sentence.
登录后复制

同时写入两个文件:

[root@server dir]# tee a bthey have the same contentthey have the same content^C[root@server dir]# cat athey have the same content[root@server dir]# cat bthey have the same content
登录后复制
相关推荐:《Linux视频教程》

以上就是Linux tee命令详解的详细内容,更多请关注php中文网其它相关文章!

关键词: