What does cp mean in linux?

青灯夜游
Release: 2019-06-04 15:32:59
Original
20846 people have browsed it

cp means copy, which is a copy command in Linux, mainly used to copy files or directories. The cp copy command is very practical in Linux. It can copy a file (directory) under a specified path to (into) another file or directory. The following article will introduce you to the cp copy command of Linux. I hope it will be helpful to you.

What does cp mean in linux?

linux cp command

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

Basic syntax:

cp [options] 源文件 目标文件(夹)
Copy after login

Parameter [options] description:

● -a: This option is usually used when copying the directory When used, it preserves links, file attributes, and copies everything under the directory. Its effect is equal to the dpR parameter combination.

● -d: Keep the link when copying. The links mentioned here are equivalent to shortcuts in Windows systems.

● -f: Overwrite the existing target file without giving a prompt.

● -i: Contrary to the -f option, a prompt is given before overwriting the target file, asking the user to confirm whether to overwrite. The target file will be overwritten when answering "y".

● -p: In addition to copying the contents of the file, the modification time and access permissions are also copied to the new file.

● -r: If the given source file is a directory file, all subdirectories and files in the directory will be copied.

● -l: Do not copy files, just generate link files.

Example:

Use the command "cp" to copy all the files in the current directory "test/" to the new directory "newtest", enter the following Command:

cp –r test/ newtest
Copy after login

Note: When using the cp command to copy a folder, you must add the "-r" parameter, otherwise the "cp: omitting directory" error will occur.

The above is the detailed content of What does cp mean in linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template