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` command.

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

stat -c "%U:%G %A %n" 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` the group name, `%A` the access rights in human-readable form, and `%n` the filename. This provides exactly the information you need in a concise way.

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

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

0 0 votes
Article Rating
Exit mobile version