cp

cp 复制文件或文件夹.

用法

cp [OPTION]… [-T] SOURCE DEST
cp [OPTION]… SOURCE… DIRECTORY
cp [OPTION]… -t DIRECTORY SOURCE…

  1. -a, --archive
  2. same as -dR --preserve=all
  3. --attributes-only
  4. don't copy the file data, just the attributes
  5. --backup[=CONTROL]
  6. make a backup of each existing destination file
  7. -b like --backup but does not accept an argument
  8. --copy-contents
  9. copy contents of special files when recursive
  10. -d same as --no-dereference --preserve=links
  11. -f, --force
  12. if an existing destination file cannot be opened, remove it and
  13. try again (this option is ignored when the -n option is also
  14. used)
  15. -i, --interactive
  16. prompt before overwrite (overrides a previous -n option)
  17. -H follow command-line symbolic links in SOURCE
  18. -l, --link
  19. hard link files instead of copying
  20. -L, --dereference
  21. always follow symbolic links in SOURCE

-n, —no-clobber
do not overwrite an existing file (overrides a previous -i option)

  1. --reflink[=WHEN]
  2. control clone/CoW copies. See below
  3. --remove-destination
  4. remove each existing destination file before attempting to open it (contrast with --force)
  5. --sparse=WHEN
  6. control creation of sparse files. See below
  7. --strip-trailing-slashes
  8. remove any trailing slashes from each SOURCE argument
  9. -s, --symbolic-link
  10. make symbolic links instead of copying
  11. -S, --suffix=SUFFIX
  12. override the usual backup suffix
  13. -t, --target-directory=DIRECTORY
  14. copy all SOURCE arguments into DIRECTORY
  15. -T, --no-target-directory
  16. treat DEST as a normal file
  17. -u, --update
  18. copy only when the SOURCE file is newer than the destination file or when the destination file is missing
  19. -v, --verbose
  20. explain what is being done
  21. -x, --one-file-system
  22. stay on this file system
  23. -Z set SELinux security context of destination file to default type

-R, -r, —recursive
复制文件夹时,同时复制子文件夹

—context[=CTX]
like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX

—help
帮助信息

-v —version
查看当前CP程序版本