目录

常用重定向及解释

目录
警告
本文最后更新于 2022-06-23,文中内容可能已过时。

Linux 标准输出(stdout)和标准错误(stderr)的重定向

1
2
3
4
> 以擦写的模式重定向至...
>> 以追加的模式重定向至...
1 代表stdout标准输出
2 代表stderr标准错误
1
command 2>&1 output.txt
1
2
command > output.txt
#command &1> output.txt
1
command >> output.txt
1
command 2> output.txt
1
command 2>> output.txt
1
command &> output.txt
1
command &>> output.txt
1
command | tee output.txt
1
command | tee -a output.txt
1
(*)
1
command |& tee output.txt
1
command |& tee -a output.txt