tee command

他是一個linux的指令,可以同時把指令的輸出顯示到螢幕(終端機)跟寫入檔案中

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(上為wikipedia上的圖示說明)

Windows

如果是Windows環境下要使用的話,先到

https://sourceforge.net/projects/unxutils/?source=dlp

下載這個壓縮檔。

裡面有個叫做tee.exe的檔案,找到之後把它複製到C:\Windows\System32的資料夾下面。

之後就可以到終端機玩看看了。

使用方法

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

假設我在這個資料夾下用dir(或ls)指令,要把他的輸出給tee出來ㄉ話

​​​​dir | tee -a tee.txt

就只是在你真正要用的指令後面用 ' | '分開而已,很簡單的~

結果會變成這樣。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

打開tee.txt看看吧。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

基本上內容是跟CMD上顯示的相同。

那來這個指令有啥可以用的參數那些的??

​​​​tee [ -a ] [ -i ] [檔案 ... ]
​​​​
​​​​-a    寫檔的時候接在後面寫 (預設是會覆蓋整的檔案)
​​​​-i    忽略中斷 (蠻少用的)
​​​​檔案...    是表示你可以指定輸出多個檔案

嘿!就這樣沒了

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
ㄅㄅ