Recovering accidentally deleted files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
72
down vote

favorite
35












I accidentally deleted a file from my laptop. I'm using Fedora. Is it possible to recover the file?







share|improve this question

















  • 9




    whats your filesystem?
    – echox
    Oct 3 '10 at 19:56
















up vote
72
down vote

favorite
35












I accidentally deleted a file from my laptop. I'm using Fedora. Is it possible to recover the file?







share|improve this question

















  • 9




    whats your filesystem?
    – echox
    Oct 3 '10 at 19:56












up vote
72
down vote

favorite
35









up vote
72
down vote

favorite
35






35





I accidentally deleted a file from my laptop. I'm using Fedora. Is it possible to recover the file?







share|improve this question













I accidentally deleted a file from my laptop. I'm using Fedora. Is it possible to recover the file?









share|improve this question












share|improve this question




share|improve this question








edited Nov 4 '13 at 7:04









jasonwryan

46.3k14123173




46.3k14123173









asked Oct 3 '10 at 19:46









crskhr

7922921




7922921







  • 9




    whats your filesystem?
    – echox
    Oct 3 '10 at 19:56












  • 9




    whats your filesystem?
    – echox
    Oct 3 '10 at 19:56







9




9




whats your filesystem?
– echox
Oct 3 '10 at 19:56




whats your filesystem?
– echox
Oct 3 '10 at 19:56










9 Answers
9






active

oldest

votes

















up vote
86
down vote



accepted










I would advise against immediately installing some utility. Basically your biggest enemy here are disk writes. You want to avoid them at all costs right now.



Your best bet is an auto-backup created by your editor--if it exists. If not, I would try the following trick using grep if you remember some unique string in your .tex file:



$sudo grep -i -a -B100 -A100 'string' /dev/sda1 > file.txt


Replace /dev/sda1 with the device that the file was on and replace 'string' with the unique string in your file. This could take some time. But basically, what this does is it searches for the string on the device and then returns 100 lines before and after that line and puts it in file.txt. If you need more lines returned just adjust the -B and -A options as appropriate. You might get a bunch of extra garbage returned, but you should be able to get your text back.



Good luck.






share|improve this answer



















  • 8




    Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
    – Michael Mrozek♦
    Oct 3 '10 at 21:03






  • 15




    By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
    – rozcietrzewiacz
    Aug 13 '11 at 23:16











  • Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
    – ntc2
    Dec 29 '13 at 7:41






  • 1




    That is really a great trick!
    – Matthias
    Apr 5 '14 at 14:22










  • Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
    – Michael Kjörling
    Nov 6 '14 at 10:27

















up vote
20
down vote













It is possible, it's just going to be a hassle.



UPDATE: before you try this method, please have a look at Steven's answer.



You're going to need the testdisk package, a lot of disk space and a lot of time.



PhotoRec, a part of TestDisk, can recover files from almost any disc. PhotoRec does support finding .tex files.




First, install testdisk by running



yum install testdisk


note: You're going to need a lot of free space on another drive, where you can save recovered files.



Recover all the deleted files on your disc by running photorec on the free space of the disc.



sudo photorec


and follow the instructions... ( remember not to save the files to the same disc you are recovering from )



After the process has completed, all the recovered files should be in one directory, where you should run:



find -name '*.tex' > filelist


This will output a list of files that might be the one you lost. You will have to check all of them, as the filenames will be lost.






share|improve this answer



















  • 11




    photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
    – Steven D
    Oct 3 '10 at 20:13






  • 1




    Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
    – Stefan
    Oct 3 '10 at 20:21






  • 2




    to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
    – Steve Burdine
    Oct 3 '10 at 20:39

















up vote
12
down vote













Many text editors keep backup files. If you are really lucky, there might be something like yourfile.tex~ including a previous version of your file.






share|improve this answer





















  • +1, true... a much more simple and elegant solution :)
    – Stefan
    Oct 3 '10 at 20:07


















up vote
7
down vote













