10

I have a 32 GB USB flash drive. When deleting files from the drive where the drive is plugged into a Ubuntu 16 laptop, it creates a folder called '.Trash-1000'

This .Trash-1000 folder contains two folders which are 'file' and 'info' where file contains the files I have deleted and info contains metadata about those files.

The issue is this .Trash-1000 folder takes up space because it holds a copy of the deleted file. I then have to eventually delete the .Trash-1000 folder when it starts filing up after multiple deletes.

Is there a way to disable this feature on the USB drive?

4
  • 1
    How are you deleting the files? Commented Jul 1, 2017 at 20:59
  • Through the Ubuntu GUI. Could that be the issue? Commented Jul 1, 2017 at 21:46
  • Yes; it is moving the files to Trash, not deleting them. Use rm. Commented Jul 1, 2017 at 21:52
  • 1
    This is a basically a usability bug in the Ubuntu GUI. It should be very explicit in telling you that it's moving them to trash, not deleting them. Most mainstream OSes supply a "permanent delete" keybind by default that usually uses one extra modifier key (e.g. Cmd+Delete) than the "trash" keybind (e.g. Delete) for the "more extreme" alternative to trashing. Commented Aug 22, 2022 at 11:41

3 Answers 3

12

I have found an interesting workaround that works on a per device basis, tested on Xubuntu 18.10 with USB devices and EncFS mounts.

It's very simple, remove the desired .Trash-$(id -u) directory (id -u is most commonly 1000), and create a file instead with the same name:

rm -rf /path/to/.Trash-1000
touch /path/to/.Trash-1000

What happens now when you remove a file, at least with Thunar, is that instead of moving the files to the Trash, a dialog appears warning you the files will be destroyed (which is awesome too, since you don't want them destroyed by accident).

2
  • The force flag wasn't required on Fedora 36 for removal, rm -r was enough. Used on two internal HDDs. \ I haven't yet confirmed if creating the file .Trash-1000 prevents the folder with a same name from being created. Commented Jun 22, 2022 at 8:42
  • It does work, this should be the accepted answer. Nautilus is also smart enough to warn me that files will be permanently deleted when I use regular Del without Shift if .Trash-1000 already exists as a file. You cannot have a file and directory with the same so it would have to delete the file to create it, which it doesn't seem to. Commented Jul 10, 2022 at 11:17
9

Have a look at this article.

According to the article, Ubuntu will create such folders when a file is deleted from a USB drive. Presumably this would allow a file to be restored if you accidentally deleted it.

It contains the following solution:

Don't use the delete button only (Otherwise the .Trash-1000 folder will be created)

Press the key combination shift+delete together to delete then Ubuntu won't create a .Trash-1000 folder. (Note: If you delete files and folders this way they are gone forever!)

As alternative you can also use the command line's rm command which will also delete the file directly.

2
  • Nice, that solution of doing shift+delete does not create the .Trash-1000 folder. Also I realized if open a terminal at the USB location and do an rm command, it does not create the .Trash-1000 folder either. Commented Jul 2, 2017 at 1:59
  • This is not really a solution, more of a workaround. Yes, Shift+Del is useful on bigger hard drives, but there are cases like small USB drives where you want it to be the default without Shift because you aren't going to remember every time. Commented Jul 10, 2022 at 11:18
3

I too am one of those who have been bugged by this problem for a number of years ... unsatisfied with the existing proposals, I've recently taken the time to investigate a solution myself.

Starting with the premise that I want the Trash to be gone system-wide, I've found that -- for the time being -- the only real solution is to create a custom-compiled version of libgioGIO) which is modified to call g_file_delete() every time an application calls g_file_trash().

For all technology savvy users interested in this solution: I've just recently posted a step-by-step guide on GitHub:

Globally disable GNOME's Trash in Debian-based distributions

0

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.