tee MultiWriter creates a writer that duplicates its writes to all the // provided writers, similar to the Unix tee(1) command.
https://zh.wikipedia.org/wiki/Tee
在计算机科学中,tee是一个常见的指令,它能够将某个指令的标准输出,导向、存入某个档案中。许多不同的命令行界面(Shell)都提供这个功能,如 Unix shell、Windows PowerShell。
tee的功能通常是用管道,让它不但能在萤幕输出,而且也能够将它储存在档案中。当一个资料在被另一个指令或程式改变之前的中间输出,也能够用tee来捕捉它。tee命令能够读取标准输入,之后将它的内容写入到标准输出,同时将它的副本写入特定的档案或变数中。
tee [ -a ] [ -i ] [檔案 ... ]
参数:
檔案
一个或多个档案,能够接收 tee-d 的输出。
Flags:
-a
追加(append)到目标文件而不是覆盖-i
忽略中断。
[cpy@public ~]$ ll -as
总用量 32
0 drwx------ 10 cpy cpy 206 12月 25 17:50 .
0 drwxr-xr-x. 8 root root 111 12月 25 15:45 ..
12 -rw------- 1 cpy cpy 12194 12月 23 19:58 .bash_history
4 -rw-r--r-- 1 cpy cpy 18 8月 3 2016 .bash_logout
4 -rw-r--r-- 1 cpy cpy 193 8月 3 2016 .bash_profile
4 -rw-r--r-- 1 cpy cpy 231 8月 3 2016 .bashrc
0 drwxrwxr-x 4 cpy cpy 34 12月 9 19:12 .cache
0 drwxrwxr-x 3 cpy cpy 18 11月 25 11:53 .config
4 -rw-rw-r-- 1 cpy cpy 35 12月 25 17:50 file
0 drwxrwxr-x 7 cpy cpy 120 12月 23 16:59 game_manager
0 drwxrwxr-x 4 cpy cpy 28 12月 9 19:12 go
4 drwxrwxr-x 10 cpy cpy 4096 11月 26 12:25 perfCCpp
0 drwxrw---- 3 cpy cpy 19 12月 9 19:12 .pki
0 drwxrwxr-x 5 cpy cpy 176 12月 14 11:53 soft
0 drwx------ 2 cpy cpy 25 11月 25 12:21 .ssh
[cpy@public ~]$ ll -as | tee file | cat
总用量 28
0 drwx------ 10 cpy cpy 206 12月 25 17:50 .
0 drwxr-xr-x. 8 root root 111 12月 25 15:45 ..
12 -rw------- 1 cpy cpy 12194 12月 23 19:58 .bash_history
4 -rw-r--r-- 1 cpy cpy 18 8月 3 2016 .bash_logout
4 -rw-r--r-- 1 cpy cpy 193 8月 3 2016 .bash_profile
4 -rw-r--r-- 1 cpy cpy 231 8月 3 2016 .bashrc
0 drwxrwxr-x 4 cpy cpy 34 12月 9 19:12 .cache
0 drwxrwxr-x 3 cpy cpy 18 11月 25 11:53 .config
0 -rw-rw-r-- 1 cpy cpy 0 12月 25 17:51 file
0 drwxrwxr-x 7 cpy cpy 120 12月 23 16:59 game_manager
0 drwxrwxr-x 4 cpy cpy 28 12月 9 19:12 go
4 drwxrwxr-x 10 cpy cpy 4096 11月 26 12:25 perfCCpp
0 drwxrw---- 3 cpy cpy 19 12月 9 19:12 .pki
0 drwxrwxr-x 5 cpy cpy 176 12月 14 11:53 soft
0 drwx------ 2 cpy cpy 25 11月 25 12:21 .ssh
[cpy@public ~]$
In computing, tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input.[1] It is primarily used in conjunction with pipes and filters. The command is named after the T-splitter used in plumbing.[2]
The tee
command is normally used to split the output of a program so that it can be both displayed and saved in a file. The command can be used to capture intermediate output before the data is altered by another command or program. The tee command reads standard input, then writes its content to standard output. It simultaneously copies the result into the specified file(s) or variables. The syntax differs depending on the command's implementation.
io/multi.go
// MultiWriter creates a writer that duplicates its writes to all the
// provided writers, similar to the Unix tee(1) command.
//
// Each write is written to each listed writer, one at a time.
// If a listed writer returns an error, that overall write operation
// stops and returns the error; it does not continue down the list.
func MultiWriter(writers ...Writer) Writer {
allWriters := make([]Writer, 0, len(writers))
for _, w := range writers {
if mw, ok := w.(*multiWriter); ok {
allWriters = append(allWriters, mw.writers...)
} else {
allWriters = append(allWriters, w)
}
}
return &multiWriter{allWriters}
}
tee MultiWriter creates a writer that duplicates its writes to all the // provided writers, similar to the Unix tee(1) command.的更多相关文章
- Linux shell tee指令学习
转载自:http://blog.163.com/xujian900308@126/blog/static/12690761520129911304568/ tee tee:读取标准输入的数据,并将 ...
- tee 解决readonly 文件无法修改
tee 是什么: 老规矩,找男人问.
- 可信执行环境(TEE)介绍
可信执行环境(TEE)是Global Platform(GP)提出的概念.针对移动设备的开放环境,安全问题也越来越受到关注,不仅仅是终端用户,还包括服务提供者,移动运营商,以及芯片厂商.TEE是与设备 ...
- 可信执行环境TEE(转)
硬件威胁:ARM的架构设计 软件威胁 TEE是中等安全级别 可信执行环境(TEE)是Global Platform(GP)提出的概念.针对移动设备的开放环境,安全问题也越来越受到关注,不仅仅是终端用户 ...
- Linux tee的花式用法和pee
1.tee多重定向 tee [options] FILE1 FILE2 FILE3... tee的作用是将一份标准输入多重定向,一份重定向到标准输出/dev/stdout,然后还将标准输入重定向到每个 ...
- Linux tee命令详解
Linux tee命令 Linux tee命令用于读取标准输入的数据,并将其内容输出成文件.如果文件指定为"-",则将输入内容复制到标准输出 tee指令会从标准输入设备读取数据,将 ...
- 可信执行环境(TEE)介绍 与应用
原文:http://blog.csdn.net/wed110/article/details/53894927 可信执行环境(TEE,Trusted Execution Environment) 是G ...
- TEE&TrustZone
一.TEE(Trusted Execution Environment) 1 A look back 1)2009 OMTP(Open Mobile Terminal Platform),首次定义了T ...
- 显示程序输出并复制到文件(tee 命令)
Linux tee命令用于读取标准输入的数据,并将其内容输出成文件. tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件. 语法 tee [-ai][--help][--v ...
随机推荐
- 要多用Java帮助文档
从第一次接触Java到现在,大概两年了吧,间断断续续的学习.毕竟还在上课,其他课程也挺耗时间,但更多的还是自己不自律,很多时间都在玩. 平时用的有eclipse和IDEA,使用快捷方式有时看看源码,也 ...
- java.lang.NoSuchMethodError的解决办法
开发一个知识图谱在线服务(基于springcloud+vue)构建中医理论的知识图谱构建帕金森的知识图谱提供免费的知识图谱服务,希望能为朋友们的生活.学习.工作提供帮助(敬请期待)PS:关注后,点击头 ...
- JAVA 实体类List<Entity >转 List<Map>
public static <T extends IdEntity> List<Map<Object,Object>> EntityConvertMap(List& ...
- Spring Boot中初始化资源的几种方式
CommandLineRunner 定义初始化类 MyCommandLineRunner 实现 CommandLineRunner接口,并实现它的 run()方法,在该方法中编写初始化逻辑 注册成Be ...
- java线程与内核线程的关系,及怎么定义ThreadPoolExecutor相关参数
p.p1 { margin: 0; font: 12px Menlo } p.p1 { margin: 0; font: 12px Menlo } p.p2 { margin: 0; font: 12 ...
- TurtleBot3使用课程-第一节a(北京智能佳)
目录 1.ROS设置(远程PC) 2 1.1 ROS安装和设置 2 1.1.1 设置source.list 2 1.1.2 键设置 2 1.1.3 ROS安装 2 1.1.4安装包构建的依赖关系 2 ...
- javabean 数组对应yml中的写法
gate-info: gate-list: - channel: channel-one io-flag: I - channel: channel-two io-flag: E 上面的是 yml 文 ...
- linux awk基本语法命令总结
一.基本用法 文本内容准备 2 this is a test 3 Are you like awk This's a test 10 There are orange,apple,mongo 用法一: ...
- js概念和ECMAScript
概念 就是一门浏览器客户端的脚本语言 运行在客户端浏览器中的,每一个浏览器都有JavaScript的解析引擎. 脚本语言,不需要编译,直接就可以被浏览器解析执行. 好处: 可以增强一些用户的 ...
- redis 6.0新特性
防止忘记,记录一下 1.多线程IO Redis 6引入多线程IO,但多线程部分只是用来处理网络数据的读写和协议解析,执行命令仍然是单线程.之所以这么设计是不想因为多线程而变得复杂,需要去控制 key. ...