Name
stat
Synopsis
stat [options] files
Print out the contents of an inode as they appear to the stat system call in a human-readable format. The error messages “Can’t stat file” and “Can’t lstat file” usually mean the file doesn’t exist. “Can’t readlink file” generally indicates that something is wrong with a symbolic link.
Options
- -c format
Display the output as specified by format.
- -f
Display information about the filesystem where the file is located, not about the file itself.
- -l
For links, display information about the files found by following the links.
- -s
For SE (Security Enhanced) Linux, show security information, if it’s available, in addition to stat’s normal output.
- -t
Print the output tersely, in a form suitable for parsing by other programs.
- -v
Print version information and exit.
Output
stat and stat -l display the following:
Device number
Inode number
Access rights
Number of hard links
Owner’s user ID and name, if available
Owner’s group ID and name, if available
Device type for inode device
Total size, in bytes
Number of blocks allocated
I/O blocksize
Last access time
Last modification time
Last change time
Security context for SE Linux
If -f is specified, stat displays the following information about the filesystem:
Filesystem type
Filesystem blocksize
Total blocks in the filesystem
Number of free blocks
Number of free blocks for nonroot users
Total number of inodes
Number of free inodes
Maximum filename length
Format
The printf(3) flag characters #, 0, -, +, and space can be used in format ...
Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.