rm wrapper

19 Mar 2012

Sometimes when I run:

$ rm foo

I realize I didn’t mean it, so with this in my mind I made a little wrapper around rm, now, when I remove files, they’re send them to the trash bin, it’s compatible with nautilus/pcmanfm.

Example: If I run from a terminal $ rm img.png I can then go to the Trash carpet in Nautilus and restore it. If I delete an item with Nautilus (by pressing the Supr button) I can open a terminal and type $ rm -u img.png and get back my stuff.

If you want use the script, download and move it to /usr/local/bin, then you can use as rm_ or even override rm through and alias defined in the ~/.bashrc file:

$ alias rm='trash'