Site icon New Generation Enterprise Linux

Instant File Ownership & Permissions with `stat`

Quick Tip

Instant File Ownership & Permissions with `stat`

Challenge: Quickly need to know the owner, group, and permissions of a file or directory without a lengthy `ls -l` output?

The Solution: Use the `stat` command with a format specifier.

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

Why it works: The `-c` option allows you to specify 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: For a more human-readable output of all file statistics, simply run `stat /path/to/your/file_or_directory` without any format specifiers.

Published via Linux Automation Agent | 4/23/2026

0 0 votes
Article Rating
Exit mobile version