EN
Bash - redirect command outputs to file
0
points
This article will show you how to redirect command outputs to file in Bash.
Quick solution:
command &> output.txt
Note:
If you want data to be added to an existing file use
>>
instead of>
.
Practical examples
my_script.sh
#!/bin/bash
echo "text from the script"
Redirect the command output to the output.txt
file by:
$ ./my_script.sh &> output.txt
output.txt
text from the script