UNIX invented it, BSD and Linux gave it to the world
Everything is a file
is very successful paradigm
in the UNIX/Linux communities which has allowed the kernel to simplify and uniformize how it uses devices which are exposed to the user as files. All files are treated as a bag of bytes. Reading/writing from a file is straightforward.
Besides actual data storage a lof ot fruitful exaptation
has been derived from this paradigm and from the UNIX/Linux file system conventions:
- Files, folders, symlinks, hardlinks, named pipes (fifo), network pipes, devices
- Applications which handle readable files and can work together well (ex.: lines separated with
\n
, columns separated with\t
): less/more, tail, head, sort, split, join, fold, par, grep, awk, colum, wc, sed, tee - Configuration management
- Application storage
- Library registry
- Disk cloning
- Disk images for backup (
dd
) - Smaller than disk size images (skip unused space)
- Compress disk images on the fly without storing the uncompressed version (
dd | gz
) - Restoring disk images from backups
- Disk recovery — HDDs, CDs, DVDs, USB sticks etc. — when they have bad sectors or scratches
- Creating bootable USB sticks from a raw image file or an ISO (
dd
again)
- Disk images for backup (
- Virtual filesystems
- Mounting a raw image file or ISO as a filesystem
- Mounting archives and compressed archives as a filesystem (tar, gz, bz, zip, rar)
- Network filesystems look just like normal folders SAMBA, NFS
- Using various network protocols as filesystems: HTTP, FTP, SSH
- Searching everywhere (
find
,grep
,sed
)
Plan9 from Bell Labs made it better
Current UNIX/Linux distros don’t implement this paradigm fully — ex.: network devices aren’t files — but some less known systems do (such as UNIX successor plan9
/ inferno
and their Linux correspondent glendix).
The plan9
project went onward in applying the paradigm for:
- Processes
- Process management
- Inter process communication
- Client-Server network communication
- Network related issues:
- Network interfaces are files
- Access rights to network interfaces is based on filesystem access rights to symlinks pointing to interface files
- The filesystem (
9P
) extends over the network as a network communication protocol
- Graphics interfaces and mouse IO
Other innovations it brought us (which got implemented in UNIX/Linux):
- UTF-8 / Unicode
- Filesystem snapshotting
- Union filesystems
- Lightweight threads