The NoteBook of EricKong

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            611 Posts :: 1 Stories :: 190 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(11)

          我參與的團隊

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          linux 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中。


          posted on 2015-06-11 11:43 Eric_jiang 閱讀(175) 評論(0)  編輯  收藏 所屬分類: Linux
          主站蜘蛛池模板: 建水县| 清流县| 金寨县| 义乌市| 安平县| 通江县| 永德县| 锡林郭勒盟| 山丹县| 田阳县| 台南县| 彩票| 屯留县| 西平县| 浮梁县| 罗山县| 禹州市| 闸北区| 广灵县| 保德县| 浦县| 宝应县| 恭城| 登封市| 灵山县| 莱西市| SHOW| 通州区| 通山县| 紫云| 含山县| 洱源县| 鄂温| 漳平市| 峨眉山市| 综艺| 桃园市| 绥中县| 双鸭山市| 方城县| 阜南县|