zoukankan      html  css  js  c++  java
  • tee

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

    语  法: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 file1 file2 -

    输出到标准输出两次,同时保存到file1和file2中。

  • 相关阅读:
    mysqldump 备份导出数据排除某张表
    PHP中cookies跨目录无法调用解决办法
    数据库之mac上mysql root密码忘记或权限错误的解决办法
    mac攻略(4) -- 使用brew配置php7开发环境(mac+php+apache+mysql+redis)
    js中event.keyCode用法及keyCode对照表
    BigDecimal用法详解
    Java开发中的23种设计模式详解(转)
    常用正则表达式大全 (转)
    sql查询重复记录、删除重复记录方法大全
    使用连接来代替in和not in(使用外连接技巧)
  • 原文地址:https://www.cnblogs.com/skydragon/p/7227295.html
Copyright © 2011-2022 走看看