Trash (a better rm)

Published on April 4, 2019

Trash is a small OSX utility that moves files and folders to the trash instead of deleting them immediately.

To install it, simply run:

brew install trash

Then add this to your ~/.bashrc or ~/.zshrc file:

alias rm='trash'

From there onwards, everytime you type rm things will go to your trash.

One nice benefit of using trash is that you don't need to pass the -rm flag for deleting folders.

trash folder_name

# Of if you are using the alias:

rm folder_name

PS: At times, trash might fail to delete some files. Just use \rm to bypass the alias.

\rm -rf myfolder