How to undelete any open, deleted file on linux / solaris
Chris Dew wrote up a neat trick on how to recover files if deleted on Linux, yet still open by a process.
This works on Solaris as well. =)
$:~:uname -a
SunOS somehost.com 5.10 Generic_127112-11 i86pc i386 i86pc
$:~:echo “sup prefetch.net folks?” > testfile
$:~:tail -f testfile &
[1] 17134
$:~:rm testfile
$:~:ls /proc/17134/fd/
0 1 2
$:~:cat /proc/17134/fd/0
sup prefetch.net folks?
$:~:cp !$ ./testfile
cp /proc/17134/fd/0 ./testfile
$:~:cat testfile
sup prefetch.net folks?








Dmitry on February 26th, 2009
Hello,
A little note – file descriptor zero usually points to standard input (STDIN). In case of ‘tail’ – file descriptor will be 3 as it is first free number after 0 (STDIN), 1 (STDOUT) and 2 (STDERR).