Last Updated: March 04, 2018
·
168
· madcello

fallback trashbin and log

I've screwed too many times deleting something from shell. And if I went to search the file from ~/.local/share/Trash/*, if a couple of days (or hours) were passed, i'd probably had forgot where were them before. So this script shadows rm command and logs what you were trying to delete to a better known location.

Add this to your .bashrc

rm(){
    mkdir ~/.trashbin &> /dev/null
    for beep in "$@"
    do
        echo "rm $beep from $PWD" >> ~/.trashbin/trashbin.log
        mv "$beep" ~/.trashbin
    done
}

It supports multiple files, directories and wildcards. This allows you to delete your trashbin when you need it or restore it easier.

But I want my files to disappear. They can't be recoverable.

Well, remember shred command and use each when it's needed.

Improvements accepted. Thank you all for your contributions too.