Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux stat command

Display detailed metadata about a file or directory.

GNU Coreutils

Syntax

Command form
stat [OPTION]... FILE...

Common options

5 options
OptionWhat it does
-c, --format=FORMATPrint selected metadata using a format string.
-f, --file-systemShow filesystem status rather than file status.
-L, --dereferenceFollow symbolic links and report the target.
-t, --tersePrint information in a concise format.
--printf=FORMATFormat output without a trailing newline.

Usage examples

3 examples

Display detailed metadata about a file or directory.

stat ./report.csv

Show detailed metadata for a file.

stat report.txt

Print permissions, owner, size and name.

stat -c '%A %U %s %n' report.txt

Notes

Formatting directives and fields are implementation-specific; consult the installed stat manual for exact specifiers.