If the file is moved (in the same filesystem) or renamed, then the file handle remains open and can still be used to read and write the file.
If the file is deleted, the file handle remains open and can still be used (This is not what some people expect). The file will not really be deleted until the last handle is closed.
If the file is replaced by a new file, it depends exactly how. Either the file is overwritten, in which case the file handle will still be valid and access the new file, or the existing file is unlinked and a new one created with the same name, in which case it’s the same as deletion (see above).
In general, once the file is open, the file is open, and nobody changing the directory structure can change that – they can move, rename the file, or put something else in its place, it simply remains open.
In Unix there is no delete, only unlink(), which makes sense as it doesn’t necessarily delete the file – just removes the link from the directory.
delete操作并没有真的删除对应的inode节点，而只是调用了unlink函数。一个文件，必须得等到它的reference count = 0，才会被真正的清除。
A few apps (that don’t come to mind) rely on this behavior, by creating, opening and immediately deleting files, which then live exactly as long as the application – allowing other applications to be aware of the first app’s lifecycle without needing to look at process maps and such.