terminal
Welcome to Linux Practice Terminal!
Type "help" to see available commands.
user@linux:~$
tee - 分流输出
学习使用tee将输出同时发送到屏幕和文件。
步骤 1
使用tee将"hello"写入output.txt,同时在屏幕上显示。
输入:echo hello | tee output.txt
echo hello | tee output.txt
步骤 2
用cat读取output.txt,验证文件已创建。
步骤 3
使用tee -a(追加模式)将"world"追加到output.txt。
步骤 4
检查output.txt,验证两行内容都在。