Linux小技巧:tee —— 显示并重定向内容

版权声明:作者-傲娇天子 博文主页地址:https://blog.csdn.net/qq_41116956 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢 https://blog.csdn.net/qq_41116956/article/details/83015181

linux下,显示文件内容的命令很多:

1:[root@localhost ~]# cat 1.txt 
   123
2:[root@localhost ~]# echo 123
   123

重定向在linux中也是常使用的:

[root@localhost ~]# echo 123456 > 1.txt
[root@localhost ~]# cat 1.txt 
123456

而tee命令就是先显示内容,在重定向内容

[root@localhost ~]# echo 123 | tee 1.txt     #覆盖
123
[root@localhost ~]# echo 123 | tee -a 1.txt    #追加  
123
[root@localhost ~]# cat 1.txt 
123
123

猜你喜欢

转载自blog.csdn.net/qq_41116956/article/details/83015181
今日推荐