[UFO Chicago] very newbie 'nix question

Elliot Shank clonezne@galumph.com
26 Jan 2002 16:41:30 -0600


On Sat, 2002-01-26 at 16:09, Sean Neakums wrote:
> begin  Elliot Shank quotation:
> 
> > On Sat, 2002-01-26 at 15:29, Nick Moffitt wrote:
> >> 	Oh, that's easy!  On Unix/GNU/BSD/Linux/any POSIX system,
> >> directories *are* files!
> >
> > Ummm... errmm... while you are quoting ye old platitude about the
> > "nature" of directories in *NIX filesystems, you are vastly
> > incorrect in the realm of older *NIX systems.
> 
> It's not a platitude, it's the truth.  Directories (since they existed
> as we now know them) have always been files.

But the point is that they're not treated the same.  One of the problems
with the phrase "everything is a file" is it necessitates the
distinguishing "regular" to be placed in front of the term "file" when
one is trying to indicate what most people call a "file".

Analogously, despite the presence of filesystem entries called
"/dev/sdd1" and "/dev/lp0", I would not call the things referred to by
those entries as "files".

Try explaining "everything is a file" to your grandmother.  Yes, the API
consistency is nice and one of the biggest advantages of *NIX, but
neither a device, pipe, socket, nor a directory is a file.  The
implementation of a directory may be via a convenient reuse of the
"regular file" storage mechanism, but it is not a file as your average
human being would term it.  Hell, it used to be that you could easily
look at the storage for a directory (the file names and the binary
representations of the inode numbers), but now when you try to "cat ."
you get "cat: .: Is a directory".