STAT(1)

NAME

stat - chapter 1 interface to chapter 2 system call

SYNOPSIS

stat [ options ] file(s)

DESCRIPTION

stat prints some or all of a file's "meta information"--size, modification time, permissions, owner, etc. This is the information that, on Unix systems, anyway, is kept in the ``inode'' and fetched using the stat(2) system call. In short, this program is simply a command-line-callable interface to that system call.

By default, stat prints all available information for the one or more filenames specified. The options permit selection of only certain information to be printed, or in various formats.

Under Unix, the special filename argument ``-'' indicates stdin, which is stat'ed using fstat(2).

On systems which support symbolic links, stat prints information about the linked-to file, not the link. (That is, it uses the stat(2) system call by default, as its name suggests, not lstat(2).) Information about the link itself may be obtained by (a) using the -l option, or (b) creating a second link to the stat command itself, named lstat, and invoking that. (For completeness, and to mimic ls(1), the -L option effectively turns lstat back into stat.)

If any of the options below are used to select particular fields, only the selected fields are printed. If no particular fields are selected, all fields are printed.

OPTIONS

-a,-atime
Print the last-accessed time (st_atime).
-blksize
Print the underlying block size (st_blksize).
-blocks
Print the number of storage blocks used (st_blocks).
-c,-ctime
Print the inode changed time (st_ctime).
-d,-dev
Print the underlying device (st_dev).
-f str
Overriding other output-specifying options, print one line of output for each file, driven by the string str, which contains % signs and other text. The % signs introduce 2-character sequences which interpolate stat values in with the surrounding text. (This is obviously modeled after C library functions such as printf and strftime.) The available % sequences are: (Note that the % characters largely match the other single-character command line flags.)
-g,-gid
Print the owning GID (st_gid).
-?,-h,-help
Print a brief help message.
-i,-ino
Print the inode number (st_ino).
-l
If a file is a symbolic link, print information about the link, not the linked-to file. (That is, use lstat(2) rather than stat(2). This is the default if this program is invoked via its own link named lstat.)
-L
If a file is a symbolic link, print information about the linked-to file, not the link. (That is, use stat(2) rather than lstat(2). This is the default if this program is named stat.)
-m,-mtime
Print the modification time (st_mtime).
-n,-nlink
Print the number of links (st_nlink).
-p,-mode
Print file permission modes (st_mode).
-q
Semi-quiet mode: don't print times as ctime(3) strings, UID's and GID's as names, or file permissions as ls-style.
-qq
Very quiet mode: don't print any extraneous verbage; print raw values only. (Most useful when only one or two values are selected.)
-r,-rdev
For device files, print the referenced device (st_rdev).
-s,-size
Print the size in bytes (st_size).
-u,-uid
Print the owning UID (st_uid).
-version
Print version number information (of the stat program itself, not of any file).

SEE ALSO

stat(2), fstat(2), lstat(2)

See http://www.eskimo.com/~scs/src/#stat for possible updates.

AUTHOR

Steve Summit, scs@eskimo.com