cpcommand copies the contents of one or more files or directories to a target file or directory.
cp [source1] [source2] [source3] ... [target]
- -a: Same as -pPR options. Preserves structure and attributes of files but not directory structure.
- -f: If the destination file cannot be opened, remove it and create a new file, without prompting for confirmation regardless of its permissions. The target file is not unlinked before the copy, so any existing access rights will be retained.
- -H: If -R is specified, symbolic links on the command line are followed.
- -i: Cause cp to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character y or Y, the file copy is attempted.
- -L: If the -R option is specified, all symbolic links are followed.
- -n: Do not overwrite an existing file.
- -P: If the -R option is specified, no symbolic links are followed.
- -p: Cause cp to preserve the following attributes of each source file in the copy.
- -R: If source_file designates a directory, cp copies the directory and the entire subtree connected at that point. If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. This option also causes symbolic links to be copied, rather than indirected through, and for cp to create special files rather than copying them as normal files.
- -v: Cause cp to be verbose, showing files as they are copied.
- -X: Do not copy Extended Attributes (EAs) or resource forks.