HACKER Q&A
📣 amichail

Do you feel anxiety if you don't use the -c flag when using cp on macOS?


I think this is something macOS should do automatically whenever it can. You shouldn't have to specify this flag manually.


  👤 watersb Accepted Answer ✓
The `-c` flag enables a fast "clone" of the file on APFS, Apple's current filesystem.

That operation is very fast, as it is like a directory entry adding another pointer to the existing data. But unlike a simple "hard link", any future modifications to this clone will write distinct data blocks to.the filesystem: the original and the clone are independent files, they just share any blocks that store data in common.


👤 gregjor
If it bothers you that much make an alias. In your .profile or .bashrc (or whatever your shell reads at startup):

  alias cp=“cp -c”
Or give it another name if you like.