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'm wondering if it is possible to restore a file that is in the trash (~/.Trash) to its original location.

I understand there is a restore command but I don't understand its arguments or how to correctly use it.

Is this a fairly simple thing to do?

share|improve this question

migrated from Oct 12 '12 at 10:50

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

As far as I know, in the trash folder (~/.local/share/Trash/), there is a folder with the files (files/) and a folder with the file information (info/). Each file has an associated .trashinfo file in which the original path and time of deletion are stored. You can use that to restore the file to its original location.

share|improve this answer
What distribution (Ubuntu, Fedora, etc.) and desktop (KDE, Gnome, etc.) are you using? My system (RHEL 5 w/Gnome) has .Trash not .local/share/Trash and there are no files/ and info/ subdirectories. There is, in fact, no way to tell what the original location was. – Stephen P Oct 28 '10 at 20:57
Hmm, interesting. I'm using Xfce with Ubuntu, but I've seen it on Debian and Fedora systems too, not sure about the DE. Looks like my answer does not apply for this question then. – Wolf Oct 28 '10 at 20:59

.Trash is just a (hidden) directory. All you need to do is move it out:

mv ~/.Trash/foo ~/

or using the file browser of your desktop environment, open the trash and drag it out.

share|improve this answer

If your desktop environment followed the XDG Trash Can Specification when trashing the file, then restore-trash from trash-cli would do the trick.

share|improve this answer

You must log in to answer this question.