Site icon New Generation Enterprise Linux

Quick `stat` for File Ownership & Permissions

Quick Tip

Quick `stat` for File Ownership & Permissions

Challenge: You need to quickly check the owner, group, and permissions of a file or directory without a lengthy `ls -l` output.

The Solution: Use the `stat` command with specific format specifiers.

stat -c "%U:%G %a %n" /path/to/your/file

Why it works: The `-c` option allows you to specify a custom output format. `%U` shows the owner’s username, `%G` shows the group’s name, `%a` shows the octal permissions, and `%n` displays the filename.

Pro-Tip: For a more human-readable permission string (like `rwxr-xr-x`), use `%A` instead of `%a`.

Linux Tips & Tricks | © ngelinux.com | 4/26/2026

0 0 votes
Article Rating
Exit mobile version