In linux, how do I do something like

echo 'hello world' > log.txt

but instead of overwriting the contents of log.txt, it appends to the end of of log.txt?

link|improve this question

6  
For full details see the all about I/O redirection in the Advanced Bash-Scripting Guide. – Zoredache Aug 14 '10 at 21:03
@Zoredache: Great reference! +1 – Brent.Longborough Aug 15 '10 at 11:23
feedback

4 Answers

up vote 13 down vote accepted
echo 'hello world' >> log.txt
link|improve this answer
feedback

In Linux you can also use the useful HERE TAG for multiline append :

cat >> log.txt << EOF
hello word 1
hello word 2
hello word 3
EOF

Linux shell's are more more powerful than windows command prompt! ;)

link|improve this answer
While shell may be more powerful than cmd.exe, I would argue it's not more powerful than powershell. – GregD Aug 14 '10 at 23:13
1  
PowerShell is a Scripting language and for this need to be compared with another scripting language for example Perl then Perl is more more powerful than PowerShell . ;) :D – aleroot Aug 15 '10 at 6:50
1  
Naughty! No language jihads here! – Brent.Longborough Aug 15 '10 at 11:12
feedback

Try:

>>

In place of:

>
link|improve this answer
feedback

echo 'hello world' >> log.txt

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.