Glossary

stat

stat shows the metadata the kernel keeps about a file: inode number, size, block usage, permissions, owner, group, and the three timestamps: access, modify, change.

stat file.txt                   # human-readable summary
stat -c '%n %s %y' *.log        # custom format: name, size, mtime
stat -f /                       # filesystem stats for the mount containing /
stat --printf '%s' file         # only the size

The underlying system call is stat(2); stat is the command-line wrapper. Format specifiers mirror the fields of struct stat, so the same mental model applies when reading C code that calls stat().

Related terms: ls, file, Inode

Discussed in:

This site is currently in Beta. Contact: Chris Paton

Textbook of AI · Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring

AI tools used: Claude (research, coding, text), ChatGPT (diagrams, images), Grammarly (editing).