34

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?

2

4 Answers 4

66
echo 'hello world' >> log.txt
8

Try:

>>

In place of:

>
5

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

3
  • While shell may be more powerful than cmd.exe, I would argue it's not more powerful than powershell.
    – GregD
    Aug 14, 2010 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, 2010 at 6:50
  • 2
    Naughty! No language jihads here! Aug 15, 2010 at 11:12
4

echo 'hello world' >> log.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .