Skip to content

Instantly share code, notes, and snippets.

@pkuczynski
Created February 12, 2014 16:18
Show Gist options
  • Save pkuczynski/8958800 to your computer and use it in GitHub Desktop.
Save pkuczynski/8958800 to your computer and use it in GitHub Desktop.
List files with their numerical chmod permissions
#
# Add following code to your ~/.bash_profile, and then you can list files using command:
# lsmod /path/to/file
#
lsmod() {
ls -l $1 | 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