Super User is a question and answer site for computer enthusiasts and power users. 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 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 Jan 20 '13 at 7:18

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

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
this tool has worked for me in the past: – 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
Now it's on SuperUser, can be closed as a dupe: – therefromhere Feb 16 '13 at 5:37

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 '14 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 '14 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....

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .