- unix
- terminal
- stdout
- stdin
- redirect
How do I save the output of a command to a file?
Yes it is possible, just redirect the output (AKA stdout) to a file:
SomeCommand > output.txtOr if you want to append data:
SomeCommand >> output.txtIf you want stderr as well use this:
SomeCommand &> output.txt or this to append:
SomeCommand &>> output.txtif you want to have both stderr and output displayed on the console and in a file use this:
SomeCommand 2>&1 | tee output.txt(If you want the output only, drop the 2 above)