File Systems: The Interface

file attributes

Imagine the little info card stapled to the front of a library book: title, who owns it, when it was added, how thick it is, who is allowed to borrow it. A file has the same kind of card, kept by the operating system. These are the file's attributes, also called its metadata: facts ABOUT the file that are stored separately from the file's actual contents.

A typical set of attributes includes the name (the human-readable label), an identifier (a unique number the OS uses internally, since names can be reused), the type (whether it is text, an image, a program, and so on), the size (how many bytes), the location (a pointer to where the data blocks live), protection information (who may read, write, or run it), and several timestamps (when it was created, last modified, and last accessed). When you ask a file manager to sort by date or show a file's size, it is reading these attributes, not opening the file. The OS keeps them in a small fixed-size record so it can answer questions about a file cheaply, without scanning the bytes inside.

Why it matters: attributes are what let the system reason about files without reading them. A backup tool can skip a file whose modified-time has not changed; a search tool can filter by type; the permission bits decide whether you are even allowed to open it. A subtle point: the name is just one attribute, and in many systems it lives in the directory entry rather than in the file's own metadata record, which is exactly what makes a single file able to have several different names (hard links).

Running a long listing of one file might show: rwxr-xr-x, owner alice, group staff, size 2048 bytes, modified Jun 24 18:00, name report.pdf. Every field there is an attribute the OS stored; none of it required reading the PDF's contents.

Metadata lives apart from the data; you can read all of this without opening the file.

The name is usually NOT part of the file's own metadata record but of the directory entry that points at it. That separation is precisely why one file can carry several names at once.

Also called
file metadata檔案中繼資料