有一个chmod命令来设置文件许可权,但是我可以从命令行以八进制模式(例如755)获得文件许可权吗?
你可以试试
stat -c "%a %n" *
替换*
为相关目录或您要检查的确切文件名。
-c --format=FORMAT
use the specified FORMAT instead of the default; output a newline after
each use of FORMAT
%a Access rights in octal
%n File name
用法:
带有文件:
$ stat -c "%a %n" ./Documents/Udev.html
664 ./Documents/Udev.html
带文件夹:
$ stat -c "%a %n" ./Documents/
755 ./Documents/
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句