Search code examples
linuxbashshellrm

Is there any difference between rm -r and rm -R?


Title is Description.
I just wonder there is any difference between rm -r and rm -R.

Linux man description is seemed like they are totally same(and one more, --recursive), but many people use -r and -R like they aren't same.

So I want to know about not only its functional difference but its practical(or conventional) difference.
Could anyone let me know about this?


Solution

  • According to the OpenGroup / POSIX specification for rm, the -r and -R options are equivalent.

    Source: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

    This probably applies to all modern UNIX / Linux variants.

    But it wasn't always that way:

    The reason for adding -R was for compatibility with other commands that use -R to mean recursive. (For example chmod ... where -r means "remove read permission".)