“Everything is a file” is what made me start understanding linux few years ago and from there it got easier to use with each new concept.
Still this was really revolutionary to me when I first heard it. Made a bunch of things just click.
“Everything is a file” is what made me start understanding linux few years ago and from there it got easier to use with each new concept.
Still this was really revolutionary to me when I first heard it. Made a bunch of things just click.
“Everything is a file” means that many of the system’s components are represented as abstractions in the filesystem. It’s simply an API that allows reading from and writing to it by integrating into the hierarchical file structure.
If you take a look inside
/sys, you will find a fuckton of files, but they don’t represent data stored on a mass storage medium. Instead, the directory contains a mountedsysfsfilesystem that contains file-like representations of various parts and properties of the system. For example, you can read them like a file by runningcat /sys/block/sda/queue/rotationalto check if thesdablock device is a spinning disk (1) or solid-state storage (0). Or you can write to them like a file by runningecho 1 > /sys/block/sda/devices/deleteto commandsda’s driver to detach the device. Similarly,/proccontains a mountedprocfsfilesystem that presents information about running processes as file-like entries;/devcontains a mounteddevfsthat points to various devices; and/tmpand/runcontaintmpfsmounts for temporary storage in volatile memory (RAM or swap).Windows uses various other APIs (like the Component Object Model and others) to accomplish the same that are not necessarily tied into the filesystem.
Exactly the same concept as memory-mapped hardware I/O, or virtual file system drivers. Makes it so you don’t have to think too much about implementation details and uses a common interface that’s already there.