Home >Operation and Maintenance >Linux Operation and Maintenance >What does cp -l mean in linux
In Linux, "cp -l" means to generate a link file; the cp command is used to copy files or directories. When the parameter is set to "-l", it means not to copy the file, but to generate a link file. , the syntax is "cp -l source dest" or "cp -l source... directory".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
The Linux cp (full English spelling: copy file) 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 links and 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 an 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.
Examples are as follows;
Create a hard link to a file (instead of copying)
Create a hard link to a file through the cp command, and Instead of copying, pass the following command.
[root@sharplee sharplee]# cp -l hello.txt test4/
Recommended learning: Linux video tutorial
The above is the detailed content of What does cp -l mean in linux. For more information, please follow other related articles on the PHP Chinese website!