Return the octal file permission value for a file or directory
stat -c "%a %n" *Replace
*
with the relevant directory or the exact filename that you want to examine.From the man page of stat,
-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
Usage:
- With files:
$ stat -c "%a %n" ./Documents/Udev.html 664 ./Documents/Udev.html
- With folders:
$ stat -c "%a %n" ./Documents/ 755 ./Documents/
Comments
Post a Comment