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

语  法: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. linux第5天 socket api

    IPv4套接口地址结构通常也称为“网际套接字地址结构”,它以“sockaddr_in”命名,定义在头文件<netinet/in.h>中 通用地址结构用来指定与套接字关联的地址.以socka ...

  2. struts_22_xwork校验器列表使用说明

    系统提供的校验器列表如下: required (必填校验器,要求field的值不能为null) requiredstring (必填字符串校验器,要求field的值不能为null,并且长度大于0,默认 ...

  3. php session memcache

    ini_set("session.save_handler", "memcache"); ini_set("session.save_path&quo ...

  4. C# eval()函数浅谈

    <%# Bind("Subject") %> //绑定字段 <%# Container.DataItemIndex + 1%> //实现自动编号<%# ...

  5. 一天弹出一次广告cookie

    function setCookie(name, value, expire) { window.document.cookie = name + "=" + escape(val ...

  6. 夺命雷公狗—angularjs—5—ng-switch的用法实现下拉更换板块的实现

    这个方法一般都会是和别的块状元素进行绑定同时使用的,废话不多说,直接上代码: <!doctype html> <html lang="en"> <he ...

  7. PAT乙级 1018. 锤子剪刀布 (20)

    1018. 锤子剪刀布 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 大家应该都会玩“锤子剪刀布”的游 ...

  8. zw版【转发·台湾nvp系列Delphi例程】HALCON TileChannels

    zw版[转发·台湾nvp系列Delphi例程]HALCON TileChannels unit Unit1;interfaceuses Windows, Messages, SysUtils, Var ...

  9. [crunch bang]在Crunch Bang安装和设置fcitx(小企鹅输入法)

    试来试去还是喜欢小企鹅多一些 第一步:在终端下 sudo apt−get install fcitx fcitx−sunpinyin  fcitx-ui-classic fcitx-table sud ...

  10. Android学习参考

    收到一些朋友的微博私信,说能不能给Android新手们一些指导,我只能说指导谈不上,毕竟我也很多东西正在学习中,与此同时一大学同学准备转行Android,可以说是从头开始,那么我就姑且以一个过来人的身 ...