How to recover the deleted but still opened file in Linux

Rate this item
(0 votes)

If a file was accidentally deleted but it is still opened in any program

(for example is being played in a media player), it can easily be recovered from

file descriptor of the /proc file system

Let's suppose we have accidentally deleted the 1.mp3 file which is still being played in mplayer.

We look for PID of mplayer

   ps -auxwww|grep mplayer
   gosha  17314  3.2  0.4  38680  8908 pts/3  SL+ 00:45 0:00 mplayer 1.mp3

We go to the /proc directory with the process parameters of 17314:

   cd /proc/17314 

The open file descriptors are listed in the fd directory (/proc/17314/fd).

   cd fd
   ls -al

In the output we see the descriptor #4 flagged as deleted.

   lr-x------ 1 gosha gosha 64 2009-02-27 00:48 4 -> /home/gosha/1.mp3 (deleted)

We copy it and get the recovered file:

   cp 4 /home/gosha/1.mp3

Last modified on Wednesday, 20 May 2015 13:21
Data Recovery Expert

Viktor S., Ph.D. (Electrical/Computer Engineering), was hired by DataRecoup, the international data recovery corporation, in 2012. Promoted to Engineering Senior Manager in 2010 and then to his current position, as C.I.O. of DataRecoup, in 2014. Responsible for the management of critical, high-priority RAID data recovery cases and the application of his expert, comprehensive knowledge in database data retrieval. He is also responsible for planning and implementing SEO/SEM and other internet-based marketing strategies. Currently, Viktor S., Ph.D., is focusing on the further development and expansion of DataRecoup’s major internet marketing campaign for their already successful proprietary software application “Data Recovery for Windows” (an application which he developed).


  • Comment Link Rusty Friday, 02 March 2018 16:36 posted by Rusty

    The best Boston pet sitters are here.

  • Comment Link Alexis Thursday, 01 March 2018 00:30 posted by Alexis

    I think the admin of this web site is truly working hard for his web page, because here
    every stuff is quality based data.

  • Comment Link Adelaida Wednesday, 28 February 2018 04:43 posted by Adelaida

    Don's Storage Doorways, Inc. Installation by professionals.

  • Comment Link Dacia Friday, 23 February 2018 07:07 posted by Dacia

    SelectQuote is America's #1 Term life sales company.

  • Comment Link Cheri Thursday, 22 February 2018 03:17 posted by Cheri

    The Junkers is his 's eco-conscious waste-removing firm.

  • Comment Link Fermin Wednesday, 21 February 2018 01:51 posted by Fermin

    Right now she did a 5 Star cleaning for my part.

  • Comment Link Rosalina Saturday, 17 February 2018 16:06 posted by Rosalina

    We love the individuals over at Benjamin Lawn &

  • Comment Link Susanne Friday, 09 February 2018 20:59 posted by Susanne

    hey there and thank you for your information – I've definitely picked up anything new from right here.
    I did however expertise a few technical issues using this site,
    as I experienced to reload the web site a lot of times previous to I could get it to load correctly.
    I had been wondering if your hosting is OK?
    Not that I am complaining, but slow loading instances
    times will very frequently affect your placement in google and could
    damage your quality score if ads and marketing with
    Adwords. Well I am adding this RSS to my email and could look out for a lot more of your respective interesting content.

    Make sure you update this again very soon.

  • Comment Link Jesenia Wednesday, 07 February 2018 22:22 posted by Jesenia

    Towing Miami is a family owned towing company in Miami.

  • Comment Link Soon Tuesday, 06 February 2018 10:16 posted by Soon

    Remax was our real estate agent's company.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.