UNIX File Types

The two most common file types are regular files and directories. Regular files are by far the most common type of files in a UNIX system, with program source, documents, executable programs, and scripts all being stored as regular files. One could argue that executable files are a special type of regular file but their handling by the filesystem is just the same, that is, the file contains a stream of bytes that the filesystem never needs to interpret.

Directories are different however. Although they also contain a stream of bytes, filesystems interpret these bytes in a manner that allows users to see which files are present in the directory and how they are linked together from a hierarchical perspective.

There are other file types which must be considered by programmers and administrators. They are outlined here and described in more detail throughout the chapter:

Regular files. As mentioned above, regular files hold data that is not interpreted by the filesystem, such as program source and binaries, documents and scripts.

Directories. Directories are used to provide structure within a filesystem. Directories can index files of any type including other directories.

Symbolic links. A symbolic link, also called a symlink, is a means by which one file can refer to another file through use of a different name. Symbolic links can cross filesystem boundaries. Removing a symbolic link has no impact on the file it references.

Hard links. Whereas a symbolic name is simply ...

Get UNIX Filesystems: Evolution, Design, and Implementation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.