CP 파일 복사
Options
-a | -pPR 옵션과 동일하며, 가능한 한 원 파일의 구조와 속성을 그래로 복사 |
-f | 복사 위치의 파일이 열려있지 않은 경우, 복사 위치에 같은 이름의 파일이 존재할 때 별도의 확인 메시지 없이 파일을 지우고 새 파일을 복사 The target file is not unlinked before the copy. Thus, any existing access rights will be retained. |
-H | If the -R option is specified, symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not 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. (The -i option overrides any previous -n option.). |
-L | If the -R option is specified, all symbolic links are followed. |
-n | Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.) |
-P | If the -R option is specified, no symbolic links are followed. This is the default. |
-p | Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resourceforks, will also be preserved.
If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered.
If the source file has its set-user-ID bit on and the user ID can not be preserved, the set-user-ID bit is not preserved in the copy's permissions. If the source file has its set-group-ID bit on and the group ID cannot be preserved, the set-group-ID bit is not preserved in the copy's permissions. If the source file has both its set-user-ID and set-group-ID bits on, and either the user ID or group ID cannot be preserved, neither the set-user-ID nor set- group-ID bits are preserved in the copy's permissions. |
-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. Created directories have the same mode as the corresponding source directory, unmodified by the process' umask.
In -R mode, cp will continue copying even if errors are detected.
Note that cp copies hard-linked files as separate files. If you need to preserve hard links, consider using tar(1), cpio(1), or pax(1) instead. |
-v | Cause cp to be verbose, showing files as they are copied. |
-X | Do not copy Extended Attributes (EAs) or resource forks. |
ex) cp -dRP /oracle /mnt