- Ashik Nesin
rm command is quite dangerous. If you delete something then it's gone forever.
And if you've deleted something accidentally then there is no chance of recovering it (at least easily)
That's where Trash CLI comes in.
With its help of it, we
Like UNIX philosophy, "Do one thing, do it well"
It does one thing (deleting files/directories) and does it well (move it trash instant of permanent delete)
How to install?
It is currently available only for MacOS, if you're on Windows trash-cli seems to be a good alternative.
In MacOS, you can install this easily with brew
brew install trash
With that you can use
trash CLI in your machine
And now, you can use
trash command instead of
rm. It has the same API as that of
Setting alias for rm
trash can be a drop-in replacement for
rm because it has a similar API.
In your bash/zsh profile, you can set an alias like this
if exists trash; then alias rm='trash' fi
Happy safe deletes!