I always wonder what is the difference between >
and >>
signs in Linux whenever I wanted to redirect the output of a command such as ls
to a file. I thought both do the same task without any difference and finally while I was making my own playlist for playing songs in my favorite player(mpg123), I found the difference.
Basically, the difference is really simple, >
overwrites the file content but >>
appends output to the end of the content.
For instance,
$ ls > t1.txt
Overwrite t1.txt
and erases its previous data. However,
$ ls >> t1.txt
Appends the output to the end of t1.txt
file.