Home  >  Article  >  Operation and Maintenance  >  What does cp mean in linux system?

What does cp mean in linux system?

藏色散人
藏色散人Original
2019-05-18 11:26:1336163browse

cp in the Linux system means copying. Its usage syntax is such as "[root@linux tmp]# cp -r /etc/ /tmp", which means to copy all the contents in the "/etc/" directory. Copy to "/tmp".

What does cp mean in linux system?

The meaning of cp in linux system

In Linux, the full name of cp is "copy ”, which means “copy” in Chinese.

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

Example of using cp:

(1) Copy all contents in the /etc/ directory to /tmp.

If it is a directory, it cannot be copied directly. You must add the -r parameter

[root@linux tmp]# cp -r /etc/ /tmp

(2) Copy /var/log/wtmp to /tmp.

[root@linux tmp]# cp /var/log/wtmp .

If you want to copy to the current directory, don’t forget the last one.

(3) Copy the .bashrc in the home directory to /tmp and rename it to bashrc

(4)

[root@linux ~]# cd /tmp
[root@linux tmp]# cp ~/.bashrc bashrc
[root@linux tmp]# cp -i ~/.bashrc bashrc
cp: overwrite `basrhc'? n
# 重复做两次动作,由于/tmp下面已经存在bashrc了,加上 -i参数,
# 在覆盖前会让用户确认。可以按下n或者y。
# 但是,反过来说,如果不想询问,则加上 -f参数来强制直接覆盖。

The above is the detailed content of What does cp mean in linux system?. 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