Saturday, February 14, 2015

Get file permission chmod in Octal modes

In Mac
Syntax: stat -f "%A%N"

try
$ls -la

Output:
total 8
drwxr-xr-x+  6 sasi  staff   204 Feb 14 00:17 .
drwxr-xr-x+ 36 sasi  staff  1224 Feb 14 00:17 ..
drwxr-xr-x+  3 sasi  staff   102 Feb 14 00:17 css
drwxr-xr-x+  5 sasi  staff   170 Feb 14 00:17 img
-rw-r--r--+  1 sasi  staff  2303 Feb 14 00:17 index.html
drwxr-xr-x+  4 sasi  staff   136 Feb 14 00:17 js

then try:
$stat -f "%A %N" *   

Output:
755 css
755 img
644 index.html
755 js


Ubuntu, Cent os
stat -c %a

No comments:

Post a Comment

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...