Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just typed rm * in the wrong directory by mistake. I had the wrong terminal window highlighted. What are my options?

share|improve this question

migrated from stackoverflow.com Jan 20 '13 at 7:18

This question came from our site for professional and enthusiast programmers.

3  
Just restore from your latest back-up - that's the whole point of having a back-up strategy, after all. –  Paul R Jan 19 '13 at 21:34
    
I have a backup, but I will lose about 3 hours of tight deadline work. –  Jon Crowell Jan 19 '13 at 21:35
2  
this tool has worked for me in the past: extundelete.sourceforge.net –  thang Jan 19 '13 at 21:47
    
If there was activity on the machine (writing files, particularly), the space the deleted files used to occupy is probably already recycled. Chalk it up to "Unix learning." My condolences. –  vonbrand Jan 23 '13 at 18:17
1  
Now it's on SuperUser, can be closed as a dupe: superuser.com/questions/32355/undo-linuxs-rm?rq=1 –  therefromhere Feb 16 '13 at 5:37

2 Answers 2

What you can do is re-do the three hours of work, and then think about aliasing your rm command to a script which works like rm but stages deletes through a trash bin directory which must be explicitly emptied before the files are really gone.

share|improve this answer
    
I know this is an old answer, but aliasing rm isn't a great idea, since you'll get too comfortable with rm being a 'safe' command and if you make a mistake on another computer, it could mean real data loss. Instead alias something like myrm or something, that way if you run it on another computer, nothing bad will happen, and you'll have to think about using rm correctly. See this answer for more detail. –  Adam Aug 13 at 21:39
    
@Adam So then, the opposite: alias rm to a command which prints "lose the habit of using rm" and exits with an error. :) –  Kaz Aug 13 at 23:38

Do as Paul -R Says, I think if i remember correctly, if write operation has occurred then its not possible to UNDELETE the item....

Maybe you can find more information here.... http://www.computerhope.com/undelete.htm

share|improve this answer

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.