stat flags & options

Basic usage

Show detailed information about a file.

stat file.txt

-c, --format

Custom output format using format sequences.

stat -c '%s' file.txt
stat -c '%U:%G' file.txt

Common format sequences

Show file size in bytes.

stat -c '%s' file.txt

Show permissions in octal.

stat -c '%a' file.txt

Show owner and group.

stat -c '%U %G' file.txt

Show last modification time.

stat -c '%y' file.txt

-f, --file-system

Show filesystem info instead of file info.

stat -f /home

-L, --dereference

Follow symbolic links.

stat -L /usr/bin/python

-t, --terse

Print info in terse (machine-readable) format.

stat -t file.txt

Multiple files

stat -c '%n %s %a' *.log