💾 Archived View for 9til.de › unix-to-plan9.gmi captured on 2023-04-19 at 22:25:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-10-31)

-=-=-=-=-=-=-

UNIX to Plan 9 command translation

The command set of Plan 9 is similar to that of UNIX. The commands fall into several broad classes.

Some are new programs for old jobs: programs like

ls(1)

cat(1)

and

who(1)

have familiar names and functions but are new, simpler implementations. Who, for example, is a shell script, while ps is just 163 lines of C code.

Some commands are essentially the same as their UNIX ancestors:

awk(1)

troff(1)

and others have been converted to ANSI C and extended to handle Unicode, but are still the familiar tools.

Some are entirely new programs for old niches:

the shell rc(1)

text editors

acme(1)

and

sam(1)

debuggers

acid(1)

and

db(1)

and others displace the better-known UNIX tools with similar jobs.

Compatibility was not a requirement for the system. Where the old commands or notation seemed good enough, we kept them. When they didn't, we replaced them.

The following list of some UNIX commands, files, and shell terminology, which you can emulate in a Plan 9 system:

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
                           /usr/$user/

~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
wget http://foo/bar        hget http://foo/bar > 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
emacs
jim
joe
nano
pico
vi
xedit                      sam
                           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'
                           aux/timesync

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 192.168.1.32
                           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
kill -KILL pid             slay processname | rc
                           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)

less
more                       p

mount [-p flag]            bind(1)
                           unmount(1)
                           9fs(1)
                           srv(1)
                           import(4)
                           exportfs(4)
   -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
launch (Andrew Project)
mux (Blit's wm)            rio (replaces 8½ and help)

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)
                           history(1)
                           fs(4)

vigr
vipw                       [Adding a new user]

vlock                      http://mirtchovski.com/lanlp9/rlock
                           (specify password at invocation)

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

which                      whatis

xbiff                      faces

xclock                     clock
                           games/catclock
                           faces

xditview                   troff | page
                           troff | proof

xload                      stats -l

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

xlogo                      window 'hget http://plan9.bell-labs.com/plan9/img/plan9bunnysmblack.jpg | page'

xman cat                   man -t cat | page

xv file.jpg                page file.jpg

xwininfo                   winwatch

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