Command ‘ls’ output numerical chmod permissions

it almost can …


ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));if(k)printf("%0o ",k);print}'

and

stat -c "%a %n" *

Also, you can use any filename or directory name instead of * to get a specific result.

On Mac, you can use


stat -f '%A %N' *

ref: https://stackoverflow.com/questions/1795976/can-the-unix-list-command-ls-output-numerical-chmod-permissions