Quick Tip
Quick File Permissions & Ownership with `stat`
Challenge: You need to quickly check the ownership and permissions of a file or directory without a lengthy command.
The Solution: Use the `stat` command with the `-c` (or `–format`) option to specify the output format.
stat -c "%U:%G %a %n" your_file_or_directory
Why it works: The `-c` flag allows you to define a custom output format. `%U` displays the owner’s username, `%G` displays the group name, `%a` shows the octal permissions, and `%n` displays the filename.
Pro-Tip: Use `stat -c “%a”` to see only the octal permissions, or `stat -c “%U”` for just the owner’s username.
Linux Tips & Tricks | © ngelinux.com | 5/19/2026
