<programming, operating system>

The Unix system call to get the properties of a file or directory.

stat is called like this:

 struct stat s;
 if (stat("/path/to/file", &s)) { /* handle error */ }

This will fill the struct with the following data: id of device containing file, inode number, permissions (mode), number of hard links, user id of owner, group id of owner, device id (if special file), total size in bytes, block size for file system I/O, number of 512B blocks allocated, time of last access, time of last modification, time of last status change.

If stat is called on a symbolic link, it returns the properties of the link's target. Variant lstat returns the properties of the link itself.

Variant fstat takes a file descriptor instead of a path.

Unix manual page: stat(2).

Last updated: 2018-09-04

Nearby terms:

Start Of HeaderStart Of Textstart tagstatstatestate diagramstateless

Try this search on Wikipedia, OneLook, Google