将输出写入 stdout 以及文件

以下命令仅在屏幕(stdout)上显示输出。

$ ls 

以下命令仅将输出写入文件而不是屏幕。

$ ls > file

以下命令(在 tee 命令的帮助下)将输出写入屏幕(标准输出)和文件。

$ ls | tee file