You are not logged in.
I just removed a couple of files by accident with rm. Unfortunately, I don't have any trash functionality configured on my system. All CLI users that use some trash tool I ask: What's your trash solution? I couldn't find a widespread method. Is there some (pseudo-)standard? What practice would you consider the most common one?
Creating an alias dl (for "delete") for mv -t ~/.Trash seems like a good idea to me, except that trash from other partitions will also end up in my home directory.
I'm aware of the package trash-cli. Do you use it? It's kind of verbose; do you alias it? Will I encounter problems with different partitions or block devices?
Thanks a lot!
Offline
hi,
trash from other partitions will also end up in my home directory
can you explain ?
Offline
hi,
trash from other partitions will also end up in my home directory
can you explain ?
I think the OP means, they are used to some kind of trash tool where "deletion" just moves the item to a place under ~/.Trash
So, if you have some extra storage mounted, and you "delete" it, it gets copied to your home directory. (Presumably.)
Offline
All CLI users that use some trash tool I ask: What's your trash solution? I couldn't find a widespread method.
People can configure their system how they want. It's not surprising that there is no standardisation amongst all the ad hoc hacks that everyone comes up with for doing this non-standard thing that you want to do.
This is the benefit and curse of using Linux: do what you want, but don't expect it to be standard.
I recommend just get used to the fact that there is no trash. Just get used to using rm. You will thank yourself when you realise how clean your system is without all the crap from the past hanging around. You deleted it, right, so why is it still hanging around?
Sure, if you use rm, it's (basically) gone forever. So don't use rm willy nilly. If you're not sure if you want a file gone forever, save it somewhere and decide sometime in the future whether to rm it. That is basically what all the so-called "trash" systems do anyway.
But when you decide it's really time for that file to be gone, don't equivocate. Pull the trigger. Use rm.
Last edited by /dev/zero (2019-03-02 12:10:34)
Offline
I usually just open a file manager in the current directory ("nautilus .") if I want to delete files or folders. File deletion mistakes usually happen due to wildcard expansion gone wrong (or accidentally hitting the space bar in the wrong place), so a GUI is much better because you cannot shoot yourself in the foot with a badly thought out wildcard. Who has the discipline to test each wildcard expression first?
So "alias rm=nautilus" is best in my experience... ![]()
Offline
@/dev/zero
You're right, there's not standard, I just hoped for some pro-recommendations :-)
Also, I've been using rm for 5 years now and this is just the second time I deleted something important by accident (this time: typing error). I thought there might be a good solution (maybe just a simple tweak or configuration) of which I'm just not aware. Couldn't find anything online, that's why I'm posting here, hope that's OK :-)
Offline
The AUR package rmtrash has rm/rmdir compatible scripts for trash-cli if you really want to replace your standard commands. trash-cli follows the xdg trash specification: https://www.freedesktop.org/wiki/Specif … rash-spec/
Normal trash will be in $XDG_DATA_HOME/Trash.
Trash from other partitions may land in one of these locations:
$MOUNTPOINT/.Trash/$UID if the .Trash exists and $UID exists/can be created
$MOUNTPOINT/.Trash-$UID if .Trash is missing and .Trash-$UID exists/can be created
$XDG_DATA_HOME/Trash if both $MOUNTPOINT options fail.
as a last resort the trash operation is refused and nothing is deleted.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
@/dev/zero
You're right, there's not standard, I just hoped for some pro-recommendations :-)
Also, I've been using rm for 5 years now and this is just the second time I deleted something important by accident (this time: typing error). I thought there might be a good solution (maybe just a simple tweak or configuration) of which I'm just not aware. Couldn't find anything online, that's why I'm posting here, hope that's OK :-)
Yeah, I see.
So, you've got an existing alias. It works okay, except you don't want your home directory populated with files when you delete them from some extra storage device you've got mounted?
What would you say should happen to a file on the extra storage when you delete it? Just rm it?
Offline
genericaf wrote:@/dev/zero
You're right, there's not standard, I just hoped for some pro-recommendations :-)
Also, I've been using rm for 5 years now and this is just the second time I deleted something important by accident (this time: typing error). I thought there might be a good solution (maybe just a simple tweak or configuration) of which I'm just not aware. Couldn't find anything online, that's why I'm posting here, hope that's OK :-)
Yeah, I see.
So, you've got an existing alias. It works okay, except you don't want your home directory populated with files when you delete them from some extra storage device you've got mounted?
What would you say should happen to a file on the extra storage when you delete it? Just rm it?
I've not actually tried using the alias rm for mv -t ~/.Trash yet. Concerning your question, I think I really like the freedesktop.org's trash-spec which user progandy has kindly linked. I will have a deeper look into the rmtrash package! But I hope some more users want to share their experience here.
Offline
I just use rm sparingly, only when I really want to remove something. I have a junk folder for when I'm just cleaning up stuff that I suspect I will not need again and want to get out of the way, I just move old documents into the junk folder. Periodically I create a dated subfolder of junk and move all of it's contents into the subfolder (so I get nested older and older junk folders).
I rarely ever look into my junk folder, but it has saved my *** a few times when I did need to track down some old information.
Last edited by Trilby (2019-03-02 15:22:47)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I second trash-cli since it is in the community repo and as Progandy said, it follows xdg.
Offline
As noted; use `rm` thoughtfully. And have a tested backup regime, incremental and snapshots.
Offline
I echo the above comments really.
Read this comment about not using rm unless you are sure that you want to, it sums up the argument quite nicely...
https://apple.stackexchange.com/a/17625
And make sure you keep good backups, they need testing regularly anyway to be of any use.
Offline
genericaf wrote:All CLI users that use some trash tool I ask: What's your trash solution? I couldn't find a widespread method.
People can configure their system how they want. It's not surprising that there is no standardisation amongst all the ad hoc hacks that everyone comes up with for doing this non-standard thing that you want to do.
This is the benefit and curse of using Linux: do what you want, but don't expect it to be standard.
As progandy mentioned, there *is* a standard and it is called the XDG/FreeDesktop Trash Specification.
It doesn't specify which tool you should use to transfer files into the trash, but it definitively defines what a trashcan should look like...
...
And generally in response to the thread: I encourage the use of trash-cli (but then I am also the maintainer of the [community] package). You can if you choose use trash-put as an alias for the rm command, since trash-put supports flags like -d -f -i -r as "ignored (for GNU rm compatibility)".
Some other people might suggest using alias rm='rm -i' for interactive shells, as that will prompt you for each file you try to delete. But that is *not* a trash implementation, it just -- purportedly -- makes you think twice before deleting anything to prevent e.g. fat-fingering and removing things you did not mean to.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Some other people might suggest using alias rm='rm -i' for interactive shells, as that will prompt you for each file you try to delete. But that is *not* a trash implementation, it just -- purportedly -- makes you think twice before deleting anything to prevent e.g. fat-fingering and removing things you did not mean to.
Yes. The issue with this is that, over time, you become habituated to hitting Enter twice... It's not really a safety net, it just makes you think you have one.
Offline
I did say "purportedly".
I haven't extensively experimented with such a workflow... in fact, I have not even tried such a workflow at all...
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline