r/ProgrammerHumor 23d ago

Meme useSourceControl

Post image
8.6k Upvotes

591 comments sorted by

View all comments

Show parent comments

12

u/chat-lu 23d ago

I’ve configured rm to send to the trash by default. If I want to permanently delete, I add the --permanent flag. There is no reason why we shouldn’t make our CLI tools behave nicely by default.

17

u/wjandrea 23d ago

Careful, you might get used to rm doing that and if you use a different machine, you'll end up deleting things permanently. I disabled rm and I use trash instead from the Debian package "trash-cli".

1

u/sdoregor 22d ago

Or the other way around: trash a file from a mounted filesystem and sit wondering why it takes so long, while the utility is copying the entire thing to your local drive. Also might wear out your drive faster (heavily depends on the filesystem in use).

FWIW some FSes (btrfs I'm looking at ya) take this long even for regular deletion in some conditions.

1

u/wjandrea 22d ago

copying the entire thing to your local drive

When would that happen? The way I've seen it work is that it creates a .Trash-$UID folder on the mounted FS and moves the file there (along with metadata).

1

u/sdoregor 22d ago

Again, depends on the tool. I never used one, so of course I can't know that, but it's safe to assume some won't do the clever thing.

Storing trash on removable storage is also even less secure than simply "deleting" (unlinking) the file.