Stat (system call)

stat command line

stat() is a Unix system call that queries the file system for metadata about a file (including special files such as directories). The metadata contains many fields including type, size, ownership, permissions and timestamps.

For example, the ls command uses this system call to retrieve timestamps:

  • mtime: when last modified (ls -l)
  • atime: when last accessed (ls -lu)
  • ctime: when last status changed (ls -lc)

stat() appeared in Version 1 Unix. It is among the few original Unix system calls to change, with Version 4's addition of group permissions and larger file size.[1]

Since at least 2004, the same-named shell command stat has been available for Linux to expose features of the system call via a command-line interface.[2]

  1. ^ McIlroy, M. D. (1987). A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986 (PDF) (Technical report). CSTR. Bell Labs. 139.
  2. ^ tee, file, stat, find- correction - linuxchix.org - Wed Mar 10 11:04:07 EST 2004 (archived on April 30, 2006)

© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search