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

语  法: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. form文件上传,防止页面刷新

    <!DOCTYPE html><html><head><meta charset="UTF-8"><title>文件上传 ...

  2. android 三种定位方式

    http://www.cnblogs.com/oudi/archive/2012/03/22/2411509.html 最近在看android关于定位的方式,查了很多资料,也做了相关实验,在手机上做了 ...

  3. yii2自动生成表单

    视图中: 1.要use的两个文件类 use yii\helpers\Html;   use yii\widgets\ActiveForm; 2.生成表单,以添加商品为例说明.注意红线区域:上传文件需要 ...

  4. android 学习随笔十四(页面跳转与数据传递)

    1.activity 创建第二个Activity 需要在清单文件中为其配置一个activity标签 标签中如果带有这个子节点,则会在系统中多创建一个快捷图标 <intent-filter> ...

  5. 编写更少bug的程序的六条准则

          如何编写更少bug的程序?  尽可能避免常见的程序错误.              沟通设计先行 + 编写可复用代码 + 做得更多 + 做的更少 + 创造“编程心流”+ 严格的程序测试   ...

  6. DataSnap 的连接事件顺序图

    无意看到这两幅图,虽然已经了解,还是转一份保留以备后用

  7. git 使用详解(5)-- get log 查看提交历史【转】

    转自:http://blog.csdn.net/wh_19910525/article/details/7468549 版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] 限制 ...

  8. Dynamics AX 2012 R2 切换环境后项目导入报错

        Reinhard重装了服务器.重装后,导入项目A报错,错误提示如下: A table, Extended Data Type, Base Enum or class called ???? a ...

  9. HDU 1520:Anniversary party(树形DP)

    http://acm.split.hdu.edu.cn/showproblem.php?pid=1520 Anniversary party Problem Description   There i ...

  10. node-webkit教程<>Native UI API 之Menu(菜单)

    node-webkit教程(6)Native UI API 之Menu(菜单)1 前言... 2 6.1  Menu 概述... 3 6.2  menu api6 6.2.1  new Menu([o ...