View Permission all file in directory with Number

This can be used to list all directory files with their permissions:


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}'

ref: https://askubuntu.com/questions/152001/how-can-i-get-octal-file-permissions-from-command-line