linux命令-tee
来源:互联网 发布:正定矩阵的判定方法 编辑:程序博客网 时间:2024/05/21 00:16
1 帮助信息:tee –help
Usage: tee [OPTION]... [FILE]...Copy standard input to each FILE, and also to standard output. -a, --append append to the given FILEs, do not overwrite -i, --ignore-interrupts ignore interrupt signals --help display this help and exit --version output version information and exitIf a FILE is -, copy again to standard output.
2 功能
将数据输出到屏幕上的同时,将文件拷贝到指定的文件。
注:
1. tee命令的输入,只针对标准输出;
2. tee命令的输出,可以指定多个文件。
3 命令区别
标准输出如果想重定向到文件可以使用>或者>>,那么他们之间的区别为:
1. >或者>>重定向文件后,输出的内容屏幕不可见;
使用tee在将输出保存进文件时,输出的内容屏幕上同时显示;
2. tee通过指定不同的参数可以包含>和>>的功能
4 参数
-a, --append : 追加到文件,如果原来文件存在,则将新数据追加到文件- : 这个参数可以指定多个,每指定一个,就会在屏幕上多输出一份标准输出
5 示例
1. $cat file | tee 输出标准输入到屏幕2. $cat file | tee out 将标准输入输出屏幕的同时,保证在out里面一份。如果文件file不存在,那么out是空的3. $cat file | tee -a out 将标准输入追加到out文件;-a类似>>功能,如果不使用-a参数,如果原来out存在,则会覆盖原内容。
6 扩展
将标准错误输出也保存到文件
方法:将标准错误输出指向标准输出(2>&1),再使用tee即可
f1存在,文件内容为: f1 exitsf2不存在。使用如下命令后$ cat f1 f2 2>&1| tee out$ cat outf1 existcat: f2: No such file or directory
阅读全文
0 0
- linux tee命令
- linux tee命令
- Linux:tee命令
- linux命令之tee
- linux tee 命令详解
- linux tee 命令
- linux tee命令详解
- linux tee 命令详解
- linux tee 命令详解
- linux tee命令
- Linux shell tee 命令
- linux命令之tee
- linux tee 命令详解
- linux 命令之 tee
- linux tee 命令详解
- linux tee 命令详解
- linux 命令之tee
- Linux的tee命令
- 暑假集训第三周
- jquery小例子
- Treap
- servlet生命周期以及几种常见的异常总结
- ZooKeeper 学习 (六) ZooKeeper实现数据发布订阅(即配置中心)
- linux命令-tee
- 想读书
- git 版本回退
- null、undefined的 区别,== 、===的区别
- iOS-SDWebImage实现原理和理解
- 排序算法代码总结
- JAVA虚拟机字节码执行引擎小结
- 确定比赛名次 HDU
- 分割线