This answer has a good explanation: stack overflow . This basically means that “deleting” a file on a Unix system does not immediately delete it from disk; instead, it simply removes the link to this file from the directory in which it is located. The file is not actually deleted until all processes that use it have stopped. Thus, you can open a temporary file and delete it immediately, and then whenever the program terminates, it will be automatically deleted.
Cassidy laidlaw
source share