Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between > and >> while creating log file

Tags:

shell

Whats the difference between these

  Python abcd.py > abcd.logs

and

Python abcd.py >> abcd.logs

In either case, the output of the program is stored in the file whose name is provided after the redirection operator.

like image 734
Rohan Gala Avatar asked Sep 13 '25 17:09

Rohan Gala


1 Answers

It might depend on the shell you are using but the common behaviour is that > will overwrite the target file, while >> will append to it. If the target file does not exist it will be created in both cases.

like image 102
jpw Avatar answered Sep 16 '25 07:09

jpw