Home >Operation and Maintenance >CentOS >How to copy files under centos

How to copy files under centos

王林
王林Original
2020-05-17 10:03:2910901browse

How to copy files under centos

We can use the cp command to copy files. The syntax format is:

cp [-adfilprsu] 源文件(source) 目标文件(destination)
cp [option] source1 source2 source3 ... directory

Parameter description:

-a: means archive, It also means copying all directories

-d: If the source file is a link file, copy the link file attributes instead of the file itself

-f: force , if there are duplications or other questions, the user will not be asked, but forced to copy

-i: If the destination file (destination) already exists, it will first ask whether the operation is real when overwriting

-l: Create a hard link connection file instead of copying the file itself

-p: Copy together with the file's attributes instead of using the default attributes

-r: Recursive copy, used for directory copy operation

-s: Copy into a symbolic link file (symbolic link), that is, a "shortcut" file

-u: If the target file is older than the source file , update the target file

Example:

For example, to copy file1 in the /test1 directory to the /test3 directory and change the file name to file2, enter the following command:

cp /test1/file1 /test3/file2

Recommended tutorial: centos tutorial

The above is the detailed content of How to copy files under centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn