19

I don't believe in Trash Bin and when I delete something I want it to be gone forever, how to turn off the Trash?

P.S. When I delete files from the console do they also go to Trash?

RolandiXor
  • 51,541
UAdapter
  • 17,587
  • It is really easy to shut off in Raspbian - a simple preference. But in Ubuntu they have kept it this way for a LONG time. Nobody has ever explained why. In any case, 6 years after this question was asked, it is now July 2017 and in Ubuntu 16.04 LTS, this is the best you can do: First, go to Appearances and set it so the menu will show up in the window title, then go to the File Manager and select Homes/ Press Alt-E then pick Preferences and there is an option there to turn on a Delete option under Move to Trash in the context menu of files or directories. – SDsolar Jul 29 '17 at 05:28

8 Answers8

11

You can use Shift+Delete instead of Delete to delete file(s) forever, but don't forget; If you delete the file forever, you can't easily get it back.

Isaiah
  • 59,344
kv1dr
  • 1,381
10

You can add a delete action as described at How to delete files bypassing trash . Files deleted from the console are immediately removed, but please note that under some circumstances they can still be recovered, if you want to securely delete files use the "wipe" command.

João Pinto
  • 17,159
4

Hmmm.

Places->Home Folder->Edit->Preferences->Behavior->Include a Delete command [...]

Yes, console deletes have no "recycle" action - they are gone.

3

On my mp3 player I added a file called .Trash-1000 (not a directory), which just gets in the way.

I hit Delete and get prompted: Cannot move file to rubbish, do you want to delete immeditately? with the default action Delete.

Good enough for my needs.

bsb
  • 131
  • 4
2

The answer by SirCrow with the immutable bit might be better, but here's another alternative solution. In my case, I solved it with:

sudo chown -R root:root ~/.local/share/Trash

This will change ownership of the location where the trashed files are typically stored to root, making the normal, non-root user unable to use the trash. Of course, this assumes the current desktop user is not running as root, but typically that's not the case since it isn't recommended anyway.

When the Trash directory is owned by root in this way, you'll see the message:

Cannot move file to the bin, do you want to delete it immediately?

As was answered before, anything deleted from Terminal/Console is gone for good -- No trash.

Tested in Ubuntu 20.04 LTS.

John
  • 21
  • Well they all seem like pretty hacky options, but yours seems as good an answer as any of the previous ones IMHO. Kudos for a useful and well-explained first-answer and late-answer. It's pretty rare we see that around here ;-) – NotTheDr01ds Sep 13 '21 at 20:09
2

You can set the immutable bit.

To do so, first empty the trash:

rm -rf ~/.local/share/Trash/*

And then:

sudo chattr +i ~/.local/share/Trash/

After that, when you delete or move something to the trash, you'll get the following message:

Cannot move to trash, delete it immediately?

EDIT: Actual results below

chattr: Inappropriate ioctl for device while reading flags on /home/sg1/.local/share/Trash/
SirCharlo
  • 39,486
SirCrow
  • 29
1

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

I hope this is of (some) help to those who hate the Trash with the same passion as I do ...

0

For the external drives, remove any /.Trash-$UID directories.

For the current drive, as for the workaround, you can set Bin to automatically empty (e.g. every hour). To do that, go to Activities and type File History & Trash (part of Settings). From there you can adjust the Rubbish Bin settings. You can also find the steps how to get into Rubbish settings in Ubuntu's Help.

kenorb
  • 10,347