I know that I can let Linux to write the console output to a logfile by doing:
command > logfile.log
But this overwrites whatever was in the logfile before. How do I make it append the output to the logfile rather than overwriting it?
I know that I can let Linux to write the console output to a logfile by doing:
command > logfile.log
But this overwrites whatever was in the logfile before. How do I make it append the output to the logfile rather than overwriting it?
Change the operator:
A couple ways:
1) Uses io piping as follows:
$> echo 'some text' >> file.txt (will be appended)
2) Using a program like sed:
$> cat file.txt
some text
$> sed -i '$ a\ here is some more text' file.txt (will also be appended, without piping)
Gl hf!
Use
command >> logfile.log
just replace
>
for>>
You can use
>>
for appending to the same logfile for e.gcmd1 >> logfile.log
then use for other commnad like>>
is used for append data to the file