Skip to content

Instantly share code, notes, and snippets.

@lukaswhite
Created March 21, 2016 12:20
Show Gist options
  • Save lukaswhite/67e625d47b0a7f662238 to your computer and use it in GitHub Desktop.
Save lukaswhite/67e625d47b0a7f662238 to your computer and use it in GitHub Desktop.
Display numeric file permissions on 'Nix systems
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}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment