《问》How do we save terminal output to a file?

《问》

How do we save terminal output to a file?

>

to output standard info to a file, and remove all old output
linux_command > standard_output.txt

>>

to append standard info to the end of the file
linux_command >> standard_output.txt

&>

to output the standard info and error to a file, and remove all old output
linux_command > standard_output_and_error.txt

2>

to just output standard error, and remove all old output
linux_command > standard_error.txt

Others

linux_command &>> output.txt
linux_command 2>> output.txt 
linux_command | tee -a output.txt

References

  • https://superuser.com/questions/1084287/save-terminal-output-command-on-osx 
  • https://support.apple.com/guide/terminal/redirect-terminal-input-and-output-apd1dbe647b-7e11-49dc-aa76-89aa7e53ce36/mac
  • https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file
  • http://hints.macworld.com/article.php?story=2008072518010713

Comments

Popular posts from this blog

英语字母a的发音