If you really want to stop yourself typing rm -fr ...
you could alias out the command.
if you edit the file ~/.bashrc and include the following line in the alias section:
alias rm="rm --"
This means that every time you type the rm command, it gets substituted with rm --
; the --
tells rm that you have finished entering options and everything after the -- should be treated as a file name. Therefore, once you have given the alias command, typing rm -f
will cause the computer to execute rm -- -f
, and, assuming that you have no file called "-f", you will get an error message along the lines of "rm: cannot remove '-f': No such file or directory"
If you are feeling really paranoid, you could use alias rm="rm -i --"
instead. The -i asks rm to prompt before every delete.
Note that the alias will only apply to shells started after you have edited .bashrc, so don't type rm -fr /
in an existing terming to see if its worked!
If you actually want to use any options with rm, you can avoid the alias by giving the command /bin/rm ...