Unmasking Hidden File Permissions with `stat`
Quick Tip
Unmasking Hidden File Permissions with `stat`
Challenge: You need a quick way to see the exact permissions of a file, including special bits like SUID, SGID, and the sticky bit, beyond the typical `ls -l` output.
The Solution: Use the `stat` command with the `%A` format specifier.
stat -c "%A %n" filename
Why it works: The `stat` command provides detailed file status information. The `-c “%A”` option specifically tells `stat` to output the file’s access rights in a human-readable form, including the leading character for file type and the special permission bits.
Pro-Tip: For an even more detailed, human-readable output of all file metadata, simply run `stat filename` without any format specifiers.
Linux Tips & Tricks | © ngelinux.com | 4/28/2026
