Dangerous use of 'rm'

Stephen Allen freebsduk at rowyerboat.com
Thu Jul 6 22:25:21 BST 2006


In Linux, rm is commonly aliased to rm -i, for obvious reasons.  When
deleting directories, I usually type rm <path_to_dir> then press enter
and let it fail, so I know I have the right directory.  Then I hit the
up arrow and add -rf to the end of the command.  I like it because it's
reasonably failsafe.

FreeBSD on the other hand, doesn't like the -rf at the end of the
command line, so you need to type 'rm -rf <path_to_dir>', so if you're
unlucky and you autocomplete the wrong path, or you hit enter by
accident on 'rm -rf /' - you're pretty much screwed.

I know the quick answer is not to do these things as root, but is there
a safe way of doing these things like you can with Linux and putting the
parameters on the end of the command?

Cheers,
Steve :)





More information about the Ukfreebsd mailing list