A defining feature of Unix is that “everything is a file,” which is a powerful concept with far-reaching effects. According to Simson Garfinkel in a recent ;login: article:
Modern UNIX and Linux owes much of its flexibility to the way that the operating system handles files and file systems. While other operating systems maintain a different namespace for every physical device, UNIX puts everything into a single hierarchy, a single unified naming system for all files currently accessible.
An advantage of this approach, he says, “manifests when programs running on UNIX get a “file” to open and, lo, it’s actually the name of a device. Most UNIX programs will still work, provided that the calling process has the correct authorization to open the file.”
In the article, titled “Everything is a Punch Card,” Garfinkel examines the origins of files and file systems, as well as the related history of punch cards and tabulating machines. He notes that “English has had a difficult relationship with the word “file” since the beginning. Sometimes the word refers to the case or container for organizing physical embodiments of information, sometimes it refers to the objects put into that container, and sometimes it refers to the information itself.”
Garfinkel also looks at one thing that is not a file: memory. “Yes,” he says, “Linux systems have devices like /dev/mem and /dev/kmem that let programs access memory through the file system, but memory is not file.” He compares the UNIX approach with that of the Multics operating system, “in which files are actually named segments in a two-dimensional memory address space.” On Multics, he says, “saving a “file” was really creating a named memory segment and then persisting it to long-term storage.”
Read the complete article at ;login: