---
title: "cp: -r or -R?"
slug: cp-r-or-r
url: https://listedarticles.com/articles/cp-r-or-r
canonical_url: https://movq.de/blog/postings/2026-09-30/0/POSTING-en.html
content_type: essay
language: en
published_at: 2026-09-30T00:00:00.000Z
updated_at: 2026-10-03T12:12:53.240Z
author: "movq"
authored_by: human
publisher: "movq.de"
publisher_url: https://movq.de/
topics: ["Programming", "Systems Programming", "Open Source"]
license: all-rights-reserved
word_count: 302
reading_minutes: 1
citation: "movq, movq.de. \"cp: -r or -R?.\" 30 Sept 2026. https://movq.de/blog/postings/2026-09-30/0/POSTING-en.html (all-rights-reserved)"
# The full text follows. The web page shows an extract and sends readers
# to the source above; quote the citation and link the canonical URL.
---

# cp: -r or -R?

> A concise history of why Unix cp has both -r and -R, what POSIX says, and when the flags diverge across implementations.

# `cp`: `-r` or `-R`?

2026-09-30

A question like this recently came up again. I once tried to find an answer, but only posted it in some "forum" a decade ago, and I think it's worth saving this little bit of trivia from digital nirvana.

Nowadays, there's no difference between the two options in GNU coreutils. The current manual page says:
    
    
    -R, -r, --recursive
        copy directories recursively
    

Was that always the case?

Let's look at [the first commit in GNU coreutils](https://gitweb.git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=14fd34b78818660e05806b6eda178e3f846c5c21) (1992). In `src/cp.c`, we have this:
    
    
    case 'r':
        flag_recursive = 1;
        flag_copy_as_regular = 1;
        break;
    
    case 'R':
        flag_recursive = 1;
        flag_copy_as_regular = 0;
        break;
    

So, back then, there was indeed a difference. But that was 34 years ago. Is that still relevant today? Probably not, because ten years later, in 2002, [both options got merged](https://gitweb.git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=246e147a6a6b9d460376f7f7889191d13652456e) and nobody™ still runs coreutils from 24 years ago.

What about other systems?

OpenBSD 7.9 lists only `-R` in the manual and strongly discourages the use of `-r`. It does mention, though, that it still behaves differently than `-R`. Skim through [the code](https://github.com/openbsd/src/blob/f9782c23397ccf5cc0603f149c2b4e11dca8ad97/bin/cp/cp.c) and you can spot a few differences (search for `Rflag` and `rflag`).

NetBSD 11: [Dito](https://github.com/NetBSD/src/blob/477d71b4d1b73a66b61a03b5f6d3dc9212d4f888/bin/cp/cp.c), manual page and code like OpenBSD.

The advantage of `-R` is that it's more consistent across utilities. For example, `chown` knows `-R` \-- but not `-r`. [POSIX](https://pubs.opengroup.org/onlinepubs/9799919799/) acknowledges this as well and recommends `-R`:

> Earlier versions of this standard included support for the `-r` option to copy file hierarchies. The `-r` option is historical practice on BSD and BSD-derived systems. This option is no longer specified by POSIX.1-2024 but may be present in some implementations. The `-R` option was added as a close synonym to the `-r` option, selected for consistency with all other options in this volume of POSIX.1-2024 that do recursive directory descent.
