Plan 9

Plan9 is a UNIX inspired non-commercial graphical research OS. It has a lot of interesting ideas, pushing the “everything is a file” philosophy to the limit. It is very different from UNIX and can take some time getting used to it.

System update

To update the system, webfs must be running, since we need to sync the mercurial repository. This is probably one of the first things you want to do after a fresh install.

cd /sys/src
mk clean
mk install


Rio is the window-manager of Plan 9. It has a lot of nice ideas and relies on a 3 button mouse for all operations. Left click (mouse 1) is used to select text and put the cursor on the desired location. Right click (mouse 3) will open Rio menu if used on the desktop or terminal, which allow us to create new windows, resize, move, delete or hide them. Middle click will open the terminal options such as copy and paste.

Combining mouse presses (also known as “chording”) can be used to different effects. For example selecting text with mouse 1 and without releasing it, pressing the middle button (mouse 2) will cut the text. If we then hold mouse 1 and press mouse 3 the contents will be pasted. To copy text (snarf) instead of cutting it, just follow the cut with a paste before releasing mouse 1, so (hold) mouse 1 -> (press) mouse 2 -> (press) mouse 3.

For scrollable windows, using the scroll wheel works as expected. Pressing mouse 1 or mouse 3 directly on the scroll bar will scroll up or down respectively. Pressing and holding mouse 2 allow us to drag scroll.

Graphical programs will replace the terminal when run and may interact differently with mouse usage. For example in acme middle click on some text will attempt to execute it (e.g. mouse 2 on Newcol text will create a new column and highlighting ls $home and pressing mouse 2 on it will execute the command as if ran on the terminal and paste the output on a new buffer).

To customize the look and feel of Rio and add a wallpaper if desired see this.

UNIX command translation

UNIX                       Plan 9 from Bell Labs

`command`                  `{ command }

.profile                   $home/lib/profile

^C (Ctrl+C)                DEL key -- doesn't work without rio(4) though.

~                          $home

~username                  /usr/username

"$@"                       $*

1>&2                       >[2=1]

apropos                    lookman(1)

at specific-time           while (! ~ (`{ date }) (specific-time)); commands

cc                         one of ones in 0c(1) followed by the same of 0l(1)
                           pcc(1) for Standard C/POSIX programs

cp -r /foo/ /bar/          mkdir /bar/foo/ && dircp /foo/ /bar/foo/

crontab -e                 sam /cron/$user/cron

curl http://foo/bar        hget http://foo/bar > bar
wget http://foo/bar        (progress bar, -t for ascii) hget -v -o bar http://foo/bar |[2] aux/statusbar [-t] 'downloading'

cut                        awk -F ...

apt-get dist-upgrade
rpm -Ua
yum -c update              /usr/glenda/bin/rc/pull

apt-get install
rpm -i package
yum -c install package     9fs sources ; cd /n/sources/
                           /n/sources/contrib/fgb/root/rc/bin/contrib/install fgb/contrib ; contrib/install $who/$what

df                         disk/kfscmd check
                           echo fsys all df | con -l /srv/fscons
                           df in fossilcons(8)

ee                         sam
emacs                      acme

expr                       hoc -e

find                       du -a | grep pattern
                           grep pattern `{du -a root}
   -name                   du -a root | grep name
   pattern in a file       grep -n pattern `{du -a root | awk '{print $2}'}
   -exec cp '{}' x ';'     cp `{ du -a | grep pattern } x

fsck                       echo fsys all check fix | con -l /srv/fscons
                           if running venti, for a thorough fix: echo fsys all check fix venti snapshot | con -l /srv/fscons

ftp                        ftpfs host.domain (Remote files apear in /n/ftp).

ftpd                       aux/listen ftp

getopt                     getflags(8)

groff -l                   troff | lp

grops                      dpost - see troff(1)

head                       sed 10q

hwclock                    cat '#r/rtc'

id                         echo $user
                           cat /dev/user
                           grep `{cat /dev/user} /adm/users
                           grep $user /adm/users

iostat                     iostats(4)

ifconfig(IP address)       cat /net/ndb

ifconfig                   ip/ipconfig ether /net/ether0 add
                           ip/ipconfig # let dhcp do it

kill pid                   stop processname | rc
                           echo stop > /proc/pid/ctl
                           (in both cases, switch stop with start to get it back)

kill -9 pid                slay processname | rc
kill -KILL pid             echo kill > /proc/pid/ctl

ld                         one of the ones in 0l(1)

ls                         lc -F

lspci                      pci -v

make                       mk (not exactly the same)
                           if necessary, use make in ape/psh

man -k                     lookman(1)

more                       p

mount [-p flag]            bind(1)
   -p                      ns(1)

mount /dev/fd0 /mnt        a: ; cd /n/a:

mount /dev/acd0 /mnt       9660srv
                           mkdir /n/9660
                           mount /srv/9660 /n/9660 /dev/sdD0/data

netcat -l                  aux/listen1 -t tcp!*!$port command

netstat [-r flag]          netstat(1)
   -r                      cat /net/iproute

nfsstat                    iostats(4)

nslookup                   ndb/dnsquery

passwd                     auth/changeuser username (first time)
                           passwd (subsequent times)

paste [FILE] ...           pr -m [FILE] ...

PATH=$PATH:...             bind -a directory /bin

ping                       ip/ping

pkginfo                    wrap(8)

reboot                     fshalt -r (note that there is a reboot command, but it doesn't call fshalt)

rmdir                      rm(1)
                           With contents inside: rm -r dir

sh                         rc(1)
                           if necessary, ape/psh

shutdown                   fshalt(8)
                           echo reboot > /dev/reboot
                           echo panic > /dev/reboot

snoop                      snoopy(8)

source                     .

startx                     rio (replaces 8½ and help)
launch (Andrew Project)
mux (Blit's wm)

tar xzf file.tgz           tar xf file.tgz

tcpdump                    snoopy(8)

traceroute                 ip/traceroute

tree                       du $* | awk '{print $2}' | sort | sed 's/[^\/]+\//   /g'

ufs{dump|restore}          yesterday(1)

vigr                       [Adding a new user]

                           (specify password at invocation)

vmstat                     stats(1)
                           cat /dev/sysstat
                           cat /dev/swap

which                      whatis

xbiff                      faces

xclock                     clock

xditview                   troff | page
                           troff | proof

xload                      stats -l

xlock                      /n/sources/contrib/steve/conslock
                           (authenticates against authentication server)

xlogo                      window 'hget | page'

xman cat                   man -t cat | page

xv file.jpg                page file.jpg

xwininfo                   winwatch

yes                        while() { echo y }
yes arg                    while() { echo arg }