Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I had some text files I deleted acidentally. I want to recover them and I know the filename, but as they are all alike inside I can't use foremost or scalpel. The testdisk recovers the files but without the original filename so it's useless. Any help?

share|improve this question
What's the filesystem? FAT32? – thomasrutter Jun 18 '13 at 0:23
If you can remember any of the text that was in the files that you want to recover, then take a look at this command – karel Jun 18 '13 at 0:25
up vote 1 down vote accepted

testdisk has multiple modes of operation, and I think in simple mode it just does a sector-by-sector scan of the disk looking for things that look like files.

You'll want to follow to the letter this guide, which details going into advanced mode and then selecting the desired partition.

The ability to recover the filename from a deleted file depends on the filesystem used.

In FAT filesystems (including, I believe, FAT32) when a file is deleted the first character of its filename is overwritten and thus can't be recovered, but the rest of the filename can. When testdisk recovers a deleted file on a FAT filesystem, it substitutes the missing first letter with an underscore. So after recovery with testdisk (assuming you chose the right mode), instead of looking for "myfile.txt" you'll want to look for "_yfile.txt". I'm not sure what testdisk does for multiple files that have identical names from the second letter onwards.

Note that testdisk is designed for use on an entire partition or drive at once and it's designed to be able to recover from a partition you can no longer mount, so when it recovers files it doesn't recover them in-place, it must recover them to a separate drive.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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