Press "Enter" to skip to content

Tired of accidentally deleting documents using rm?

Last updated on March 23, 2019

Sharing is caring!

Tired of accidentally deleting documents using rm?

Create a file /usr/local/bin/trash-rm and paste this content

Next, we add alias in ~/.bashrc

Now, run command

and we are good to go.

Now, every time you use rm command, it will create a trash directory and move the content to that directory.

Funny, it will throw error if you try to rm trash itself. 

Everything is awesome.