Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I remember the nice mv somefile ~/.Trash command but that folder does not exist on newer Ubuntus. Does anyone know why?

share|improve this question
add comment

3 Answers

up vote 32 down vote accepted

According to the freedesktop.org Trash Specification:

For every user a “home trash” directory MUST be available. Its name and location are $XDG_DATA_HOME/Trash ; $XDG_DATA_HOME is the base directory for user-specific data, as defined in the Desktop Base Directory Specification.

If the environment variable $XDG_DATA_HOME is either not set or empty, ~/.local/share is used. So by default, the trash folder is ~/.local/share/Trash.

Regardless, the easiest and best way to trash a file from the command line is to use the trashInstall trash-cli command.

Use it like you would use rm:

trash somefile.txt

This is better than just mv'ing a file into ~/.local/share/Trash because it stores metadata such as where the file was originally so you can restore (un-delete) it if need be.

share|improve this answer
3  
In the version of trash-cli I installed today (2012-06-24), the command is trash-put instead of trash. –  Benjamin Oakes Jun 24 '12 at 13:39
add comment

You can find it here. ~/.local/share/Trash/

share|improve this answer
add comment

it is because of the latest XDG Base Directory Specification: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

share|improve this answer
    
I want to mark this as the real answer to my question because I it is a "why" question but the spec does not mention anything abut Trash folders. Could you please explain how XDG spec affected the .Trash convention? –  Aleksandr Levchuk Nov 22 '10 at 22:32
    
@Aleksandr I have updated my answer with an explanation. –  Alvin Row Nov 23 '10 at 2:33
    
@Aleksandr Updated DoR answer explains everything :) –  Paweł Karpiński Nov 23 '10 at 6:38
    
This is cool. Thanks guys! –  Aleksandr Levchuk Nov 24 '10 at 1:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.