colinrmitchell.com

Blog

Plan 9 from Bell Labs

Posted Sunday, July 13th 2014 in Other Tech - Permalink

plan9-screenshot

I recently remembered my time toying around with the experimental operating system Plan 9 from Bell Labs. This is a pretty immature operating system with respect to user tools, but it has some really neat ideas that would be nice to see in other operating systems and software. Some of the software from Plan 9 has been ported to other operating systems, commonly known as Plan 9 from User Space.

Anyways, I learned some old-school typesetting software while I was playing around with Plan 9. This software is troff. It’s not near as easy as LaTeX, but it does create some very nice looking documents. I created a short document listing my experiences here.

As an example, here is what the source looks like for the above file:

.de NP
'bp
'sp 1i
..
.wh -1i NP
.ll 6i
'bp
.ps 30
.ft B
.ce 1
Hello, Glenda!
'sp 0.25i
.ps 16
.ft R
.ce 1
My Introduction to \fIPlan 9 From Bell Labs\fR
'sp 0.125i
.ps 12
.ce 1
Colin Mitchell
'sp 0.4i
.ti 3
\fIPlan 9 From Bell Labs\fR is an experimental operating system, written, of course, at Bell Labs.  It is premised as being the successor to \s10UNIX\s12, and has been around for over 20 years.  It was first released only to universities for operating system study, but was released, in 2002, under a free software license.  I don't exactly recall how I first heard of \fIPlan 9\fR.  It was probably while I was googling "which operating system makes me look smartest?"  I think I may have finally found the operating system to satisfy my fixie-and-corncob-pipe hipster obscurity complex.
.ti 3
\fIPlan 9\fR has many similarities to \s10UNIX\s12, such as some terminal commands and file system naming conventions.  However, some aspects and paradigms are drastically different.  Most work is done in a program which is both a text editor, file-system browser, and command environment.  This program is called \fIacme\fR.  
.ti 3
This document is simply an excuse for me to actually use the \fIPlan 9\fR system, instead of just confusingly clicking around and getting nowhere.  This document has been prepared in \fIacme\fR.  The file is written in markup for and is processed by \fItroff\fR, an old-school \s10UNIX\s12 type-setter.  The typesetting markup is a bit tedious and clunky to learn, especially coming from something as simple and intuitive as LaTeX, but it does produce nice-looking documents.  Troff has some pre-processing packages available for it, such as \fIeqn\fR, which provides an easy-to-learn language to type-set mathematics, e.g.

