Skip to content

Instantly share code, notes, and snippets.

@handleman
Created March 5, 2019 08:03
Show Gist options
  • Save handleman/7130663e3e29a8bb43b511b851fd5655 to your computer and use it in GitHub Desktop.
Save handleman/7130663e3e29a8bb43b511b851fd5655 to your computer and use it in GitHub Desktop.
point bash output to file . How do I save terminal output to a file? Based on the answer here https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file
#Yes it is possible, just redirect the output to a file:
SomeCommand > SomeFile.txt
#Or if you want to append data:
SomeCommand >> SomeFile.txt
#If you want stderr as well use this:
SomeCommand &> SomeFile.txt
#or this to append:
SomeCommand &>> SomeFile.txt
#if you want to have both stderr and output displayed on the console and in a file use this:
SomeCommand 2>&1 | tee SomeFile.txt
#(If you want the output only, drop the 2 above)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment