Sometimes it’s easier to use octal file permissions, but they’re not always easy to list. I’ve caught myself a few times forgetting how to do it, so I’m making a note for future reference.
To list files with their octal permissions, use the stat command with the -c flag to specify the format.
List octal file permissions
stat -c "%a %n" *
755 bin
755 games
755 include
It’s that easy. 😃
You can also include the human-readable attributes alongside the octal code.
List octal file permissions with human-readable attributes
stat -c '%A %a %n' *
drwxr-xr-x 755 bin
drwxr-xr-x 755 games
drwxr-xr-x 755 include
](https://gagor.pro/generic-cover.webp)