和常用的 tee 類似,tee 會將 input 同時書出到螢幕和檔案,而 pee 則是將 input 丟給多個工具。
首先安裝 moreutils:
apt install moreutils
以下範例,將下載的 DVD ISO 透過 pee 同時將檔案內容轉給 md5sum 和 sha256sum 計算 hash 值:
cat ubuntu-mate-22.04-desktop-amd64.iso | \
pee md5sum sha256sum
6fb51f15156b477955fff7732204a494 -
c441ba839ccaff67e27c15423da006dc7b708641973c5c82c2d67ea5799be34b -
如果剛好有 monitor 的話,可以注意到檔案只要讀取一次,就能讓 md5sum 和 sha256sum 同時計算 hash 值:

讀取 ISO 檔其實還不算太花時間,但若是要為 500 GB 的備份檔建立 hash 就頭大了,pee 這個工具可以在這類情境下節省不少時間。