Discussing Something to avoid with the recurrsive rm -rf command

The easiest and safest way to delete files and directories in *nix (that I've found) is Midnight Commander. Run ' mc ', CD to directory, Tag files if needed, hit F8 and will delete recursively with a Yes/No prompt.

I can count the times I've used ' rm -rf ' on one hand in DECADES of admin. You need to be careful with it, along with DD - and NOTHING will protect you if you don't have regular Backups. Barring MC, I have a "safe delete" Bash script that I use with ' find ' to delete files.

2 Likes

I did not know you have created this thread.
It does not take very much to accidentally issue this command.
All you need it to have an extra space after the slash.

After I've read numerous horror stories, I permanently forbid myself to use this command.

1 Like

Ameya, the above suggestion rocks!

A quick addition, for those of us using zsh, oh-my-zsh, or another alternative shell, use the resource file for the shell you are using. For example, in my case, I am using zsh.
I would edit ~/.zshrc

1 Like