Home>Article>Operation and Maintenance> What does cp mean in linux system?
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".
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!