Linux - chown 中的 -R 参数

出处:http://blog.chinaunix.net/uid-298599-id-2443098.html

1. 查看目录及当前文件


[root@localhost yuechaotian]# pwd
/home/yuechaotian
[root@localhost yuechaotian]# ll
总用量 8
drwxr-xr-x  3 root root 4096 12月  7 14:52 study
drwxr-xr-x  2 root root 4096 12月  9 21:43 test
[root@localhost yuechaotian]# ll test
总用量 12
-rwxr-xr-x  1 root root 11742 12月  9 21:43 conf.rd

2. 只改变目录test的用户及群组,并未改变目录test下的文件用户及群组

[root@localhost yuechaotian]# chown yuechaotian:dba test
[root@localhost yuechaotian]# ll
总用量 8
drwxr-xr-x  3 root        root 4096 12月  7 14:52 study
drwxr-xr-x  2 yuechaotian dba  4096 12月  9 21:43 test
[root@localhost yuechaotian]# ll test
总用量 12
-rwxr-xr-x  1 root root 11742 12月  9 21:43 conf.rd

3. 使用参数 -R,改变目录 test 及其文件用户和群组

[root@localhost yuechaotian]# chown root:root test
[root@localhost yuechaotian]# ll
总用量 8
drwxr-xr-x  3 root root 4096 12月  7 14:52 study
drwxr-xr-x  2 root root 4096 12月  9 21:43 test
[root@localhost yuechaotian]# chown -R yuechaotian:dba test
[root@localhost yuechaotian]# ll
总用量 8
drwxr-xr-x  3 root        root 4096 12月  7 14:52 study
drwxr-xr-x  2 yuechaotian dba  4096 12月  9 21:43 test
[root@localhost yuechaotian]# ll test
总用量 12
-rwxr-xr-x  1 yuechaotian dba 11742 12月  9 21:43 conf.rd

在 chmod 中使用 -R 参数,能达到同样的效果:该文件夹内的所有文件/文件夹都改为指定的权限.
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值