Hasty Briefsbeta

Bilingual

cp: -r or -R?

a day ago
  • In modern GNU coreutils, there is no difference between the -r and -R options for cp; both are identical and perform recursive directory copying.
  • Historically, in the first GNU coreutils commit (1992), -r and -R differed: -r set a flag to copy regular files as regular, while -R did not.
  • Other systems like OpenBSD and NetBSD still distinguish between the two, with -R preferred and -r discouraged, though -r remains different in behavior.
  • POSIX.1-2024 no longer specifies the -r option for cp, recommending -R instead for consistency across utilities that perform recursive directory descent.