I had an application running which had an open file it was actively using.
I accidentally performed an rm (remove) on the file rather than another I actually meant to remove.
Due to Linux's method of linking files, even though the directory entry link to the file was removed, the file is still open and has an additional link via the application process pseudo directory.
The process sub-directory is composed of the process id. The process id can be found with something like:
$ pidof BasketTrading 2663042
The deleted file can then be found with:
$ lsof -p 2663042 | grep deleted BasketTra 2663042 rpb 18u REG 0,46 2739200 29438986 /home/.../BasketTrading.db (deleted)
The 18u reflects the file descriptor used for the file. This can be used to perform a simple copy of the file to an alternate location. A link does not seem to fix it. You may want to complete any outstanding writes to the file first. But do not close it or the application. If you do, the file will be unrecoverable.
$ ls /proc/2663042/fd/18 /proc/2663042/fd/18
$ cp /proc/2663042/fd/18 /home/.../BasketTrading.db.rescue