3 ms·
>I'm pretty sure that means it won't do anything Assuming an rm without the "-preserve-root" default, it would remove everything that it had permission to. So
by tyingq 9y ago
>I'm pretty sure that means it won't do anything
Assuming an rm without the "-preserve-root" default, it would remove everything that it had permission to. So, eventually, for example, it would wipe your home directory.
I suspect this to be the case for OSX, Alpine Linux (or other distros that use busybox), probably some of the BSD distributions, etc.
- jwilk 9y ago$ uname -sr FreeBSD 11.1-RELEASE $ rm -rf / rm: "/" may not be removed No idea about other BSDs. Busybox's rm is indeed happy to nuke /.
- jwilk 9y agoAlso: $ uname -sr OpenBSD 6.1 $ rm -rf / rm: "/" may not be removed
- jwilk 9y agoThe latest POSIX standard actually requires this behavior: If […] an operand resolves to the root directory, rm shall write a diagnostic message to standard error and do nothing more with such operands. Source: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm...