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:
xxxxxxxxxx
1
command &> output.txt
Note:
If you want data to be added to an existing file use
>>
instead of>
.
my_script.sh
xxxxxxxxxx
1
2
3
echo "text from the script"
Redirect the command output to the output.txt
file by:
xxxxxxxxxx
1
$ ./my_script.sh &> output.txt
output.txt
xxxxxxxxxx
1
text from the script