Getting Information About Files

This lesson discusses the utility to get information about files.

Beyond file access, we expect the file system to keep a fair amount of information about each file it is storing. We generally call such data about files metadata. To see the metadata for a certain file, we can use the stat() or fstat() system calls. These calls take a pathname (or file descriptor) to a file and fill in a stat structure as seen in the code snippet below.

Get hands-on with 1200+ tech skills courses.