Linux: gnome, xfce, where is trash location

Perm URL with updates: http://xahlee.info/linux/linux_trash_location.html

What's the Linux command to put things in trash?

You can do gvfs-trash ‹filepath›.

Where is the trash folder?

Example trash location:

  • 〔~/.local/share/Trash/〕 → on your local file system.
  • 〔/media/PENDRIVE/.Trash-1000/〕 → on a USB drive.
  • 〔/root/.local/share/Trash/〕 → if you are root, on your local file system.

How does Linux Trash Work?

In the trash dir, there are 3 dirs:

  • 〔expunged〕→ (this is not in spec.)
  • 〔files〕 → contains the actual trashed files.
  • 〔info〕 → contains text file that has info about trashed file.

For example, if you have a file at 〔/home/jane/Downloads/cat.jpg〕 and you deleted to trash. Then, you'll have:

  • 〔~/.local/share/Trash/files/cat.jpg〕
  • 〔~/.local/share/Trash/info/cat.jpg.trashinfo〕

and the file 〔cat.jpg.trashinfo〕 will have content like this:

[Trash Info]
Path=/home/jane/Downloads/cat.jpg
DeletionDate=2013-05-29T00:09:26

You can delete the trash dir. ⁖ rm -rf ~/.local/share/Trash/.

Reference. 〔The FreeDesktop.org Trash specification @ www.ramendik.ru…

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?