cp command: copy files and directories

cp [options] source file destination

  • -i interactive, if the target file already exists, it will ask whether to overwrite y / n
  • -r recursive folders for copy directory
    • cp  /home/janet/clients/*  /home/nick/customers
    • cp -r /home/nick/clients /home/nick/customers
  • After -p copy the target file to retain the source file's attributes (including the owner, owning group, permissions, and time), commonly used to perform a backup, when the log backup.
  • Copy multiple files to a folder
    • cp [options] test1.c test2.c test3.c ../test1/

Guess you like

Origin www.cnblogs.com/DerekDeng/p/11242310.html