Pat Gunn (dachte) wrote,
Pat Gunn

  • Location:
  • Music:

Unix Without Files

Inspired by a conversation on IRC, more of a brain dump than a coherent essay:

There's a distinction between "everything is a file" and "everything is a stream of bytes", even as they both are part of the design philosophy of Unix. Could we have a Unixlike experience without a local filesystem? To understand this, focus on command invocations that don't explicitly reference filenames and what they can do. We might joke that this is taking commands like bzcat/zcat to their logical extreme :) We can ignore implicit reference to filenames because we can imagine a shell that would have all our commands as inernals, properly handling pipes between these commands by spawning multiple copies of itself or through some other, more alien means, without any true external commands. I have some scripts I regularly use in my unix environment that talk to a local PostgreSQL database and extract data, either statically or based on arguments I provide. In the past I've also had this for some remote database connections, as well as things that reformat the output of things like netstat for me. With some of this data, I process it further before looking at it, e.g. through sort/cut/grep, through pipes, usually landing in either less or in "vim -". I could chain this through another pipe to something that would go through the details of stashing it back into a database (either as a BLOB or in a formatted way by parsing it) or some other storage system. I don't think it feels particularly un-unixy to imagine the following:

$ dbls -db docs -category books -author "Pier%" -created _gt_ "3 Dec 2005" -return id,name
6778 | Phaze Doubt
6779 | Blue Adept
6885 | Unicorn Point
$ `$LASTCMD` | dbcut -f1 | dbgrep -i -db docs -field data "Nyssa" -return data | docfilter -out pdf | evince

Of course, there may be all sorts of better syntaxes with varying power. The main point is that I think the Unix flavour and much of the power of Unix is more strongly tied to the idea of pipelines and the "bag of bytes" mentality than to everything living in files.


  • Revising Dreams

    Dream:I was in some strange kind of situation where I had just managed to escape some kind of captors in a large school, but didn't feel safe to…

  • Visiting a Dream Element

    Just had an extended conversation in a dream.. I may have written about this before here. If so, this is an elaboration. One of the things that was…

  • Half-written dreams

    Last night I had a strange dream that was operating from the certainty that I was going to have a baby (not physically), but didn't actually provide…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded