Hey everyone! I'm wondering if there's a way to automatically change the `rm` command to `mv file/dir ~./local/share/Trash/files/`. This would help prevent accidental deletions since I tend to make mistakes. Basically, I want Bash to swap out `rm` for the `mv` command I mentioned. Is this something that's complex or only for experts? I'm not really experienced with this stuff, so any help would be appreciated. Thanks!
4 Answers
Another option is to set an alias like this: `alias rm='mv -t ~./local/share/Trash/files/'`. Just make sure to test it before relying on it too much with important files!
If you're up for a bit more complexity, you could consider using Btrfs for your home directory. It supports periodic snapshots, which can help keep track of changes and let you roll back if something goes wrong.
Be careful with any idea that sounds too easy! Replacing system commands can lead to major issues, especially if something goes wrong. I'd recommend sticking with safer options like aliases or using dedicated tools like `trash`. Better safe than sorry!
You can definitely do that! A popular approach is to install a tool called `trash` and then create an alias for `rm` that points to `trash`. This is something I do all the time and it helps avoid issues, plus you won't need to remember to add `-rf` when removing directories. It's a solid setup!
That's a great idea! If you need the original `rm`, you can still use `rm` to bypass the alias.
Quick question, do I just run `sudo apt install trash` to install it? And can I get the files back if I move them to trash?
That sounds interesting! How exactly do I set up an alias? Should I use vim or something?