# info > stat

---
type: CommandReference
command: stat
mode: info
section: ""
source: info
---

## Quick Reference

- `stat file` — display all information about file
- `stat -f file` — display file system information
- `stat -L file` — dereference symbolic links
- `stat -c "%s %n" file` — custom format (size and name)
- `stat --printf="%s\n" file` — custom format with escape sequences
- `stat -t file` — terse output, suitable for parsing
- `stat -c "%a %A" file` — permissions in octal and symbolic forms
- `stat -c "%Y" file` — last modification time as seconds since Epoch

## Name

`stat` — Report file or file system status

## Synopsis

`stat [OPTION]... [FILE]...`

## Options

- `-L, --dereference` — act on the file referenced by each symbolic link argument (without it, act on the link itself)
- `-f, --file-system` — report information about the file systems where the files are located (implies `-L`)
- `--cached=MODE` — control attribute caching (if supported by system). MODE: `always` (use cached), `never` (sync with latest), `default` (leave to file system)
- `-c, --format=FORMAT` — use FORMAT for output (newline-terminated automatically). See format directives below.
- `--printf=FORMAT` — like `--format` but interpret backslash escapes and do not output a mandatory trailing newline
- `-t, --terse` — print information in terse form, suitable for parsing by other programs

**Format directives for files** (use with `--format` or `--printf`):

- `%a` — permission bits in octal (use `#` and `0` printf flags for padding)
- `%A` — permission bits in symbolic form (like `ls -ld`)
- `%b` — number of blocks allocated
- `%B` — size in bytes of each block reported by `%b`
- `%C` — SELinux security context (if available)
- `%d` — device number in decimal
- `%D` — device number in hex
- `%f` — raw mode in hex
- `%F` — file type
- `%g` — group ID of owner
- `%G` — group name of owner
- `%h` — number of hard links
- `%i` — inode number
- `%m` — mount point
- `%n` — file name
- `%N` — quoted file name with dereference if symbolic link
- `%o` — optimal I/O transfer size hint
- `%s` — total size in bytes
- `%t` — major device type in hex (character/block special files)
- `%T` — minor device type in hex
- `%u` — user ID of owner
- `%U` — user name of owner
- `%w` — time of file birth (or `-` if unknown)
- `%W` — time of file birth as seconds since Epoch (or `0`)
- `%x` — time of last access
- `%X` — time of last access as seconds since Epoch
- `%y` — time of last data modification
- `%Y` — time of last data modification as seconds since Epoch
- `%z` — time of last status change
- `%Z` — time of last status change as seconds since Epoch

**Format directives for file systems** (use with `-f`):

- `%a` — free blocks available to non-super-user
- `%b` — total data blocks in file system
- `%c` — total file nodes in file system
- `%d` — free file nodes in file system
- `%f` — free blocks in file system
- `%i` — file system ID in hex
- `%l` — maximum length of file names
- `%n` — file name
- `%s` — block size (for faster transfers)
- `%S` — fundamental block size (for block counts)
- `%t` — type in hex
- `%T` — type in human readable form

**Timestamp precision**: `%W`, `%X`, `%Y`, `%Z` accept a period and precision (e.g., `%.3X` for milliseconds). If only a period is given, 9 digits are used.

**Quoting style for `%N`**: Controlled by `QUOTING_STYLE` environment variable. Styles: `literal`, `shell`, `shell-always`, `shell-escape`, `shell-escape-always`, `c`, `escape`, `clocale`, `locale`. Default is `shell-escape-always`.

## Examples

shell
# Basic file information
stat /usr

# File system information
stat -f /usr

# Custom format: size and filename
stat --format="%s %n" /usr /var

# Using --printf for newline control
stat --printf='%d:%i\n' / /usr

# Zero padding with %a
stat -c '[%015Y]' /usr

# Precision with timestamps
stat -c '[%.3Y]' /usr
## See Also

- [stat(2)](http://man7.org/linux/man-pages/man2/stat.2.html) — kernel system call
- `df` — report file system disk space usage
- [coreutils info](https://www.gnu.org/software/coreutils/manual/) — full documentation

## Exit Codes

- `0` — success
- Non-zero — failure