2

Will the other process be able to finish reading the old file even though it's been replaced?

2

If the other process keeps the file open the entire time, then yes it should be able to continue reading.

Just like you can delete an open file, and processes that file open will still be able to read/write from the file, until it closes.

  • And it's not filesystem dependent right? – user533020 Mar 9 '12 at 22:42
  • @user533020: It's certainly this way on all *NIX FS: ext, xfs, jfs, etc. FAT and NTFS (especially the userspace implementation) may behave differently. – Hubert Kario Mar 9 '12 at 23:56
5

Yes, the process with the file open will be reading the file via an open file descriptor. The mv command just changes the associated directory entry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.