慕工程0101907
2019-09-03 12:04:45
將所有輸出重定向到文件我知道在linux中,要將輸出從屏幕重定向到文件,可以使用>或tee..但是,我不知道為什么部分輸出仍然輸出到屏幕,而不是寫入文件。是否有將所有輸出重定向到文件的方法?
3 回答

阿晨1998
TA貢獻2037條經(jīng)驗 獲得超6個贊
2>
foo > stdout.txt 2> stderr.txt
foo > allout.txt 2>&1

喵喔喔
TA貢獻1735條經(jīng)驗 獲得超5個贊
>
, >>
|
command &> /some/file
*command* > file 2>&1
*command* 2> /dev/null

湖上湖
TA貢獻2003條經(jīng)驗 獲得超2個贊
"require command here" > log_file_name 2>&1
Unix/Linux中重定向操作符的詳細描述。
> file redirects stdout to file1> file redirects stdout to file2> file redirects stderr to file&> file redirects stdout and stderr to file
添加回答
舉報
0/150
提交
取消