Dear Linux friend, imagine that it's now very late, you are tired and prepare to go to bed saving your work of tonight, when... you discover that your dear file on which you worked so hard has just disappeared!

Well, those things can happen (personal experience here).

If it does, don't panic.

Here is something I found useful. We will assume that you have been working in /home/yourname/yourdirectory when you erased by inadvertence yourdearfile and that /home is the mount point for /dev/sdxx which has an EXT3/4 filesystem (standard on Linux these days).

Step 0: Store relevant information

Note these (directory, filename, device name) very precisely on paper. If you don't have extundelete installed, install it (apt-get extundelete on Debian).

Step 1: Unmount the filesystem

Disconnect from your account (but do not turn the computer off!) and log in as root so as to be able to

umount /dev/sdxx

(extundelete will not work on a mounted file system).

Step 2: restore the deleted file

do

extundelete --restore-file  yourname/yourdirectory/yourdearfile  /dev/sdxx

and if you are lucky it will restore your file to

RECOVERED_FILES/yourname/yourdirectory/yourdearfile

Note that if you have everything on a single partition (as usual on laptops if you used the default options), performing Step 1 will not be that easy. I guess that then what you should do is to turn off the system and boot it with a rescue media (your favorite install CD has an option for this) and do Step 2 from there.