linux系统中tee命令

tee命令将输出到屏幕上的内容保存至文件中。

1、

[root@centos7 test]# ls
[root@centos7 test]# seq 3
1
2
3
[root@centos7 test]# ls
[root@centos7 test]# seq 3 | tee a.txt
1
2
3
[root@centos7 test]# ls
a.txt
[root@centos7 test]# cat a.txt
1
2
3

2、同时保存多份

[root@centos7 test]# rm *
[root@centos7 test]# ls
[root@centos7 test]# seq 3 | tee a.txt b.txt c.txt
1
2
3
[root@centos7 test]# ls
a.txt  b.txt  c.txt
[root@centos7 test]# cat a.txt
1
2
3
[root@centos7 test]# cat b.txt
1
2
3
[root@centos7 test]# cat c.txt
1
2
3
原文地址:https://www.cnblogs.com/liujiaxin2018/p/14993720.html