Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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
add comment

4 Answers

up vote 18 down vote accepted
echo 'hello world' >> log.txt
share|improve this answer
add comment

Try:

>>

In place of:

>
share|improve this answer
add comment

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! ;)

share|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
2  
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
add comment

echo 'hello world' >> log.txt

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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