I was working on a LibreOffice Writer document when my computer turned off. No problem there, I booted up, went back into LibreOffice and it gave the option to recover everything. I left the document up on my computer and a family member came by, closed it and hit Don't save. I had never officially saved it yet I believe.

I see that by going to .config/libreoffice/4/user/backup, it looks like I can view LibreOffice documents that are being "autosaved" until I officially save them (or "don't save" them). That leads me to believe it may be possible to recover this document since it was at least autosaved there before. Would I just go to advanced options in testdisk, and from there select the large partition (I only have one SSD), and then read through the list? Will testdisk pay attention to these autosaved LibreOffice documents that were temporarily in a backup folder until the user decided to oficially save?

  • If an answer was helpful to you, then please consider marking it as the accepted answer so others may more easily find it in the future. This is also a polite way to thank the person answering your question for helping you out. Dec 3 '16 at 17:32

The photorec terminal program can selectively recover files based on their filetype(s), for example it can recover only .odt documents, but photorec/testdisk can't selectively scan an individual directory for lost files unless you had mounted a whole hard drive partition as this directory. In some cases, the filename is stored in the file itself. PhotoRec tries to recover the filename in this case, but most of the time PhotoRec can't recover the filenames.

photorec is provided by the testdisk package from the default Ubuntu repositories.

Recover files based on filetype using photorec

It is preferable to boot from an Ubuntu live DVD/USB before following these steps, in order to avoid using the operating system in which the deleted file is located.

  1. Install testdisk from the default Ubuntu repositories.

     sudo apt-get install testdisk
  2. Launch PhotoRec.

    Open a terminal and launch photorec (as root).

     sudo photorec
  3. Select hard disk.

  4. Select partition type.

    If your hard disk has Linux partitions, then select [Intel].

  5. Select filetype option.

    Move to [File Opt] and press Enter. Here you can disable all file types by pressing s. Use space to toggle the check button. Select filetype(s) to recover.

  6. Select options.

    Photorec also has a list of different options. Under normal circumstances you don’t need to modify them.

  7. Select partition.

    Move the selector up or down to the partition from which you have removed the file(s). Then select [Search] and press Enter.

  8. Select filesystem type.

    If you are using Linux, it's going to be ext2/ext3/ext4, so the default selection is ext2/ext3. Otherwise if you are recovering files from a partition formatted as FAT or NTFS select Other.

  9. Select space for analysis.

    Select Free if you didn’t write to that partition after removing the particular file, otherwise select Whole.

  10. Select a directory for the recovered files.

    Select the path where the recovered files will be stored. Then press Y.

Photorec will show how many files it has recovered.

Source: revised from How To Recover Deleted Files in Linux Using Photorec


Testdisk does not "pay attention" to particular folders or other discriminating factors. It is "just" a tool that will show you any file it can find traces of.

If the file was recently deleted and not overwritten by other data, it will appear there in red when you scan your drive using Testdisk.

Of course, never use that OS again until you recovered the file and run Testdisk only through a live DVD/USB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.