There are other data recovery tools and the most effective are foremost, photorec, scalpel and magic rescue. (I'm assuming that the 'grep' trick told here is not enough) Here you can find some tutorials about how to use them:



http://www.howtogeek.com/howto/15761/recover-data-like-a-forensics-expert-using-an-ubuntu-live-cd/



https://help.ubuntu.com/community/DataRecovery






share|improve this answer






























    up vote
    4
    down vote













    In any case I'd stop working on the device being used as soon as possible to avoid any disk writes, and boot into a dedicated recovery OS, like SystemRescueCd, which is a Live-CD so you can mount your disk read-only in order to prevent further data loss.



    Those distros include a lot of recovery tools mentioned by others, and you can install most missing.



    I always tend to have a CD with a recent version of SystemRescueCd in my external USB reader, just in case.






    share|improve this answer




























      up vote
      3
      down vote













      NOTE: I added this answer regarding some other question about deleted database files (MySQL server) which was closed and pointed to this one. I believe it can be useful in some other similar situations too (as far as some process still holds the file descriptors open).



      If your process is still runnig then you can find your files in /proc/<pid>fd/ and just copy them. Send SIGSTOP first to the process group. Copy the files. Build new instance on side and keep this one stopped or kill -9 it and put the files back on their places. InnoDB will recover by its own when run but if there was some MyISAM than you'll have to do this manually.






      share|improve this answer






























        up vote
        2
        down vote













        I had accidentally deleted my sqlite db file.



        What I did to find out the file was,



        Opened the location /proc/ in a file browser and searched for the deleted sqlite db file over there.



        I found out that file in a search result. Copied that file from there to my old place.






        share|improve this answer




























          up vote
          0
          down vote













          I had the same problem two years ago and I tried a lot of programs, like debugfs, photorec, ext3grep and extundelete. ext3grep was the best program to recover files. The syntax is very easy:



          ext3grep image.img --restore-all


          or:



          ext3grep /dev/sda3 --restore-all --after date -d '2015-01-01 00:00:00' '+%s' --before `date -d ‘2015-01-02 00:00:00’ ‘+%s’


          This video is a mini tutorial that can help you.






          share|improve this answer




























            up vote
            0
            down vote













            If you have no backup a 3rd party Disk Recovery Tool might recover some or all of the data but you must stop using the machine now.
            The trashed files are now available for your system to overwrite them. Once they are overwritten it's prohibitively expensive to recover the data.
            I've had success using uflysoft data recovery(there are other Mac OS data recover applications)- you must have a "recovery drive" (not your main drive or drive you a scavenging from) on which to save the recovered data. You boot from the Data Recovery disk (system)






            share|improve this answer





















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );








               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f2677%2frecovering-accidentally-deleted-files%23new-answer', 'question_page');

              );

              Post as a guest






























              9 Answers
              9






              active

              oldest

              votes








              9 Answers
              9






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              86
              down vote



              accepted










              I would advise against immediately installing some utility. Basically your biggest enemy here are disk writes. You want to avoid them at all costs right now.



              Your best bet is an auto-backup created by your editor--if it exists. If not, I would try the following trick using grep if you remember some unique string in your .tex file:



              $sudo grep -i -a -B100 -A100 'string' /dev/sda1 > file.txt


              Replace /dev/sda1 with the device that the file was on and replace 'string' with the unique string in your file. This could take some time. But basically, what this does is it searches for the string on the device and then returns 100 lines before and after that line and puts it in file.txt. If you need more lines returned just adjust the -B and -A options as appropriate. You might get a bunch of extra garbage returned, but you should be able to get your text back.



              Good luck.






              share|improve this answer



















              • 8




                Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
                – Michael Mrozek♦
                Oct 3 '10 at 21:03






              • 15




                By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
                – rozcietrzewiacz
                Aug 13 '11 at 23:16











              • Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
                – ntc2
                Dec 29 '13 at 7:41






              • 1




                That is really a great trick!
                – Matthias
                Apr 5 '14 at 14:22










              • Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
                – Michael Kjörling
                Nov 6 '14 at 10:27














              up vote
              86
              down vote



              accepted










              I would advise against immediately installing some utility. Basically your biggest enemy here are disk writes. You want to avoid them at all costs right now.



              Your best bet is an auto-backup created by your editor--if it exists. If not, I would try the following trick using grep if you remember some unique string in your .tex file:



              $sudo grep -i -a -B100 -A100 'string' /dev/sda1 > file.txt


              Replace /dev/sda1 with the device that the file was on and replace 'string' with the unique string in your file. This could take some time. But basically, what this does is it searches for the string on the device and then returns 100 lines before and after that line and puts it in file.txt. If you need more lines returned just adjust the -B and -A options as appropriate. You might get a bunch of extra garbage returned, but you should be able to get your text back.



              Good luck.






              share|improve this answer



















              • 8




                Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
                – Michael Mrozek♦
                Oct 3 '10 at 21:03






              • 15




                By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
                – rozcietrzewiacz
                Aug 13 '11 at 23:16











              • Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
                – ntc2
                Dec 29 '13 at 7:41






              • 1




                That is really a great trick!
                – Matthias
                Apr 5 '14 at 14:22










              • Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
                – Michael Kjörling
                Nov 6 '14 at 10:27












              up vote
              86
              down vote



              accepted







              up vote
              86
              down vote



              accepted






              I would advise against immediately installing some utility. Basically your biggest enemy here are disk writes. You want to avoid them at all costs right now.



              Your best bet is an auto-backup created by your editor--if it exists. If not, I would try the following trick using grep if you remember some unique string in your .tex file:



              $sudo grep -i -a -B100 -A100 'string' /dev/sda1 > file.txt


              Replace /dev/sda1 with the device that the file was on and replace 'string' with the unique string in your file. This could take some time. But basically, what this does is it searches for the string on the device and then returns 100 lines before and after that line and puts it in file.txt. If you need more lines returned just adjust the -B and -A options as appropriate. You might get a bunch of extra garbage returned, but you should be able to get your text back.



              Good luck.






              share|improve this answer















              I would advise against immediately installing some utility. Basically your biggest enemy here are disk writes. You want to avoid them at all costs right now.



              Your best bet is an auto-backup created by your editor--if it exists. If not, I would try the following trick using grep if you remember some unique string in your .tex file:



              $sudo grep -i -a -B100 -A100 'string' /dev/sda1 > file.txt


              Replace /dev/sda1 with the device that the file was on and replace 'string' with the unique string in your file. This could take some time. But basically, what this does is it searches for the string on the device and then returns 100 lines before and after that line and puts it in file.txt. If you need more lines returned just adjust the -B and -A options as appropriate. You might get a bunch of extra garbage returned, but you should be able to get your text back.



              Good luck.







              share|improve this answer















              share|improve this answer



              share|improve this answer








              edited Apr 5 '14 at 10:50









              Raphael Ahrens

              6,57252845




              6,57252845











              answered Oct 3 '10 at 20:09









              Steven D

              30.5k695108




              30.5k695108







              • 8




                Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
                – Michael Mrozek♦
                Oct 3 '10 at 21:03






              • 15




                By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
                – rozcietrzewiacz
                Aug 13 '11 at 23:16











              • Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
                – ntc2
                Dec 29 '13 at 7:41






              • 1




                That is really a great trick!
                – Matthias
                Apr 5 '14 at 14:22










              • Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
                – Michael Kjörling
                Nov 6 '14 at 10:27












              • 8




                Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
                – Michael Mrozek♦
                Oct 3 '10 at 21:03






              • 15




                By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
                – rozcietrzewiacz
                Aug 13 '11 at 23:16











              • Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
                – ntc2
                Dec 29 '13 at 7:41






              • 1




                That is really a great trick!
                – Matthias
                Apr 5 '14 at 14:22










              • Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
                – Michael Kjörling
                Nov 6 '14 at 10:27







              8




              8




              Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
              – Michael Mrozek♦
              Oct 3 '10 at 21:03




              Somebody showed me this a couple weeks after I switched to Linux, when I killed a text document I really needed -- it pretty much blew my mind
              – Michael Mrozek♦
              Oct 3 '10 at 21:03




              15




              15




              By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
              – rozcietrzewiacz
              Aug 13 '11 at 23:16





              By the way, -B100 -A100 can be replaced by equivalent -C100 (C for "context"). And I would definitely not use -i if it were possible, but have -F in its place.
              – rozcietrzewiacz
              Aug 13 '11 at 23:16













              Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
              – ntc2
              Dec 29 '13 at 7:41




              Probably unsurprisingly -- I assume the same disk blocks have been reused -- this method did not work for a file which I accidentally overwrote, not accidentally deleted.
              – ntc2
              Dec 29 '13 at 7:41




              1




              1




              That is really a great trick!
              – Matthias
              Apr 5 '14 at 14:22




              That is really a great trick!
              – Matthias
              Apr 5 '14 at 14:22












              Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
              – Michael Kjörling
              Nov 6 '14 at 10:27




              Yes, on most file systems, the same blocks are reused when a file is merely overwritten. Note that some applications "work around this" in a sense by writing a temporary file first (which makes it a separate write), then renaming that file on top of the old file (which replaces the data from the user's point of view). This is done for a number of different reasons. Storage systems (including file systems) which do this all the time are termed copy on write.
              – Michael Kjörling
              Nov 6 '14 at 10:27












              up vote
              20
              down vote













              It is possible, it's just going to be a hassle.



              UPDATE: before you try this method, please have a look at Steven's answer.



              You're going to need the testdisk package, a lot of disk space and a lot of time.



              PhotoRec, a part of TestDisk, can recover files from almost any disc. PhotoRec does support finding .tex files.




              First, install testdisk by running



              yum install testdisk


              note: You're going to need a lot of free space on another drive, where you can save recovered files.



              Recover all the deleted files on your disc by running photorec on the free space of the disc.



              sudo photorec


              and follow the instructions... ( remember not to save the files to the same disc you are recovering from )



              After the process has completed, all the recovered files should be in one directory, where you should run:



              find -name '*.tex' > filelist


              This will output a list of files that might be the one you lost. You will have to check all of them, as the filenames will be lost.






              share|improve this answer



















              • 11




                photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
                – Steven D
                Oct 3 '10 at 20:13






              • 1




                Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
                – Stefan
                Oct 3 '10 at 20:21






              • 2




                to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
                – Steve Burdine
                Oct 3 '10 at 20:39














              up vote
              20
              down vote













              It is possible, it's just going to be a hassle.



              UPDATE: before you try this method, please have a look at Steven's answer.



              You're going to need the testdisk package, a lot of disk space and a lot of time.



              PhotoRec, a part of TestDisk, can recover files from almost any disc. PhotoRec does support finding .tex files.




              First, install testdisk by running



              yum install testdisk


              note: You're going to need a lot of free space on another drive, where you can save recovered files.



              Recover all the deleted files on your disc by running photorec on the free space of the disc.



              sudo photorec


              and follow the instructions... ( remember not to save the files to the same disc you are recovering from )



              After the process has completed, all the recovered files should be in one directory, where you should run:



              find -name '*.tex' > filelist


              This will output a list of files that might be the one you lost. You will have to check all of them, as the filenames will be lost.






              share|improve this answer



















              • 11




                photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
                – Steven D
                Oct 3 '10 at 20:13






              • 1




                Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
                – Stefan
                Oct 3 '10 at 20:21






              • 2




                to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
                – Steve Burdine
                Oct 3 '10 at 20:39












              up vote
              20
              down vote










              up vote
              20
              down vote









              It is possible, it's just going to be a hassle.



              UPDATE: before you try this method, please have a look at Steven's answer.



              You're going to need the testdisk package, a lot of disk space and a lot of time.



              PhotoRec, a part of TestDisk, can recover files from almost any disc. PhotoRec does support finding .tex files.




              First, install testdisk by running



              yum install testdisk


              note: You're going to need a lot of free space on another drive, where you can save recovered files.



              Recover all the deleted files on your disc by running photorec on the free space of the disc.



              sudo photorec


              and follow the instructions... ( remember not to save the files to the same disc you are recovering from )



              After the process has completed, all the recovered files should be in one directory, where you should run:



              find -name '*.tex' > filelist


              This will output a list of files that might be the one you lost. You will have to check all of them, as the filenames will be lost.






              share|improve this answer















              It is possible, it's just going to be a hassle.



              UPDATE: before you try this method, please have a look at Steven's answer.



              You're going to need the testdisk package, a lot of disk space and a lot of time.



              PhotoRec, a part of TestDisk, can recover files from almost any disc. PhotoRec does support finding .tex files.




              First, install testdisk by running



              yum install testdisk


              note: You're going to need a lot of free space on another drive, where you can save recovered files.



              Recover all the deleted files on your disc by running photorec on the free space of the disc.



              sudo photorec


              and follow the instructions... ( remember not to save the files to the same disc you are recovering from )



              After the process has completed, all the recovered files should be in one directory, where you should run:



              find -name '*.tex' > filelist


              This will output a list of files that might be the one you lost. You will have to check all of them, as the filenames will be lost.







              share|improve this answer















              share|improve this answer



              share|improve this answer








              edited May 24 at 1:47









              Pang

              1155




              1155











              answered Oct 3 '10 at 19:56









              Stefan

              11.1k2978122




              11.1k2978122







              • 11




                photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
                – Steven D
                Oct 3 '10 at 20:13






              • 1




                Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
                – Stefan
                Oct 3 '10 at 20:21






              • 2




                to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
                – Steve Burdine
                Oct 3 '10 at 20:39












              • 11




                photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
                – Steven D
                Oct 3 '10 at 20:13






              • 1




                Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
                – Stefan
                Oct 3 '10 at 20:21






              • 2




                to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
                – Steve Burdine
                Oct 3 '10 at 20:39







              11




              11




              photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
              – Steven D
              Oct 3 '10 at 20:13




              photorec is a good util, I would just be worried about the disk writes that are going to happen during install. Is there anyway to get this as a standalone executable that can run from external media?
              – Steven D
              Oct 3 '10 at 20:13




              1




              1




              Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
              – Stefan
              Oct 3 '10 at 20:21




              Yes, you are very right. I don't know about a standalone executable, but one could try using some live-cd?
              – Stefan
              Oct 3 '10 at 20:21




              2




              2




              to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
              – Steve Burdine
              Oct 3 '10 at 20:39




              to cut down on the files recovered with Photorec, the third screen in will give a [File Opt] select this. You can from a list select what file types you want to or do not want to be recovered.
              – Steve Burdine
              Oct 3 '10 at 20:39










              up vote
              12
              down vote













              Many text editors keep backup files. If you are really lucky, there might be something like yourfile.tex~ including a previous version of your file.






              share|improve this answer





















              • +1, true... a much more simple and elegant solution :)
                – Stefan
                Oct 3 '10 at 20:07















              up vote
              12
              down vote













              Many text editors keep backup files. If you are really lucky, there might be something like yourfile.tex~ including a previous version of your file.






              share|improve this answer





















              • +1, true... a much more simple and elegant solution :)
                – Stefan
                Oct 3 '10 at 20:07













              up vote
              12
              down vote










              up vote
              12
              down vote









              Many text editors keep backup files. If you are really lucky, there might be something like yourfile.tex~ including a previous version of your file.






              share|improve this answer













              Many text editors keep backup files. If you are really lucky, there might be something like yourfile.tex~ including a previous version of your file.







              share|improve this answer













              share|improve this answer



              share|improve this answer











              answered Oct 3 '10 at 20:06









              fschmitt

              7,4562842




              7,4562842











              • +1, true... a much more simple and elegant solution :)
                – Stefan
                Oct 3 '10 at 20:07

















              • +1, true... a much more simple and elegant solution :)
                – Stefan
                Oct 3 '10 at 20:07
















              +1, true... a much more simple and elegant solution :)
              – Stefan
              Oct 3 '10 at 20:07





              +1, true... a much more simple and elegant solution :)
              – Stefan
              Oct 3 '10 at 20:07











              up vote
              7
              down vote













              There are other data recovery tools and the most effective are foremost, photorec, scalpel and magic rescue. (I'm assuming that the 'grep' trick told here is not enough) Here you can find some tutorials about how to use them:



              http://www.howtogeek.com/howto/15761/recover-data-like-a-forensics-expert-using-an-ubuntu-live-cd/



              https://help.ubuntu.com/community/DataRecovery






              share|improve this answer



























                up vote
                7
                down vote













                There are other data recovery tools and the most effective are foremost, photorec, scalpel and magic rescue. (I'm assuming that the 'grep' trick told here is not enough) Here you can find some tutorials about how to use them:



                http://www.howtogeek.com/howto/15761/recover-data-like-a-forensics-expert-using-an-ubuntu-live-cd/



                https://help.ubuntu.com/community/DataRecovery






                share|improve this answer

























                  up vote
                  7
                  down vote










                  up vote
                  7
                  down vote









                  There are other data recovery tools and the most effective are foremost, photorec, scalpel and magic rescue. (I'm assuming that the 'grep' trick told here is not enough) Here you can find some tutorials about how to use them:



                  http://www.howtogeek.com/howto/15761/recover-data-like-a-forensics-expert-using-an-ubuntu-live-cd/



                  https://help.ubuntu.com/community/DataRecovery






                  share|improve this answer















                  There are other data recovery tools and the most effective are foremost, photorec, scalpel and magic rescue. (I'm assuming that the 'grep' trick told here is not enough) Here you can find some tutorials about how to use them:



                  http://www.howtogeek.com/howto/15761/recover-data-like-a-forensics-expert-using-an-ubuntu-live-cd/



                  https://help.ubuntu.com/community/DataRecovery







                  share|improve this answer















                  share|improve this answer



                  share|improve this answer








                  edited Apr 13 '17 at 12:37









                  Community♦

                  1




                  1











                  answered Feb 3 '12 at 3:19









                  Attilio

                  20122




                  20122




















                      up vote
                      4
                      down vote













                      In any case I'd stop working on the device being used as soon as possible to avoid any disk writes, and boot into a dedicated recovery OS, like SystemRescueCd, which is a Live-CD so you can mount your disk read-only in order to prevent further data loss.



                      Those distros include a lot of recovery tools mentioned by others, and you can install most missing.



                      I always tend to have a CD with a recent version of SystemRescueCd in my external USB reader, just in case.






                      share|improve this answer

























                        up vote
                        4
                        down vote













                        In any case I'd stop working on the device being used as soon as possible to avoid any disk writes, and boot into a dedicated recovery OS, like SystemRescueCd, which is a Live-CD so you can mount your disk read-only in order to prevent further data loss.



                        Those distros include a lot of recovery tools mentioned by others, and you can install most missing.



                        I always tend to have a CD with a recent version of SystemRescueCd in my external USB reader, just in case.






                        share|improve this answer























                          up vote
                          4
                          down vote










                          up vote
                          4
                          down vote









                          In any case I'd stop working on the device being used as soon as possible to avoid any disk writes, and boot into a dedicated recovery OS, like SystemRescueCd, which is a Live-CD so you can mount your disk read-only in order to prevent further data loss.



                          Those distros include a lot of recovery tools mentioned by others, and you can install most missing.



                          I always tend to have a CD with a recent version of SystemRescueCd in my external USB reader, just in case.






                          share|improve this answer













                          In any case I'd stop working on the device being used as soon as possible to avoid any disk writes, and boot into a dedicated recovery OS, like SystemRescueCd, which is a Live-CD so you can mount your disk read-only in order to prevent further data loss.



                          Those distros include a lot of recovery tools mentioned by others, and you can install most missing.



                          I always tend to have a CD with a recent version of SystemRescueCd in my external USB reader, just in case.







                          share|improve this answer













                          share|improve this answer



                          share|improve this answer











                          answered Dec 18 '14 at 10:19









                          Martin C.

                          20615




                          20615




















                              up vote
                              3
                              down vote













                              NOTE: I added this answer regarding some other question about deleted database files (MySQL server) which was closed and pointed to this one. I believe it can be useful in some other similar situations too (as far as some process still holds the file descriptors open).



                              If your process is still runnig then you can find your files in /proc/<pid>fd/ and just copy them. Send SIGSTOP first to the process group. Copy the files. Build new instance on side and keep this one stopped or kill -9 it and put the files back on their places. InnoDB will recover by its own when run but if there was some MyISAM than you'll have to do this manually.






                              share|improve this answer



























                                up vote
                                3
                                down vote













                                NOTE: I added this answer regarding some other question about deleted database files (MySQL server) which was closed and pointed to this one. I believe it can be useful in some other similar situations too (as far as some process still holds the file descriptors open).



                                If your process is still runnig then you can find your files in /proc/<pid>fd/ and just copy them. Send SIGSTOP first to the process group. Copy the files. Build new instance on side and keep this one stopped or kill -9 it and put the files back on their places. InnoDB will recover by its own when run but if there was some MyISAM than you'll have to do this manually.






                                share|improve this answer

























                                  up vote
                                  3
                                  down vote










                                  up vote
                                  3
                                  down vote









                                  NOTE: I added this answer regarding some other question about deleted database files (MySQL server) which was closed and pointed to this one. I believe it can be useful in some other similar situations too (as far as some process still holds the file descriptors open).



                                  If your process is still runnig then you can find your files in /proc/<pid>fd/ and just copy them. Send SIGSTOP first to the process group. Copy the files. Build new instance on side and keep this one stopped or kill -9 it and put the files back on their places. InnoDB will recover by its own when run but if there was some MyISAM than you'll have to do this manually.






                                  share|improve this answer















                                  NOTE: I added this answer regarding some other question about deleted database files (MySQL server) which was closed and pointed to this one. I believe it can be useful in some other similar situations too (as far as some process still holds the file descriptors open).



                                  If your process is still runnig then you can find your files in /proc/<pid>fd/ and just copy them. Send SIGSTOP first to the process group. Copy the files. Build new instance on side and keep this one stopped or kill -9 it and put the files back on their places. InnoDB will recover by its own when run but if there was some MyISAM than you'll have to do this manually.







                                  share|improve this answer















                                  share|improve this answer



                                  share|improve this answer








                                  edited Apr 5 '14 at 17:35


























                                  answered Apr 5 '14 at 13:23









                                  pawel7318

                                  8152914




                                  8152914




















                                      up vote
                                      2
                                      down vote













                                      I had accidentally deleted my sqlite db file.



                                      What I did to find out the file was,



                                      Opened the location /proc/ in a file browser and searched for the deleted sqlite db file over there.



                                      I found out that file in a search result. Copied that file from there to my old place.






                                      share|improve this answer

























                                        up vote
                                        2
                                        down vote













                                        I had accidentally deleted my sqlite db file.



                                        What I did to find out the file was,



                                        Opened the location /proc/ in a file browser and searched for the deleted sqlite db file over there.



                                        I found out that file in a search result. Copied that file from there to my old place.






                                        share|improve this answer























                                          up vote
                                          2
                                          down vote










                                          up vote
                                          2
                                          down vote









                                          I had accidentally deleted my sqlite db file.



                                          What I did to find out the file was,



                                          Opened the location /proc/ in a file browser and searched for the deleted sqlite db file over there.



                                          I found out that file in a search result. Copied that file from there to my old place.






                                          share|improve this answer













                                          I had accidentally deleted my sqlite db file.



                                          What I did to find out the file was,



                                          Opened the location /proc/ in a file browser and searched for the deleted sqlite db file over there.



                                          I found out that file in a search result. Copied that file from there to my old place.







                                          share|improve this answer













                                          share|improve this answer



                                          share|improve this answer











                                          answered Nov 18 '14 at 13:18









                                          Thaha kp

                                          1212




                                          1212




















                                              up vote
                                              0
                                              down vote













                                              I had the same problem two years ago and I tried a lot of programs, like debugfs, photorec, ext3grep and extundelete. ext3grep was the best program to recover files. The syntax is very easy:



                                              ext3grep image.img --restore-all


                                              or:



                                              ext3grep /dev/sda3 --restore-all --after date -d '2015-01-01 00:00:00' '+%s' --before `date -d ‘2015-01-02 00:00:00’ ‘+%s’


                                              This video is a mini tutorial that can help you.






                                              share|improve this answer

























                                                up vote
                                                0
                                                down vote













                                                I had the same problem two years ago and I tried a lot of programs, like debugfs, photorec, ext3grep and extundelete. ext3grep was the best program to recover files. The syntax is very easy:



                                                ext3grep image.img --restore-all


                                                or:



                                                ext3grep /dev/sda3 --restore-all --after date -d '2015-01-01 00:00:00' '+%s' --before `date -d ‘2015-01-02 00:00:00’ ‘+%s’


                                                This video is a mini tutorial that can help you.






                                                share|improve this answer























                                                  up vote
                                                  0
                                                  down vote










                                                  up vote
                                                  0
                                                  down vote









                                                  I had the same problem two years ago and I tried a lot of programs, like debugfs, photorec, ext3grep and extundelete. ext3grep was the best program to recover files. The syntax is very easy:



                                                  ext3grep image.img --restore-all


                                                  or:



                                                  ext3grep /dev/sda3 --restore-all --after date -d '2015-01-01 00:00:00' '+%s' --before `date -d ‘2015-01-02 00:00:00’ ‘+%s’


                                                  This video is a mini tutorial that can help you.






                                                  share|improve this answer













                                                  I had the same problem two years ago and I tried a lot of programs, like debugfs, photorec, ext3grep and extundelete. ext3grep was the best program to recover files. The syntax is very easy:



                                                  ext3grep image.img --restore-all


                                                  or:



                                                  ext3grep /dev/sda3 --restore-all --after date -d '2015-01-01 00:00:00' '+%s' --before `date -d ‘2015-01-02 00:00:00’ ‘+%s’


                                                  This video is a mini tutorial that can help you.







                                                  share|improve this answer













                                                  share|improve this answer



                                                  share|improve this answer











                                                  answered Oct 4 '17 at 17:42









                                                  Juan

                                                  5111




                                                  5111




















                                                      up vote
                                                      0
                                                      down vote













                                                      If you have no backup a 3rd party Disk Recovery Tool might recover some or all of the data but you must stop using the machine now.
                                                      The trashed files are now available for your system to overwrite them. Once they are overwritten it's prohibitively expensive to recover the data.
                                                      I've had success using uflysoft data recovery(there are other Mac OS data recover applications)- you must have a "recovery drive" (not your main drive or drive you a scavenging from) on which to save the recovered data. You boot from the Data Recovery disk (system)






                                                      share|improve this answer

























                                                        up vote
                                                        0
                                                        down vote













                                                        If you have no backup a 3rd party Disk Recovery Tool might recover some or all of the data but you must stop using the machine now.
                                                        The trashed files are now available for your system to overwrite them. Once they are overwritten it's prohibitively expensive to recover the data.
                                                        I've had success using uflysoft data recovery(there are other Mac OS data recover applications)- you must have a "recovery drive" (not your main drive or drive you a scavenging from) on which to save the recovered data. You boot from the Data Recovery disk (system)






                                                        share|improve this answer























                                                          up vote
                                                          0
                                                          down vote










                                                          up vote
                                                          0
                                                          down vote









                                                          If you have no backup a 3rd party Disk Recovery Tool might recover some or all of the data but you must stop using the machine now.
                                                          The trashed files are now available for your system to overwrite them. Once they are overwritten it's prohibitively expensive to recover the data.
                                                          I've had success using uflysoft data recovery(there are other Mac OS data recover applications)- you must have a "recovery drive" (not your main drive or drive you a scavenging from) on which to save the recovered data. You boot from the Data Recovery disk (system)






                                                          share|improve this answer













                                                          If you have no backup a 3rd party Disk Recovery Tool might recover some or all of the data but you must stop using the machine now.
                                                          The trashed files are now available for your system to overwrite them. Once they are overwritten it's prohibitively expensive to recover the data.
                                                          I've had success using uflysoft data recovery(there are other Mac OS data recover applications)- you must have a "recovery drive" (not your main drive or drive you a scavenging from) on which to save the recovered data. You boot from the Data Recovery disk (system)







                                                          share|improve this answer













                                                          share|improve this answer



                                                          share|improve this answer











                                                          answered Jul 16 at 17:46









                                                          Gallup Noel

                                                          1




                                                          1






















                                                               

                                                              draft saved


                                                              draft discarded


























                                                               


                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f2677%2frecovering-accidentally-deleted-files%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest













































































                                                              Popular posts from this blog

                                                              How to check contact read email or not when send email to Individual?

                                                              Bahrain

                                                              Postfix configuration issue with fips on centos 7; mailgun relay