I have a process running very long time.I accidentally deleted the binary executable file of the process.Since the process is still running and doesn't get affected, there must be the original binary file in somewhere else....How can I get recover it? (I use CentOS 7, the running process is written in C++)
How to recover the deleted binary executable file of a running process
linux;process;executable;open files;deleted files
It could only be in memory and not recoverable, in which case you'd have to try to recover it from the filesystem using one of those filesystem recovery tools (or from memory, maybe). However!$ cat hamlet.c#include <unistd.h>int main(void) { while (1) { sleep(9999); } }$ gcc -o hamlet hamlet.c$ md5sum hamlet30558ea86c0eb864e25f5411f2480129  hamlet$ ./hamlet &[1] 2137$ rm hamlet$ cat /proc/2137/exe > newhamlet$ md5sum newhamlet 30558ea86c0eb864e25f5411f2480129  newhamlet$ With interpreted programs, obtaining the script file may be somewhere between tricky and impossible, as /proc/$$/exe will point to perl or whatever, and the input file may already have been closed:$ echo sleep 9999 > x$ perl x &[1] 16439$ rm x$ readlink /proc/16439/exe/usr/bin/perl$ ls /proc/16439/fd0  1  2Only the standard file descriptors are open, so x is already gone (though may for some time still exist on the filesystem, and who knows what the interpreter has in memory).