They say rm
command defaults to the option --preserve-root
. Is that right?
Otherwise I should put the line
alias rm='rm --preserve-root'`
in ~/.bashrc
to make that option happen without typing it every time I run the rm
command. To confirm this I ran type rm
, and got rm is hashed (/bin/rm)
.
I expected rm is aliased to rm --preserve-root
. Does anyone know what's going on with the rm
command?
rm
. – guiverc Dec 01 '17 at 12:34sudo rm -r /
the following message:rm: it is dangerous to operate recursively on '/'
andrm: use --flag-i-wont-mention to override this failsafe
– Videonauth Dec 01 '17 at 12:44rm
. – Dec 01 '17 at 12:57bash
or otherwise). It's a default option in GNUrm
since some years, which is a separate program from your shell. (It's incoreutils
in Debian and Ubuntu). – marcelm Dec 01 '17 at 13:46info rm
, specifically https://www.gnu.org/software/coreutils/manual/html_node/Treating-_002f-specially.html for some background (generally GNU commands have more details ininfo
than inman
pages). As it explains, some related commands likechmod
kept the historic--no-preserve-root
behavior. – Beni Cherniavsky-Paskin Dec 02 '19 at 12:23