Trash location in macOS vs Linux

⏱reading time: 2 min

White trash (oh wait!) on macOS

The other day, I explained that there is a way to send files and folders to the trash from the the shell. Now, I just found out that there are differences between where is located the trash (it’s a folder nonetheless) in macOS and Linux.

In macOS, the trash is located in your user’s folder ~/.Trash  and seems that it’s the only trash accessible by your user, even if you are deleting stuff with rmtrash  and sudo . In other words, everything you send with the rmtrash command is moved to  ~/.Trash. However, if you use a trash-cli  command ( trash-put  for example, or just trash ) you are moving the files to somewhere else that I haven’t found out yet. Therefore, you have to empty the trash-can with trash-empty  or restore with trash-restore . Probably, the answer of to this question (where is the trash-cli’s can on macOS?) is (or it isn’t) in the FreeDesktop.org Trash specifications. However, I think that it’s much better to use rmtrash on macOS, since it’s a much nicer and neat command. And easily to understand.

On another hand, in Linux, you can only use trash-cli (you can’t get rmtrash  AFAIK), and I recommend you to install from source, as explained in it’s GitHub site, because if you install using apt-get  you are going to get a some kind of an old version without all the commands ( trash-restore  was missing).

In Linux, you have two trashes when you are operating with trash-cli  on shell. One is your user’s trash and you can access to it on this path  /home/$USER/.local/share/Trash . There, you can see two folders files and info. I guest that you already know where are the files and where are the info / metadata of the files. However, if you use the command sudo trash-put  you files are going to be moved to /root/.local/share/Trash (obviously, or not that obvious as we’ve seen in macOS).

For the other trash-cli  commands the fashion is the same and if you wanted to see the folders you trashed with root or restore a file from there, you need to use sudo  before the command.

Now, you are ready to trash whatever you want.

Leave a Reply