Home > Operation and Maintenance > Linux Operation and Maintenance > What is the meaning of Linux cp command parameters

What is the meaning of Linux cp command parameters

WBOY
Release: 2023-05-18 10:19:18
forward
1553 people have browsed it

cp (Copy files or directories)

[root@linux ~]# cp [-adfilprsu] 来源档(source) 目的檔(destination)
[root@linux ~]# cp [options] source1 source2 source3 …. directory
Copy after login

Parameters:
-a: Equivalent to -pdr;
-d: If the source file is the attribute of the link file ( link file), copy the link file attributes rather than the file itself;
-f: means force. If there are duplications or other questions, the user will not be asked and the copy will be forced;
- i: If the destination file (destination) already exists, it will first ask whether it is really an action when overwriting!
-l: Create a hard link link file instead of copying the file itself;
-p: Copy the file together with its attributes instead of using the default attributes;
-r : Recursive continuous copy, used for directory copy behavior;
-s: Copy into a symbolic link file (symbolic link), that is, a "shortcut" file;

-u: If the destination is older than the source Just updated the destination!
Finally, it should be noted that if there are more than two source files, the last destination file must be a "directory"!

Do not prompt for overwrite information?

\cp -r -f source target
Copy after login

The cp command will not prompt overwrite? by default, but the -i option of cp will prompt it, and the general Linux startup file~/ The .bashrc will name cp as

alias cp='cp -i'
Copy after login

. In this way, entering the cp command under Linux actually runs cp -i. Adding a "\" symbol means that the cp command will not be used this time. Run as alias (cp -i).

The above is the detailed content of What is the meaning of Linux cp command parameters. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
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