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 ...
随机推荐
- A child container failed during start
先贴一下bug详情 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apa ...
- k8s重器之Service
Service是k8s的核心,通过创建Service,可以为一组具有相同功能的容器应用提供一个统一的入口地址,并将请求进行负载分发到各个容器应用上. 目录: Service定义详解 Service基本 ...
- Java网络编程:QQ邮件发送客户端程序设计
目录 一.目标介绍 1.认识SMTP(邮件传输协议) 2.POP3(邮件接收协议) 二.基于Base64编码邮箱及授权码 1.开通QQ邮箱SMTP/POP3服务 2.Java编写BASE64编码程序 ...
- Java将List中的实体按照某个字段进行分组的算法
public void test() { List<User> list = new ArrayList<>(); //User 实体 测试用 String id,name; ...
- informix部署安装
informix部署安装 一.环境准备 Linux版本:centos7.6 Linux主机名:localhost informix安装包:ibm.ids.14.10.FC4W1.LNX.tar inf ...
- jstat gcutil
QQA: jstat gcutil 的输出是什么意思 当 Java 程序有性能问题时,尤其是响应时间有突然变化时,最好第一时间查看 GC 的状态.一般用 jstat -gcutil <pid&g ...
- Java串口编程例子
最近笔者接触到串口编程,网上搜了些资料,顺便整理一下.网上都在推荐使用Java RXTX开源类库,它提供了Windows.Linux等不同操作系统下的串口和并口通信实现,遵循GNU LGPL协议.看起 ...
- 关于.NET中的控制反转(一)- 概念与定义
一.控制反转 1:类与类的依赖 依赖是面向对象中用来描述类与类之间一种关系的概念.两个相对独立的对象,当一个对象负责构造另一个对象的实例,或者依赖另一个对象的服务,这样的两个对象之间主要体现为依赖关系 ...
- Azure Terraform(四)状态文件存储
一,引言 我们都知道在执行部署计划之后,当前目录中就产生了名叫 "" 的 Terraform 的状态文件,该文件中记录了已部署资源的状态.默认情况下,在执行部署计划后,Terraf ...
- Python Kafka Client 性能测试
一.前言 由于工作原因使用到了 Kafka,而现有的代码并不能满足性能需求,所以需要开发高效读写 Kafka 的工具,本文是一个 Python Kafka Client 的性能测试记录,通过本次测试, ...