Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用管道写入文件并显示到屏幕tee?
tee
这个命令实际上是这样做的,问题是它写入一个新文件并tail -f给我一个错误“截断文件”。
tail -f
ls -al | tee file.txt
-atee 的选项是您正在寻找的
-a
-a, --append append to the given FILEs, do not overwrite
所以你的行是:
ls -al | tee -a file.txt