Retrieving the contents of unlinked but still open files

September 2011


Many UNIX applications immediately unlink their tempfiles after creating them. This ensures a file that isn't listed by ls, and will definitely disappear as soon as the program terminates.

As long as the program has not terminated however, lsof still sees it, and cat /proc/<pid>/<filedescriptor> savedfile can still be copied to retrieve its contents.