Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Here's a summary: I was programming using java and accidentally, instead of using the rm *.class command in the command-line, I used rm *.java. It took me a lot of time to finish that code. I hope someone knows a way to retrieve those files. Please help me.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

You are looking for: extundelete - utility to recover deleted files from ext3/ext4 partition

To find such a package, you can try: apt-cache search undelete

To use the utility install it with: sudo apt-get install extundelete

After installation invoke man extundelete and study it carefully.

share|improve this answer
    
I typed it in the terminal and this appeared: e2undel - Undelete utility for the ext2 file system extundelete - utility to recover deleted files from ext3/ext4 partition libnet-imap-simple-perl - Perl module to manage an IMAP account magicrescue - recovers files by looking for magic bytes recover - Undelete files on ext2 partitions testdisk - Partition scanner and disk recovery tool undbx - Tool to extract, recover and undelete e-mail messages from .dbx files ..but I don't know what to do next –  cabbit Mar 9 '13 at 20:39
    
@piggy-boink see update –  H.-Dirk Schmitt Mar 9 '13 at 20:43
    
Oh. thank you very much :D –  cabbit Mar 9 '13 at 20:44
add comment

Just as an alternative, since you know specifically what type of file it is...

sudo apt-get install foremost

Now open up /etc/foremost.conf and you will see a long list of commented out lines. If your file type exists, uncomment the line (you may also want to remove the irrelevant lines).

If your file type does not exist, add your own line. Say I want to recover a .css file and I know its around 40K. I could do add this:

css n 40000 Theme\sName: Plugin\sFixes

The 2nd column refers to case-sensitivity, the third column refers to the upper limit for size, the 4th column is how the file starts (remember to use escaped characters) and the last column is how the file usually ends.

Use the following command (edit the disk accordingly. could check with df command)

foremost -v -T -c /etc/foremost.conf -i /dev/sda -o output

What will happen next is that foremost will create a folder called output and dump all the recovered data (in this case) into the folder. From there you could use diff or meld to compare the recovered 'files' and see which is the most up to date.

share|improve this answer
add comment

Your Answer

 
discard

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.