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)五大常用算法
算法一:分治法 基本概念 1.把一个复杂的问题分成两个或更多的相同或相似的子问题,再把子问题分成更小的子问题--直到最后子问题可以简单的直接求解,原问题的解即子问题的解的合并. 2.分治策略是对于一个 ...
- MongoDb学习(四)--Repository----语法关键字
表7.查询方法支持的关键字 关键词 样品 逻辑结果 After findByBirthdateAfter(Date date) {"birthdate" : {"$gt& ...
- LockSupport的深入浅出
public static void main(String[] args)throws Exception { final Object obj = new Object(); Thread A = ...
- web.xml中配置启动时加载的servlet,load-on-starup
web.xml中配置启动时加载的servlet,load-on-starup 使用servlet来初始化配置文件数据: 在servlet的配置当中,<load-on-startup>1&l ...
- [从源码学设计]蚂蚁金服SOFARegistry之服务上线
[从源码学设计]蚂蚁金服SOFARegistry之服务上线 目录 [从源码学设计]蚂蚁金服SOFARegistry之服务上线 0x00 摘要 0x01 业务领域 1.1 应用场景 1.1.1 服务发布 ...
- python之random 、os 、sys 模块
一.random模块 import random print(random.random())#(0,1)----float 大于0且小于1之间的小数 print(random.randint(1,3 ...
- 并发编程--锁--volatile
在讲volatile关键字之前我们先了解Java的内存模型,Java内存模型规定所有的变量都是存在主存当中,每个线程都有自己的工作内存.线程对变量的所有操作都必须在自己的工作内存中进行,而不能直接对主 ...
- 2021升级版微服务教程4—Nacos 服务注册和发现
2021升级版SpringCloud教程从入门到实战精通「H版&alibaba&链路追踪&日志&事务&锁」 默认文件1610014380163 教程全目录「含视 ...
- Scrapy使用RabbitMQ做任务队列
前言 一个月没更博客了,这个月也搞了不少东西,但是公司对保密性要求挺高,很多东西都没有办法写出来 想来想去,还是写一篇最近写Scrapy中遇到的跳转问题 如果你的业务需求是遇到301/302/303跳 ...
- 【C++】《Effective C++》第七章
第七章 模板与泛型编程 条款41:了解隐式接口和编译期多态 面向对象设计中的类(class)考虑的是显式接口(explict interface)和运行时多态,而模板编程中的模板(template)考 ...