coreutils: Treating / specially

1 
1 2.11 Treating ‘/’ specially
1 ===========================
1 
1 Certain commands can operate destructively on entire hierarchies.  For
1 example, if a user with appropriate privileges mistakenly runs ‘rm -rf /
1 tmp/junk’, that may remove all files on the entire system.  Since there
1 are so few legitimate uses for such a command, GNU ‘rm’ normally
1 declines to operate on any directory that resolves to ‘/’.  If you
1 really want to try to remove all the files on your system, you can use
1 the ‘--no-preserve-root’ option, but the default behavior, specified by
1 the ‘--preserve-root’ option, is safer for most purposes.
1 
1    The commands ‘chgrp’, ‘chmod’ and ‘chown’ can also operate
1 destructively on entire hierarchies, so they too support these options.
1 Although, unlike ‘rm’, they don’t actually unlink files, these commands
1 are arguably more dangerous when operating recursively on ‘/’, since
1 they often work much more quickly, and hence damage more files before an
1 alert user can interrupt them.  Tradition and POSIX require these
1 commands to operate recursively on ‘/’, so they default to
1 ‘--no-preserve-root’, but using the ‘--preserve-root’ option makes them
1 safer for most purposes.  For convenience you can specify
1 ‘--preserve-root’ in an alias or in a shell function.
1 
1    Note that the ‘--preserve-root’ option also ensures that ‘chgrp’ and
1 ‘chown’ do not modify ‘/’ even when dereferencing a symlink pointing to
1 ‘/’.
1