What is the difference between ls >
and ls >>
?
I need to understand this for my GCSE computing but don't know what the difference is.
Ubuntu – the difference between “>” and “>>”
command line
command line
What is the difference between ls >
and ls >>
?
I need to understand this for my GCSE computing but don't know what the difference is.
Best Answer
>
&>>
are redirection operators; they transfer output of something, in this casels
, elsewhere. If this output goes to a file,>
will truncate the file - ie delete any previous content, whereas>>
will append new data onto the end of the file, keeping previous content. This will work with any input, soecho
&cat
, for example, can also be used this way.Also of interest is the
|
operator, which passes the data to another application - sols | cat -n
will give you a line-numbered listing !Pipes is the relevant term.