"rm" command defaults "--preserve-root" option?

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?

12

1 Answer

rm is not being aliased to rm --preserve-root, but the option is selected by default in the rm binary.

From the manpage of rm in Ubuntu 17.10, you can find the following details of the --preserve-root and --no-preserve-root options:

 --no-preserve-root do not treat '/' specially --preserve-root do not remove '/' (default)
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like