.ce 1
.EQ
x = {-b \(+- sqrt{b sup 2 - 4 a c }} over {2 a}.
.EN

Might I say, these documents look much better than what the current "office" software creates, even though \fItroff\fR is over 40 years old!  \fItroff\fR can be used with chained-together commands to get a Postscript output,

.ce 1
\fCcat intro.t | eqn | troff | dpost > plan9.ps\fR

.ti 3
I am currently testing \fIPlan 9\fR in a VirtualBox virtual machine on my Xubuntu laptop.  The install, coming directly from the .iso, went surprisingly well.  There was a menuing system used during the installation that was quite confusing at first, but the installation went smoothly after a few steps.  After the installation, only one user exists in the system, 'glenda.'  Creating another user was a little painful, even following the documentaion on the Bell Labs site.  Once the user was set up, booting the system and logging in is a quite simple affair.
.ti 3
Booting the system for the first time was a mellowing experience.  No fancy animated splash screen, no TrapperKeeper\(rg abstract 3D vector art wallpaper, and no "tooltips" to bug me.  Everything was a depressing shade of gray!  Well, except for the mouse cursor, which reminded me of some of my darkest hours, spent configuring 14.4kbs modem connection strings in Warcraft: Orcs and Humans.  There's no panel to explore and no desktop icons to click.  Welcome to \fIrio\fR, the window manager of \fIPlan 9\fR.  \fIrio\fR introduces you to the beauty in \fIPlan 9\fR: simplicty.  A simple right-click of the mouse on the desktop reveals a menu, containing, among other operations, 'new.'  This option allows me to draw a window where ever I want.  Once the window was created, I was thrown into a terminal.  The terminal in \fIPlan 9\fR is called \fIrc\fR.
.ti 3
From this terminal, I can traverse the file system and run commands.  \s10UNIX\s12 commands such as \fIls\fR, \fIcd\fR, \fIpwd\fR, and \fIps\fR also exist in \fIPlan 9\fR.  We can open the text editor \fIacme\fR from here.  Once opened, we are presented with a text editor, window manager, and file system browser wrapped all up into one.  Now the real fun can begin!
.ti 3
To the right, we see our home directory.  Right-clicking on any of the items there opens it: directories are browsed in a new window, and files are opened for editing.  Middle-clicking (that's right, \fIPlan 9\fR needs a three-button mouse to be used correctly) a word in the toolbars at the top of windows, column, and the program runs the command.  'Del' closes a window, 'Put' writes a file to disk, 'New' makes a new window, and so forth.  The true beauty in this idea is that everything is editable, and anything can be run.  Click the mouse button in a window in a new line, and type 'fortune.'  Middle-clicking on this word executes it in a new window!  Now, anything can be a command.  You can even type commands in the toolbars at the top of windows.  Clicking to the right of the right-most word in a toolbar, and typing 'win' will allow you to open a new terminal window at will.
.ti 3
Unlike in \s10UNIX\s12, where each program is started in a working directory, \fIacme\fR is indifferent.  Each window within has its own working directory.  You can change the working directory of each window by typing the directory in the left-most position in the window's toolbar.  Commands executed from this window will use this directory as their working directory.
.ti 3
Creating a new file is simple, as well.  Middle-click 'New' somewhere to get a new window.  When the window is created, the mouse is positioned in the necessary location to enter a directory.  Typing a directory and a file name and then clicking 'Put' will create the file.  Use another window to browse the folder where you put the file.  Where you see the file, put the cursor before the first letter.  Type 'rm ', then highlight the 'rm ' and the filename with the middle mouse button, and finally release. Congratulations, you just deleted your first file!
.ti 3
\fIPlan 9\fR comes with what is called a "lame" web browser, \fIabaco\fR.  It can be used for Google searches and viewing of simple HTML pages.  It doesn't support Javascript and other newer InterWeb\(co technologies, so don't expect too much.  It is good for finding PDF files to download as references.  Once you have the URL of something that you would like to download, you can use the \fIhget\fR command-line utility to save a copy of it.  Setting up network connectivity to use \fIabaco\fR was a bit of a pain, and so I will leave it to more reputable resources.
.ti 3
One of my favorite ideas in \fIPlan 9\fR is that of mouse chords, that is, using combinations of mouse clicks to perform operations.  In other operating systems, the idea of "copying and pasting" is popular.  Commonly, you select a piece of text with the mouse, and then press the key chord Control+C to grab the text, and then press Control+V to place a copy of it somewhere else.  A similar idea exists in \fIPlan 9\fR, except that it is called 'snarfing.'  What a great word!  Snarfing means the same thing as copying, that is, selecting a piece of text to be copied elsewhere.  In \fIrc\fR, for example, you can left-click to select a piece of text, and then middle-click to snarf it.  Place the cursor somewhere else.  Then, hold the left mouse button while clicking the right-button.  Pretty slick, right?  This scheme also holds up in \fIacme\fR, except that you use the 'Snarf' command in the window's toolbar.
.ti 3
To get this document off of this \fIPlan 9\fR virtual machine, I used FTP.  FTP in \fIPlan 9\fR is quite easy to use.  You simply use the commnd \fIftpfs\fR, which then asks for authentication.  The connection is set up in the file system, and you can browse and move files within it as though it were in the local filesystem!
.ti 3
\fIPlan 9\fR has definitely been an Adventure in Babysitting.  While I could not see myself using for much more than sating my curiosity, I would definitely look forward to seeing more of its innovations making their way into other operating systems.


List Posts Newest Posts Page 1Next Page