cp命令

cp命令
=============================


cp命令用来将一个或多个源文件或者目录复制到指定的目的文件或目录。

用法:

cp [OPTION]... [-T] SOURCE DEST

常用参数:
-i prompt before overwrite(覆盖前提示) -i是安全选项,如遇到一个已知的文件,就会询问是否覆盖。
我们常使用的cp命令就是cp -i .如不想询问是否覆盖,可以使用/usr/bin/cp或者\cp .
[root@aminglinux ~]# which cp
alias cp='cp -i'
/usr/bin/cp

-r copy directories recursively(递归复制目录). cp如果要复制目录,就要使用-r参数

-v explain what is being done(解释正在做什么) 详细显示命令执行的操作

示例:
[root@aminglinux ~]# touch 1.txt
[root@aminglinux ~]# mkdir dir1

[root@aminglinux ~]# cp -v 1.txt /tmp/
'1.txt' -> '/tmp/1.txt'
[root@aminglinux ~]# cp -v 1.txt /tmp/
cp: overwrite '/tmp/1.txt'? y
'1.txt' -> '/tmp/1.txt'
[root@aminglinux ~]# /usr/bin/cp -v 1.txt /tmp/
'1.txt' -> '/tmp/1.txt'
[root@aminglinux ~]# \cp -v 1.txt /tmp/
'1.txt' -> '/tmp/1.txt'

[root@aminglinux ~]# cp -v dir1 /tmp/
cp: omitting directory 'dir1'
[root@aminglinux ~]# cp -rv dir1 /tmp/
'dir1' -> '/tmp/dir1'

转载于:https://www.cnblogs.com/sambo510/p/9195520.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值