TL;DR
Get monitors, keyboards and dev gear delivered free — and shop member deals
- Fast, free delivery on millions of items
- Access to Prime Big Deal Days deals on October 6–7
- Prime Video, Amazon Music and more included
A September 30 report revisits the difference between the recursive options in the cp command. GNU coreutils has treated -r and -R as equivalent since 2002, but OpenBSD and NetBSD still document different behavior, and POSIX.1-2024 recommends -R for consistency with other utilities.
A September 30 report revisits a small but persistent command-line question: whether to use cp -r or cp -R to copy directories recursively. The options are equivalent in GNU coreutils, but the report says OpenBSD and NetBSD retain differences, while POSIX.1-2024 recommends -R as the more consistent choice.
The current GNU coreutils manual groups the spellings together as -R, -r, –recursive, describing them as options to copy directories recursively. According to the report, this equivalence dates to a change in 2002, when the two options were merged in GNU coreutils. The report does not identify a current GNU behavior difference between them.
The options were distinct in the first GNU coreutils commit, from 1992. The report cites the original cp source: -r set recursive copying and also set a flag to copy items as regular files; -R enabled recursive copying without setting that additional flag. This is historical evidence, not a description of how current GNU cp handles the options.
Behavior is different on some BSD systems. The report says OpenBSD 7.9 documents -R and discourages -r while noting that -r still behaves differently. It says NetBSD 11 has a similar situation in both its manual and code. The report points readers to implementation details, but does not enumerate every case where the options diverge.
Why -R Travels Better
For people writing shell commands or scripts intended to run on different Unix-like systems, the same option spelling may not mean identical behavior everywhere. A command that works as expected with GNU coreutils may encounter different semantics on BSD systems, according to the report. That matters most when scripts are moved between machines or used in environments where the operating system is not controlled.
The practical guidance in the report is to favor -R for portability and consistency. The reason is not that -r is universally broken: it works as an alias in GNU coreutils. Rather, -R is supported by the systems discussed and is the spelling used by other recursive utilities. For example, the report notes that chown supports -R, not -r.
This is a narrow compatibility issue, not a claim that ordinary users must change existing GNU commands. On a system where the local manual defines the behavior, readers can consult that documentation. For commands shared across platforms, choosing the commonly supported -R spelling reduces reliance on GNU-specific equivalence.
Unix/Linux cp command recursive copy
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
From GNU’s 1992 Implementation
The report traces the question back to GNU coreutils’ initial 1992 commit. At that point, cp’s source treated lowercase -r and uppercase -R differently: both enabled recursion, but only -r set the flag that changed how copied items were handled. The author says the distinction was merged in 2002, making the two options equivalent in GNU coreutils today.
The report also places the choice within standards history. It quotes POSIX.1-2024 as saying earlier versions of the standard included -r, an option associated historically with BSD and BSD-derived systems, but that -r is no longer specified. The standard says -r may still be present in some implementations. It added -R as a close synonym, selected for consistency with other options for recursive directory descent.
The source is a technical blog report dated September 30, 2026, not a new change to cp or a newly issued standards ruling. Its development is a renewed explanation of how the options evolved and why their behavior can depend on the operating system.
““-R, -r, –recursive: copy directories recursively.””
— GNU coreutils manual, as quoted in the report
As an affiliate, we earn on qualifying purchases.
Where the Options Diverge
The report confirms that OpenBSD 7.9 and NetBSD 11 retain differences between -r and -R, but it does not describe the full set of affected file types or copy behaviors. Readers should not infer a specific outcome for every use case from the summary alone; the system’s own cp manual and implementation determine the details.
The report also does not establish whether all versions or configurations of BSD-derived systems behave alike. Its claims concern the named releases and the source material it examined. No new changes to GNU coreutils, OpenBSD, NetBSD or POSIX are reported.
As an affiliate, we earn on qualifying purchases.
Check the Local cp Manual
There is no announced software change or follow-up release in the report. The immediate next step for users is to check the cp manual on the system where a command will run, especially before relying on -r-specific behavior in a script. For commands intended to work across the systems discussed, the report’s standards-based guidance is to use -R.
Any further clarification would need to come from the relevant project documentation or code, particularly for the precise cases in which OpenBSD and NetBSD distinguish the options. Until then, the confirmed takeaway remains limited: GNU coreutils treats them as equivalent, while the cited BSD systems do not.
portable command line copy utility
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
Are cp -r and cp -R equivalent?
In current GNU coreutils, yes: the manual lists -r and -R together as recursive-copy options. The report says they can behave differently on OpenBSD 7.9 and NetBSD 11.
Which option should I use for portability?
The report recommends -R. POSIX.1-2024 no longer specifies -r and says -R was selected for consistency with other recursive options.
Why did GNU cp have two different options?
The report’s review of GNU coreutils’ 1992 source found that -r and -R set different flags. It says the options were merged in 2002.
Does -r always work on BSD systems?
The report says OpenBSD and NetBSD still have -r, but its behavior differs from -R. It does not list every difference, so check the local cp manual before relying on a particular result.
Source: hn
Fall Picks
fall essentials
As an affiliate, we earn on qualifying purchases.
