chmod - change the mode of each file to mode

chmod
Change the mode of each FILE to MODE.
chmod [option]... MODE[,MODE]... FILE...
chmod [option]... OCTAL-MODE file...
chmod [option]... --reference=RFILE file


-c, --changes like verbose但只在改变成功后
-f, --silent, --quiet 忽略出错信息
-v, --verbose 输出详细信息
--reference=RFILE 应用REILE's模式
-R, --recursive 递推修改文件和文件夹的模式
--help
--version


u: user o: other g: group a: all
+-=
w: write r:read x:execute




文件模式
两个字节表示文件的模式,说明文件的类型和访问权限。低12设置访问权限,最高4位表示文件的类型。
八进制最低3位说明了文件的访问权限,
2             1             0
读权限(4)     写权限(2)     执行权限(1)


15 14 13 12    11        10        9        8 7 6        5 4 3        2 1 0
文件类型     设置UID 设置GID   粘附位   user         group        other


0001 FIFO文件
0010 字符设备文件
0100 目录文件
0110 块设备文件
1000 普通文件
1010 符号链接文件
1100 套接口文件
BASH_BUILTINS(1)
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod. If mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no mode argument was supplied, and false otherwise.


umask指定创建文件时的默认权限的掩码。其默认值是0022,此时建立的文件默认权限是644(6-0,6-2,6-2),建立的目录的默认权限是755(7-0,7-2,7-2)。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值