功能说明:读取标准输入的数据,并将其内容输出成文件。

语  法:tee [-ai][--help][--version][文件...]

补充说明:tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。

参  数:
-a或--append  附加到既有文件的后面,而非覆盖它.
-i-i或--ignore-interrupts  忽略中断信号。
--help  在线帮助。
--version  显示版本信息

用途说明

在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我们就不能看到输出了,如果我们既想把输出保存到文件中,又想在屏幕上看到输出内容,就可以使用tee命令了。tee命令读取标准输入,把这些内容同时输出到标准输出和(多个)文件中(read from standard input and write to standard output and files. Copy standard input to each FILE, and also to standard output. If a FILE is -, copy again to standard output.)。在info tee中说道:tee命令可以重定向标准输出到多个文件(`tee': Redirect output to multiple files. The `tee' command copies standard input to standard output and also to any files given as arguments.  This is useful when you want not only to send some data down a pipe, but also to save a copy.)。

注意的是:在使用管道线时,前一个命令的标准错误输出不会被tee读取。

常用参数

格式:tee

只输出到标准输出,因为没有指定文件嘛。

格式:tee file

输出到标准输出的同时,保存到文件file中。如果文件不存在,则创建;如果已经存在,则覆盖之。(If a file being written to does not already exist, it is created. If a file being written to already exists, the data it previously

contained is overwritten unless the `-a' option is used.)

格式:tee -a file

输出到标准输出的同时,追加到文件file中。如果文件不存在,则创建;如果已经存在,就在末尾追加内容,而不是覆盖。

格式:tee -

输出到标准输出两次。(A FILE of `-' causes `tee' to send another copy of input
to standard output, but this is typically not that useful as the copies
are interleaved.)

注意 - 后面没有任何参数

格式:tee -i file1 file2 -

输出到标准输出两次,同时保存到file1和file2中。-i是忽略

tee 命令基本使用方法、输出到多个文件的更多相关文章

  1. 将Java和Javac的命令在控制台的输出重定向到txt文件

    当我们在Windows控制台窗口执行程序时,输入如下命令: demo.exe > out.txt 就可以把demo程序的输出重定向到out.txt文件里面. 但是这种方法对于java和javac ...

  2. 显示程序输出并复制到文件(tee 命令)

    Linux tee命令用于读取标准输入的数据,并将其内容输出成文件. tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件. 语法 tee [-ai][--help][--v ...

  3. Linux Shell脚本入门:tee命令

    用途说明   在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我们就不能看到输出了,如果我们既想把输出保存到文件中,又想在屏幕上看到输出内容,就可以使用tee ...

  4. linux tee 命令详解

    man tee: NAME tee - read from standard input and write to standard output and files SYNOPSIS tee [OP ...

  5. tee命令使用

    需求描述: 今天在看nginx内容的过程,遇到了tee这个命令,所以查询了下,在这里记录下使用方法. 操作过程: 1.执行以下的命令 [root@testvm ~]# uname -n | tee h ...

  6. linux系统中,tee命令的使用

    需求描述: 今天在看nginx内容的过程,遇到了tee这个命令,所以查询了下,在这里记录下使用方法. 操作过程: 1.执行以下的命令 [root@testvm ~]# uname -n | tee h ...

  7. Linux tee命令

    一.简介 tee以标准输入作为输入,标准输出和文件作为输出.   二.语法 Usage: tee [OPTION]... [FILE]... Copy standard input to each F ...

  8. [转]linux tee 命令详解

    转自: http://codingstandards.iteye.com/blog/833695 用途说明 在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我 ...

  9. Linux 重定向输出到多个文件中

    转自:http://codingstandards.iteye.com/blog/833695 用途说明 在执行Linux命令时,我们可以把输出重定向到文件中,比如 ls >a.txt,这时我们 ...

随机推荐

  1. hdu4918 Query on the subtree

    树分治,设当前树的分治中心为x,其子树分治中心为y,则设father[y]=x,分治下去则可以得到一颗重心树,而且树的深度是logn. 询问操作(x,d),只需要查询重心树上x到重心树根节点上的节点的 ...

  2. String.Format数字格式化参考

    String.Format数字格式化输出 {0:N2} {0:D2} {0:C2} (转) 数字 {0:N2} 12.36 数字 {0:N0} 13 货币 {0:c2} $12.36 货币 {0:c4 ...

  3. java使用json将HashMap转化成javabean小例子

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.sf.json.JSONOb ...

  4. 夺命雷公狗---node.js---5net模块玩telnet通信(中)

    我们理论知识太多还不如实战,我们来写一个可以通过telnet腾讯的小玩意玩玩: var net = require('net'); var ChatServer = net.createServer( ...

  5. Android应用开发中的风格和主题(style,themes)

    http://www.cnblogs.com/playing/archive/2011/04/01/2002469.html 越来越多互联网企业都在Android平台上部署其客户端,为了提升用户体验, ...

  6. 【LAMP】在Debian系linux下安装LAMP

    一.安装基本的编译环境 apt-get install build-essential 二.安装MySQL apt-get install mysql-server 三.安装Apache apt-ge ...

  7. 下拉框分组显示optgroup

    <select> <optgroup label="语言"> <option>中文</option> <option>英 ...

  8. OpenStack 界面开发中response.body的中文编码问题

    Contents [hide] 1 问题的引入= 1.1 解决办法 2 用户限制输入中文 3 不限制用户输入,呈现上修改 问题的引入= G在我们创建虚拟机的时候,会设置虚拟机的名称,描述,如果没有限制 ...

  9. Intent跳转传list集合

    先把List<>改为ArrayList<> ArrayList<Good> list=new ArrayList<Good>(); Intent int ...

  10. 如何修复损坏的MySQL数据表

    id=164 由于断电或非正常关机而导致MySQL数据库出现错误是非常常见的问题.有两种方法,一种方法使用mysql的check table和repair table 的sql语句,另一种方法是使用M ...