Is it possible to restore files/directories which are deleted from terminal using
rm -r?. If a file is deleted from graphical interface, it could be restored from trash, but how do you restore a file if it is removed from terminal?.
To this end I use
The files you remove will be moved to trash, and you can see them in nautilus trashcan.
You can always access the real
There are also commands to access the trashcan from terminal,
Last note, it is not advisable to use such an alias for super-user, because it can interfere with system operations.
Deleting it from terminal deletes it permanently - recovery is very hard and sometimes impossible.
If your partition type is
If it is not (if you installed Ubuntu with default settings), try the
There is no guarantee you will recover anything though.
You are looking for: extundelete - utility to recover deleted files from ext3/ext4 partition
To find such a package, you can try:
To use the utility install it with:
After installation invoke
Sorry, but files deleted from a command-line with the "rm" and "rm -f" bypass the "Trashcan" you have on the Gnome desktop.
You may also want to ask if there are any extfs "undelete" tools like there are for FAT and NTFS. (I don't know of any, but I'd be surprised if there were none.)
Just as an alternative, if you know specifically what type of file it is...
Now open up
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:
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
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