This:
ls > list
means redirect the output from the ls
command to create a new file called list
. If the file already exists, replace it.
Whereas
ls >> list
means redirect the output from the ls
command and append it to the file called list
If the file doesn't exist then create it.
Typically >
is used when wiping out an existing file is ok. This often means that outputs continually overwrites a file based on the latest current state of things. For instance every time you test a program you might over-write the previous test output.
Typically >>
is used for items such as logging events, parsing or other data processing where data is created or transformed piece by piece into a new form