5

I am using RHEL8, and I see the directory - ~/.local/share/Trash/files And there were so many files in it. Looking at the name and files present there it gave me an intuition that it is similar to recycle bin of Windows OSes.

Just tried playing around with it, and appeared like the files deleted through File manager only comes into Trash - ~/.local/share/Trash/files and not when I deleted them using the rm command. Why is it so? Am i missing something here. I tried googling to get more information regarding this but none of them gave a satisfactory answer.

Can I get more understanding of this directory - ~/.local/share/Trash/files ?

2
  • 1
    @z.h. you can't edit after a while (2 minutes), just delete your comment and rewrite it (I aws also confuse by the don't) Commented Oct 8, 2020 at 8:43
  • 1
    Just a tip. In gnome, if you want to permanently delete a file or directory, select the file, press Shift key and the hit the delete key. Commented Oct 8, 2020 at 9:08

1 Answer 1

4

This is used by programs which comply with the FreeDesktop.org Trash specification. rm doesn’t follow this specification, but many current desktop environments do: instead of deleting files outright, they move them to the appropriate trash directory, thus allowing them to be “undeleted” if necessary.

On the command-line, one tool which can be used is gio trash; gio trash ${file} will move ${file} to the trash, and gio trash --empty will empty the trash. So if you wish you could make rm a function based on gio trash.

1
  • I am trying to create an alias for rm to gio trash. So as part of testing work, I deleted a file using gio trash but I couldn't find the deleted file at the location - ~/.local/share/Trash/files. Not sure where it has gone! Also, I don't see the variable - $XDG_DATA_HOME being set in my environment; which is defined as per the FreeDesktop specification for Trash application right? So how could my GNOME3 be moving the deleted files to - ~/.local/share/Trash/files without $XDG_DATA_HOME being set and where could the gio trash deleted files getting moved to? Commented Oct 10, 2020 at 5:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.