Tips


Mounting local disk when booted off of file server

	mount /srv/kfs /n/kfs

Mounting local disk on a machine not running kfs

	disk/kfs -f /dev/sd00/fs
	mount /srv/kfs /n/kfs

Mount fileserver when booted off of local disk

	srv il!vampira
	mount -c /srv/il!vampira /n/vampira

Getting access to 9fat partition on a remote machine

	cpu -h bela -a netkey
	( login as bootes, you will need to use netkey
	on your host to complete the challenge response)
	bind -b '#S' /dev
	rm /srv/dos
	dossrv
	mount -c /srv/dos /n/9fat /dev/sd00/9fat

Getting access to floppy on a remote machine

	cpu -h bela -a netkey
	( login as bootes, you will need to use netkey
	on your host to complete the challenge response)
	bind -b '#f' /dev
	rm /srv/dos
	dossrv
	a:

Getting access to local floppy on a remote machine

	cpu -h bela 
	a:

Clear a hung up channel

assuming il!vampira is hung up, to fix:

	rm /srv/il!vampira
	srv il!vampira
	mount -c /srv/il!vampira /n/vampira

Mount an iso9660 cdrom

	9660srv
	mount /srv/9660 /n/tapefs /dev/sdD0/data

Chords in acme/rio

select w/ 1, use 2 to cut 3 to paste, 2,3 to snarf.

login from non-acl(home) plan9 machine use netkey

	cpu -a netkey -h plan9.acl.lanl.gov

aliases?

rc does not have aliases, but you can use functions in your lib/profile much the same way:
	fn vi { sam $* }

	fn acme { builtin acme -f $font $* }

setting prompt to sysname

	prompt=($sysname%'      ')
        fn $sysname%{ $* }

Saving your acme config

rather than seting up acme each time you start it running stuff like /acme/mail/Mail can be done automatically if you make a dump file. Just setup acme the way you like it, then click on the "dump" tag, this makes the file acme.dump copy this file to another location like acmemail.dump. Now starting acme like:
	acme -l acmemail.dump
will load your configuration.

starting a second (independent) acme

Starting 2 copies of acme will cause new acme "windows" to appear in both copies of acme. If this in not what you want just run a new copy of the plumber first, e.g.
	plumber
	acme

login from non-plan9 machine

	drawterm -a plan9 -c plan9 -n

adding your own personal "faces"

	mkdir $home/lib/face
	mkdir $home/lib/face/48x48x1
	cp /lib/face/48x48x1/.dict $home/lib/face/48x48x1/

modify $home/lib/face/48x48x1/.dict, and add a line to your $home/lib/profile like:

	bind -b $home/lib/face/48x48x1 /lib/face/48x48x1

Replying to selected text in acme mail

Note: in the 4th Ed. the "Q" command in acme replaces this functionality

Sometimes it is nice to reply to just a selected part of a message rather than using acme's Include: feature. To do this I use a small script call ireply:

#!/bin/rc
awk '{ print "> " $0}'
then to reply so some selected text:

1) select text to include in reply w/ button 1

2) type "|ireply" in message tag and run w/ button 2

3) run "reply" in message tag w/ button 2

4) use the button 1,3 chord to paste text into reply

5) remove Include: line from message and type your reply.

Script to start inferno

#!/bin/rc

bind -ca $home /usr/inferno/$home
EMU='-g900x900 -c1'
emu /dis/wm/logon.dis -u $user

setting up Charon

Make sure /usr/inferno/$home/charon exists, run charon and it will create /usr/inferno/$home/charon/config which you can edit to change the default size and enable cookies.

running Charon without starting wm

here is the charon script we use:
#!/bin/rc

EMU='-g900x900 -c1'
emu /dis/charon.dis
NOTE: this script is for an older version of charon. For the latest inferno add these changes to /appl/charon/charon.b:
plan9% diff charon.b charon.b.old
35,38d34
< include "tk.m";
<   tk: Tk;
< include "tkclient.m";
<   tkclient: Tkclient;
147,151d142
<   tk = load Tk Tk->PATH;
<   tkclient = load Tkclient Tkclient->PATH;
<   tkclient->init();
<   if (ctxt == nil)
<       ctxt = tkclient->makedrawcontext();
plan9% 

