Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

This question already has an answer here:

I accidentally executed

rm –rf * 

command in /home/apps/ directory on putty console. apps directory contains our all data. I exited immediately (pressing Ctrl+C), but few files been deleted. I don't know exact which files have been deleted.

How do I recover these deleted files ?

share|improve this question

migrated from stackoverflow.com Jun 13 '13 at 9:22

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

marked as duplicate by Journeyman Geek, harrymc, Sathya Jun 13 '13 at 17:44

This question was marked as an exact duplicate of an existing question.

    
extundelete may help, but sorry to break it to you, but you should reach for backup. Other than that, this is off-topic here. – mvp Jun 13 '13 at 7:02

You can use Testdisk to recover your files, as long as they have not been overwritten yet. Take a look at this article: http://worldofgnome.org/how-to-restore-deleted-files-on-linux/

share|improve this answer

Try recovering it with grep in a single user mode.. See if this helps:

http://www.cyberciti.biz/tips/linuxunix-recover-deleted-files.html

share|improve this answer

Its very irritating thing to happen, faced that sometimes. Lost 2 weeks of dev work once. :(

But the reality remains unless there is a backup taken by the system team, you can't recover things in unix. There is no concept of recycle bin or temporary storage before final removal in Unix or Linux.

But you can prevent this in future by making an alias for rm -rf to point to a script that would check if the files are src code , other. Move them to a temp directory where you can review it later and subsequently remove them.

That's what I had done in my previous project.

share|improve this answer
    
would the downvoter care to explain how he can get the exact data once removed without having a backup? – n13 Jun 13 '13 at 19:22