$ ls a* a a1 aa anaconda-ks.cfg # 显示文件列表并保存到指定文件中 $ ls a* |tee a.txt a a1 aa anaconda-ks.cfg $ more a.txt a a1 aa anaconda-ks.cfg # -a追加内容到指定文件 $ seq 1 5 |tee -a a.txt $ more a.txt
# 显示变量并保存到文件 $ echo$USER |tee user $ echo$USER |tee -a user # 实时查看新增日志并同步保存到指定文件中 $ tailf /var/log/messages |tee -a m.log