Making the gateway /net.alt the primary interface for a terminal

	import plan9 /net.alt
	import plan9 /net.alt /net	or 	bind /net.alt /net

Importing alternate network devices into inferno

before starting inferno import the the networks needed e.g.
	import plan9 /net.alt
	import plan9 /net.alt /net
Once inside inferno make sure /net.alt exists and then:
	bind /net /net.alt
Applications such as charon will now have access to the external network inferface on plan9.

Tips for remote terminals

To import your homedir:
        import -C plan9.acl.lanl.gov /usr
(-C is so it will use the cfs cache filesystem) To get access to machines behind the gateway:
        import plan9.acl.lanl.gov /net
Run faces:
        fn rfaces { import plan9.acl.lanl.gov /net; cpu -h bela -c faces -i }
To run acmemail we use the function:
        fn racmemail { import plan9.acl.lanl.gov /net; cpu -h bela -c acmemail }
which calls the function:
        fn acmemail { import plan9 /net.alt; acme -f $font -l acmemail.dump }

set default username on terminal

	user=<username>
in plan9.ini

cut/paste between sam and rio

Sam uses it own cut/paste buffer but you can exchange it with rio's by using the <rio> option in the button 2 menu of sam, thereby enabling cut/paste between rio and sam.

Using CVS

pick a window and connect it to the external net:
import plan9 /net.alt
import plan9 /net.alt /net
add these to your lib/profile:
CVSROOT=:pserver:ddd@cvs.acl.lanl.gov:/n/father/p0/plan9/repository
CVSEDITOR=sam
Now you can use CVS:
cvs login
cvs checkout mp

Using Dump

9fs dump
cd /n/dump/

Using vncs

The 4th Ed. has a vnc server. To use this to connect to plan9 from a unix machine, you must first start the server on plan9:
bind /net.alt /net
vncs
vncs will return a connection number, for this example we will assume that is :X

Note: because you need to bind /net.alt on to /net to have vncs talk to the external network you will need access to a plan9 machine or drawterm.

on unix:

	vncviewer plan9.acl.lanl.gov:X
where is X is the connection number you got from vncs.

at this point you will have a plan9 console, now issue the commands:

	bind '#l0' /net
	bind '#I0' /net
	ndb/cs
	rio
at which point you should have a functional plan9 desktop.

setup secstore

on auth server:
	auth/secstored
	mkdir /adm/secstore
	mkdir /adm/secstore/store
	mkdir /adm/secstore/who
	auth/secuser dpx
on terminal:
	touch /tmp/factotum
	auth/secstore -p /tmp/factotum
  	ramfs -p; cd /tmp
	auth/secstore -g factotum
	secstore password:
	echo 'key proto=apop dom=x.com user=dpx !password=y~1' >> factotum
	auth/secstore -p factotum
	secstore password:
	cat factotum > /mnt/factotum/ctl
and delete the window.

Rebuilding 9load

	cd /sys/src/boot/pc
	mk
	9fat:
	cp 9load /n/9fat/

Generate ssh keys

        disk/kfscmd allow
        aux/ssh_genkey
        chgrp -u bootes /sys/lib/ssh/hostkey*
        disk/kfscmd disallow
        disk/kfscmd sync

display machine load

	awk '{print $1,$8/1000.0}' /dev/sysstat

display machine total memory

	awk -F/ '{print $2}' /dev/swap | awk '{print $1*4/1024,"MB"}'

display machine used memory

	awk -F/ '{print $1}' /dev/swap | awk '{print $1*4/1024,"MB"}'

display machine percent used memory

	awk -F/ '{print 100*$1/$2}' /dev/swap

starting a program in the background

	<program> &
for example: charon &

find out what procs are accessing a file (like fuser on unix)

	grep filename /proc/*/fd

convert txt to ps

	lp -dstdout file.txt >file.ps

convert html to ps

	htmlfmt file.html | lp -dstdout >file.ps

changing authdom

  FIX...

Last Modified: Jun 12 2002
dpx@acl.lanl.gov