Site icon New Generation Enterprise Linux

Master `stat` for Instant File Ownership & Permissions

Quick Tip

Master `stat` for Instant File Ownership & Permissions

Challenge: Quickly need to know the owner, group, and precise permissions of a file or directory in a human-readable format, without sifting through `ls -l` output?

The Solution: Use the `stat` command with formatting options.

stat -c "%U:%G %a %n" your_file_or_directory

Why it works: The `-c` option allows custom formatting. `%U` displays the owner’s username, `%G` the group name, `%a` the octal permissions, and `%n` the filename. This provides a concise, at-a-glance view.

Pro-Tip: For just the octal permissions, use `stat -c “%a” your_file_or_directory`.

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

0 0 votes
Article Rating
Exit mobile version