Difference between > and >> in linux
It’s for newbies, we all have come across this while working with files in Linux.
We know the syntax to write content into the file.
We use nano in case we need to do a lot of work with that file.
the command is nano filename
else we use echo
command is
echo “Content you want to write into the file” > or >> filename.
I got a question here what > and >> do, when I tried to practice it, I can able to understand the difference between > and >>
When you do
echo “Content you want to write into the file” > filename.
It actually overwrites the content of the file.
No matter how many lines you had previously it will simply override with new content you give on the echo command.
Then what >> does just have a look at below pic.
Here >> will append the content you add newly to the previous content present in the file, it will not delete anything which previously present on that file.
Happy learning!