Site icon New Generation Enterprise Linux

Quick File Ownership & Permissions with `stat`

Quick Tip

Quick File Ownership & Permissions with `stat`

Challenge: You need to quickly check the ownership and permissions of a file without resorting to a long `ls -l` output.

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

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

Why it works: The `-c` (or `–format`) option allows you to specify exactly what information you want `stat` to display. `%U` is the owner’s username, `%G` is the group’s name, `%a` is the file’s permissions in octal, and `%n` is the file’s name.

Pro-Tip: For just the permissions in a human-readable format (e.g., -rw-r–r–), use stat -c "%A %n" your_file_or_directory.

Linux Tips & Tricks | © ngelinux.com | 5/16/2026

0 0 votes
Article Rating
Exit mobile version