1、cp
cp -r:copy文件夹
cp -p:保留原权限
cp -a:保留文件/目录/权限,万能选项
cp abc.txt def.txt fgh.txt backup:copy多个文件的时候,最后一个参数一定为目录。
[root@server130 16:59:31 ~/test]#echo "拷贝文件测试"
拷贝文件测试
[root@server130 16:59:31 ~/test]# umask
0022
[root@server130 16:59:40 ~/test]# ll
total 4
-rw-r--r--. 1 root root 98 Sep 16 16:56 111
[root@server130 16:59:43 ~/test]# chmod 7777 111
[root@server130 16:59:56 ~/test]# ll
total 4
-rwsrwsrwt. 1 root root 98 Sep 16 16:56 111
[root@server130 16:59:57 ~/test]# cp 111 222
[root@server130 17:00:08 ~/test]# ll #可见,cp不带参数copy之后,会丢失文件的特殊权限以及会依据umask减去相应的权限。
total 8
-rwsrwsrwt. 1 root root 98 Sep 16 16:56 1