List octal file permissions in bash

Sometimes it’s easier to use octal file permissions but they’re not so easy to list. I caught myself few times that I didn’t remember how to list them – so this is a reason for that note.

$ stat -c "%a %n" *
755 bin
755 games
755 include

Yes, it’s that easy 🙂
And here also with human readable attributes:

$ stat -c '%A %a %n' *
drwxr-xr-x 755 bin
drwxr-xr-x 755 games
drwxr-xr-x 755 include

Leave a Reply

Your email address will not be published. Required fields are marked *