Yes it is possible, just redirect the output (AKA `stdout`) 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)
LIST:
* `command > output.txt`
The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten.
* `command >> output.txt`
The standard output stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
* `command 2> output.txt`
The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, it gets overwritten.
* `command 2>> output.txt`
The standard error stream will be redirected to the file only, it will not be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
* `command &> output.txt`
Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, it gets overwritten.
* `command &>> output.txt`
Both the standard output and standard error stream will be redirected to the file only, nothing will be visible in the terminal. If the file already exists, the new data will get appended to the end of the file..
* `command | tee output.txt`
The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, it gets overwritten.
* `command | tee -a output.txt`
The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.
* **(\*)**
Bash has no shorthand syntax that allows piping only StdErr to a second command, which would be needed here in combination with \`tee\` again to complete the table. If you really need something like that, please look at ["How to pipe stderr, and not stdout?" on Stack Overflow](https://stackoverflow.com/q/2342826/4464570) for some ways how this can be done e.g. by swapping streams or using process substitution.
* `command |& tee output.txt`
Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, it gets overwritten.
* `command |& tee -a output.txt`
Both the standard output and standard error streams will be copied to the file while still being visible in the terminal. If the file already exists, the new data will get appended to the end of the file.