Put files/folders you delete using rm into your Mac Trash Bin.

The following addition to your .bash_profile is super handy if you regularly use the command line/console on your Mac. Instead of simply deleting files forever it will instead put them into the .Trash folder in a unique sub-folder so you can recover them until you empty your bin. Very handy if you delete something by accident!

function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
local dst=${path##*/}
# append the time if necessary
while [ -e ~/.Trash/"$dst" ]; do
dst="$dst "$(date +%H-%M-%S)
mv "$path" ~/.Trash/"$dst"



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store