Skip to content

Instantly share code, notes, and snippets.

@eliotk
Created January 23, 2015 18:01
Show Gist options
  • Save eliotk/6ce8ff5a6a6ed6b45876 to your computer and use it in GitHub Desktop.
Save eliotk/6ce8ff5a6a6ed6b45876 to your computer and use it in GitHub Desktop.
List files and directories showing chmod numerical format. Add to ~/.bashrc or ~/.bash_profile or ~/.zshrc ...
alias cls="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