1

I had a linux plain text document file with close to 100000 lines, a size of 10 Mb. I accidentally overwrote the file via python code. But I got an exception in the middle of the code and think the file socket did not get closed properly. The new file has a few new lines (250) ,BUT the size of the file corresponds to the old one.
I was wondering if the old content will still be there within the file and any chances of recovering the same. I tried using TestDisk and poked around a little bit. But it did not have any option for working on a particular file or maybe I am doing it wrong. I dont have any expertise in file systems and would really appreciate any pointers on how to proceed.
Thanks

1 Answers1

0

Sounds like the file still in use (opened by other application)

Try these steps

  • Identify PID of the application that is still using the file by lsof <fielname>, let's say 12345 for example
  • Go to /proc/12345/fd directory, hopefully you see a link that links to the file you want
  • Try to copy it to another location