18

I am trying to understand the Raspbian file system better. I opened properties on the Raspberry Pi's "Wastebasket" hoping to find out where it is located in the file system and I found trash:///.

Can anyone explain this, please? I expected to find some folder off of root e.g. /some-dir/trash.

System info: Raspberry Pi 4B
OS: Raspbian Buster

1
  • 2
    Hello and welcome to this community. Add the RPi model and the OS you have installed. Also, you should explain your purpose to get a better answer.
    – M. Rostami
    Jan 16, 2020 at 13:36

3 Answers 3

26

The folder trash can is in /home/pi/.local/share/Trash/. In this folder, there are two folders, files and info.

/home/pi/.local/share/Trash/files/  

/home/pi/.local/share/Trash/info/  

Source

2
11

You can find it at: /home/pi/.local/share/Trash/.

The trash:// prefix comes from gvfs (GNOME Virtual File System) / the XDG Spec. It does map to an actual filesystem path, but the idea is that applications don't need to know it if they use a certain platform like gvfs.

It also looks friendlier to users, like the 'Recycling Bin' on Windows.

8

It has one, but it also does not...

On one hand there is not concept of a trash bin/wastebasket on Linux, especially when dealing with the shell. rm deletes (more or less) for good.

But on the other hand there IS a trash specification that most Desktop Environments use (like KDE and xfce), published by freedesktop. When you delete things using the GUI they will be shown in trash:///, but the actual location is for the most part ~/.local/share/Trash which has two sub-directories:

  • files which stores the actual files
  • info which contains information to the files, such as
    • original filename/path
    • size

There is a pitfall though: when you have another filesystem, such as a USB stick or an external HDD, the implementation of the specification is permitted to also store a trash directory in the filesystem's root directory (so if you mounted your USB in /mnt/usb/ it would be that fs' root directory) with the name Trash-XXXX where XXXX is your user id.

Another, slightly less common thing is that the main Trash directory is dependent on the $XDG_DATA_DIR environment variable.

For more information on the spec: https://specifications.freedesktop.org/trash-spec/trashspec-latest.html

But can't I put things into the trash from the Shell? You may ask. Well, yes but the only implementation that is not dependent on the desktop environment you are using, that I found, was a seemingly unmaintained python implementation with quirks like entering an infinite loop with no feedback to the user when certain operations fail. So it's not really suited for scripting purposes, maybe passable for interactive sessions.

Here is its GitHub repo: https://github.com/andreafrancia/trash-cli

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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