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

 

posted @ 2021-07-10 14:06  小鲨鱼2018  阅读(212)  评论(0编辑  收藏  举报