Home > Operation and Maintenance > Linux Operation and Maintenance > What is the usage of cp command under linux?

What is the usage of cp command under linux?

WBOY
Release: 2021-12-29 17:11:25
Original
29904 people have browsed it

In Linux, cp is the abbreviation of "copy file". The cp command is used to copy the specified file or directory. If the target file already exists or contains a file with the same name, the original file or directory in the target file will be copied. The file will be overwritten, and the syntax is "cp source file destination directory" or "cp source file 1 source file 2 destination directory".

What is the usage of cp command under linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the usage of cp command under Linux

Linux cp (English full spelling: copy file) command is mainly used to copy files or directories .

Copy a source file to the target file (folder).

The command format is: cp source file target file (folder)

This is the most frequently used command, responsible for copying a source file to the target file (folder). As shown in the figure below, when copied to a folder, the file name remains unchanged; when copied to a file, the file name changes. If the target file already exists or the target folder contains a file with the same name, the target file or the file with the same name in the target folder will be overwritten after copying.

What is the usage of cp command under linux?

Copy multiple files to the target file (folder) at the same time.

The command format is: cp source file 1 source file 2 target folder or cp file * target folder

This command is also used frequently. The first command format can copy multiple listed files to the target folder at once, with each file directly separated by spaces; the second command format uses the wildcard *, as shown in the figure below, to copy all files starting with " .txt" are copied to the folder testDir.

What is the usage of cp command under linux?

What is the usage of cp command under linux?

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What is the usage of cp command under 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