commands

stat — inspect file metadata

GNU stat reports file metadata; -L follows symlinks. %F denotes kind, %s size in bytes, %i inode, %d device ID, and %h hard-link count. ctime is status-change time, not creation time. Examples assume a fresh chapter files lab.

Formal Syntax & Structure

linux syntaxlinux
stat [OPTION]... FILE...

Parameters & Attributes

NameTypeDescription
-c FORMAToptionSelect output fields
-LoptionReport the resolved target
FILEoperandPath to inspect

Return Value

text and exit status

GNU stat prints requested metadata and returns 0 on success, nonzero on error. With multiple operands, some metadata may be printed before an error; verify which paths were reported.

Working Example

Example Snippetlinux
stat -c '%F %s' notes/hello.txt
Linux Reference