Regular Files

Regular files are the most common type of file; they are used to store the entire operating system itself–such as the kernel, system binaries, libraries, configuration files, and user data. Along with directories, regular files represent the persistent state of the system that is preserved across reboots.

Regular files are essentially thin abstractions that emulate the interface provided by the venerable magnetic-tape drive, the standard mass-storage technology of the era during which UNIX was first developed. We are already familiar with the basic properties of regular files–a regular file is a unit of data storage which contains a sequence of bytes. The contents of a regular file are persistent–data written to a regular file can later be accessed as many times as desired, and only changes when explicitly overwritten. Additionally, regular files are seekable–the file offset may be positioned and repositioned to any location in a regular file to begin reading and writing at that location, and a regular file may be resized to any arbitrary length by writing additional data to the end or by repositioning the file offset past the current end of the file.