The only thing it doesn't do as of now is following symbolic links.
File information for /usr/usersb2/w93/fp/c/stat.c Filesystem ID : Major 00 Minor 08 File inode : 107446 File mode : FILE -rw-r--r-- Your rights : READ WRITE DELETE Number of Links : 1 User ID : 1341 (fp) Group ID : 1022 (w93) File Size : 7311 Last File access : Tue Dec 6 18:17:33 1994 ... modification : Fri Dec 2 15:07:57 1994 File creation : Wed Dec 14 10:02:23 1994
The first line tells you the unique identifier of the filesystem the file
is on. Together with the second line, the file's inode, it uniquely
identifies each file on a system. The third line mentions that you're
dealing with a plain file, and prints the file's mode. The program also
evaluates your own user and group IDs and tells you about your rights on
the file. Since I am the owner of my own file, I may read from it, write
to it and delete it.
The file has a link count of one, and therefore doesn't exist under another
name (when unlinking this file, the count becomes zero and so the file is
deleted), although symlinks to this file may exist. The next two lines show
the user and group IDs both numerically, and, if available, also as text.
The file size is 7311 bytes. The last three lines tell about the last access,
modification and creation dates and times.
BTW, what stat() does doesn't count as file access.
File information for /usr/usersb2/w93/olschew Filesystem ID : Major 00 Minor 08 File inode : 103392 File mode : DIRECTORY -rwxr-xr-x Your rights : LIST CHANGE TO User ID : 1541 (olschew) Group ID : 1022 (w93)Here, I've stat'ed another user's home directory (I've cut the date information), and we see that we may indeed list the files in his directory and we may also change to it.
On the command line, it will accept one or more filenames, and it prints information for all these files. If a file is not stat()'able (usually because it doesn't exist or because the parent directory is unreadable), a message and the error code (errno) is printed.
Get the source file, stat.c (7kB)