Linux cp command details how to use the Linux cp command

Source: Internet
Author: User

The Linux cp command is mainly used to copy files or directories.

Syntax

Cp [options] source dest

Or

Cp [options] source... directory

Parameter description:

  • -A: This option is usually used when copying a directory. It retains the link and file attributes and copies all contents in the directory. The function is equal to the dpR parameter combination.
  • -D: The link is retained during replication. The link mentioned here is equivalent to a shortcut in Windows.
  • -F: overwrite the existing target file without prompting.
  • -I: in contrast to the-f option, a prompt is displayed before overwriting the target file, asking the user to confirm whether to overwrite the file. The target file will be overwritten when "y" is answered.
  • -P: in addition to copying the file content, it also copies the modification time and access permissions to the new file.
  • -R: if the source file is a directory file, all subdirectories and files under the directory will be copied.
  • -L: generate a link file without copying a file.

Instance

Run the command "cp" to copy all files under the current directory "test/" to the new directory "newtest". Run the following command:

$ Cp-r test/newtest

Note: When you use this command to copy a directory, you must use the "-r" or "-R" parameter ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.