Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- I'm more inclined to use the uppercase -R as it's standardized by POSIX and will generally behave the same on any POSIX compliant system.
- -h perhaps the only useful comment here. -R just looks baroque, but ls(1) might think it fine. I once read an article about the inconsistencies in *nix CLI commands, but the picture's much better than hot-key and shortcut conflicts- <which get silently absorbed by whatever's running, no way to tell what they might've done or where they went..> I hestitate to consult documentation, because of course there is non anymore. Why not Google it?
- Kind of off topic, but why in the world in 2026 do POSIX utilities still rely on global variables to pass around state? Is it too complicated to pass around a struct address in C or something?by dataflow
- -a
Not sure why you wouldn't want to preserve timestamps, links, etc. by default.
by mkl - > nobody™ still runs coreutils from 24 years ago.
I'll take the honorary title of nobody ;-)Sprite 2.077 pc386 Welcome to Sprite root@cherimoya [1] # cp --version GNU fileutils 3.9 root@cherimoya [2] # cp --help | grep recurs -r copy recursively, non-directories as files -R, --recursive copy directories recursively root@cherimoya [3] #by spijdar - For those that don't know what 'copy as regular file' means, it means the copy command opens any file as though it was a regular file. If you have a FIFO queue sitting around it will read the content of the FIFO queue - if nothing writes to it, the command will hang. If you do cp -r /dev/zero foo, it will write zeroes into foo until the disk is full. -R otoh will copy a fifo queue as a fifo queue.by ddosmax556
- The POSIX standard does not appear to support -r lowercase (so don't use it!):
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/c...
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/
Edit: adjusted to the latest version of the standard.
by chasil - This blog post is odd because it keeps on hinting about a difference between `-r' and `-R' and links to the source code but never actually says what it is. I'll quote the OpenBSD manual that the post mentions but does not link to for some reason:
> Historic versions of the cp utility had an -r option. This implementation supports that option; however, its use is strongly discouraged, as it does not correctly copy special files, symbolic links or FIFOs.
by bariumbitmap