nix for „y€ƒEPH sers

xelson rFpF fee˜ e

genter for ƒ™ienti™ gomputing

hep—rtment of w—them—ti™s

niversityof t—h

ƒ—lt —ke gityD t—h VRIIP

ƒe

„elX @VHIA SVIESPSR

‘PREtunEVU“ gontents

I sntro ™tion I

P ‡h—t9s in the x—me P

Q gomm—nd €ro ™essors P

R gomm—nd gorresp onden™e S

S pile „ree yrg—niz—tion IQ

T serD hire™toryD —nd pile x—mes IU

U hevi™e x—mes IU

V vogi™—l x—mes IV

W €ip esD sGy ‚edire™tionD —nd f—™kground to˜s IW

IH „ermin—l ƒupp ort in nix PH

II iyp —nd vogout PI

IP gomm—nd eli—ses PI

IQ invironment gustomiz—tion PP

IR qetting relp ynEline PP

IS yp er—torsD ‡heelsD —nd ƒup erE sers PQ

IT smp ort—nt nix„ools

IU purther ‚e—ding

sndex PU

i I sx„‚yh g„syx I

I sntro du™tion

„his do ™ument h—s ˜ een written to provide — st—rting p ointfor„opsEPH users

will ˜ e working on nix systemsD p—rti™ul—rly the ƒ x workst—tionsF st is

not — sm—ll ˜ o ok —˜ out nixY the l—st se™tion gives pointers to sever—l ˜ o oks

th—t should prove usefulF ‚—therD it is intended to provide the re—der with

™onne™tions ˜ etween f—mili—r „opsEPH ™on™epts —nd their —n—logues on nixF

nix h—s often ˜ e ™riti™ized for tersenessD l—™k of mnemoni™ ™omm—ndsD —nd

™omm—nd in™onsisten™yD plus for overEemph—sis of inter—™tive ™omputer use —s

opp osed to ˜—t™h’num˜ er ™run™hing4F „o — ™onsider—˜le extentD these ™riti™isms

—re grounded in f—™tF roweverD —nyone who uses nix for —n extended p erio d

—nd le—rns how to m—ke go o d use of the multitude of to ols —v—il—˜le —lmost

without ™eption ˜ e™omes — ™onvertF hespite its w—rtsD nix is in m—nyw—ys

—very ˜ e—utiful op er—ting system whi™h h—s h— —nd ™ontinues to h—veD enorE

mous inuen™e on op er—ting systems designD progr—mming l—ngu—gesD softw—re

developmentenvironmentsD —nd even on h—rdw—reofsever—l new —r™hite™turesF

sts ™le—nD sleekD design ™—n ˜e —ttri˜uted l—rgely to the sm—ll num˜er of very

t—lented rese—r™hers —t e„8„ fell v—˜ or—tories who develop it for the rst

sever—l ye—rs of its rst existen™e on — €h€EIID with su˜sequent p orts to sfw

QUH —nd roneywell qgyƒ systemsF ƒever—l of them deservemention hereD for

you will see their n—mes mentioned frequently in nix ˜ooksD liter—tureD —nd

do ™ument—tionX

 uen „hompson for the op er—ting system kernel —nd le systemY

 hennis ‚it™hie for the g l—ngu—geY

 ƒteve tohnson for the €ort—˜le g ™ompilerD —nd the y—™™ —nd ™ompiler

gener—tor to olsY

 fri—n uernigh—nD €eter ‡ein˜ ergerD —nd el eho for numerous softw—re

to ols —nd ˜ o oks —˜ out nix —nd gY

 ƒtu peldm—n for the rst portr—n UU ™ompiler —nywhereD fUUD —nd for m—keD

p ossi˜ly the —llEtime gre— softw—retoolever writtenF

smplement—tions of nix run on m—™hines —s sm—ll —s the sfw €gD —nd —s

l—rge —s the gr—yPF ‡ith only — few ex™eptions @ghgD pujitsuD —nd sfwAD ne—rly

every new sup er™omputer intro du™ed to the m—rket sin™e IWVS h—sD or will so on

h—veD nixF xo other op er—ting system in the world runs on so m—ny dierent

h—rdw—re —r™hite™turesD providingD for the rst in ™omputing9s fortyEye—r

historyD the p ossi˜ility of true progr—mmer —nd softw—re p ort—˜ility —™ross mulE

tiple —r™hite™turesF prom m—n—gement9s p oint of viewD this should m—keitmu™h

e—sier to ™hose ™omputers on the ˜—sis of h—rdw—re p erform—n™eD —nd less

on m—int—ining the st—tus quo th—t h—s left m—infr—me ™omputing environments

only sup er™i—lly dierent th—n they were in IWTQ when the rst multiEmo del

—r™hite™tureD the sfw QTH seriesD w—s intro du™edF P ‡re„9ƒ sx „ri xewi P

P ‡h—t9s in the x—me

uen „hompson ™hose the n—me nix —s — pun on the op er—ting system wulti™sD

from whi™h it ˜ orrowed m—ny ide—sF „he initi—l implement—tion on the €h€EII

w—s in —ssem˜ly ™o deD ˜ut this w—s so on rewritten in the g l—ngu—geF hennis

‚it™hie develop ed g from fD whi™h in turn ™—me from fg€vD one of the rst

p ort—˜le systems progr—mming l—ngu—gesF fg€v —nd f still existD —nd f h—s

pro du™ed — des™end—ntD w—rg—yD whi™h is used to the ‡—terlo o w—ple

—lge˜r— systemF g h—s ™ompletely oversh—dowed them howeverF

e„8„ fell v—˜ or—tories h—s —dem—rked the n—me nixD so other vendors

who li™ense it from them must usu—lly ™ome up with new n—mesF e„8„ h—s

now gone through pu˜li™ rele—ses of †ersion TD †ersion UD ƒystem sssD ƒystem

†D €‡f @€rogr—mmer9s ‡ork˜ en™hAD —nd h‡f @ho ™umenter9s ‡ork˜ en™hAF

†ersion V is in developmentintern—llyF

ferkeley h—s h—d RFHD RFID RFPD —nd RFQ of fƒh @ferkeley ƒt—nd—rd histriE

˜utionA nixF „heir ™ontri˜utions to nix —re legionY the most signi™—nt—re

the origin—l p ort to the hig †eˆ —r™hite™tureD the —ddition of virtu—l memory

p—ging supp ortD the f—st le systemD the g shell @™shAD —nd „g€Gs€ networking

supp ortF

rewlettE€—™k—rd ™—lls theirs r€ ˆY it is ˜— on ƒystem † with ferkeley

extensionsF

ƒun9s implement—tion is ™—lled nix in their do ™ument—tionY they —re —pE

p—rently li™ensed to do soF st is ˜—sed on RFQ fƒh with ƒystem † ™omp—ti˜ilityD

—nd ƒun is working together with e„8„ to pro du™e — ™ommon nix merging

the fe—tures of ˜ oth these m— jor implement—tionsF

siii h—s pu˜lished — p ort—˜le op er—ting system interf—™e denition ™—lled

€yƒsˆD derived from — su˜set of †ersion UD ƒystem s s sD —nd ƒystem †F

qould9s implement—tion is „ˆEQPF „he sfw ‚„version is ™—lled esˆF yn

the gr—y PD it is ™—lled xsgyƒF

yn the sfw €gD we h—ve †enix from †enturegomD —nd ˆenix from wiE

™rosoftF

xo˜ o dy to my knowledge h—s yet pro du™ed — ™le—nedEup version ™—lled

uleenixF

Q gomm—nd €ro ™essors

nix oers — v—riety of ™omm—nd pro ™essorsD ™—lled shellsD whi™h —re —n—logous

to ™om˜in—tions of the „opsEPH iˆigD wsgD —nd €gv F

„he origin—l oneD shD is known —s the fourne shellD —fter its —uthorD ƒteve

fourneF „he most popul—r one in ferkeley nix environments is fill toy9s

™shD the g shellD so ™—lled ˜ e™—use of its resem˜l—n™e to the g progr—mming

l—ngu—geF ™sh oers ˜ etter progr—mm—˜ilityD ™omm—nd historyD ™omm—nd —li—sE

ingD —nd imp ort—ntlyD jo˜ ™ontrol —llowing st—rting —nd stopping foreground —nd Q gywwexh €‚ygiƒƒy‚ƒ Q

˜—™kground jo˜sF

e newer shell is the uorn shellD kshD whi™h ™om˜ines fe—tures of ˜ oth sh

—nd ™shD —nd oers ™omm—nd fun™tions —nd im—™sEstyle ™omm—nd editingF „he

fpsh is — f—™kus fun™tion—lEprogr—mming style shellF xeither ksh nor fpsh

h—s re™eived wide distri˜utionD ˜ut ksh m—yeventu—lly repl—™e sh if it re™eives

strong e„8„ ˜—™kingF

sn ƒun nixD shells —nd other progr—ms m—y˜e™onveniently run in — winE

dowing environmentY see the m—n p—ges on d˜xtoolD shelltoolD suntoolsD—nd

tektoolF

nlikethe „opsEPH iˆigD nix shells h—ve only — sm—ll num˜ er of ˜uiltEin

™omm—ndsD —nd these —re ex™lusively for ™ontrol of shell optionsF ‡h—t ™orreE

sp onds to most iˆig ™omm—nds —re —™tu—l exe™ut—˜le progr—ms whose n—mes

—re not known to the nix shellsY they must therefore ˜e typ ed without —˜E

˜revi—tionF „hey —re se—r™hed for in the le system in — ™h—in of dire™tories

dened ˜ythe€e„r environmentv—ri—˜leD mu™h like the „opsEPH ƒ‰ƒX logi™—l

n—meF por this re—sonD —nd —lso ˜ e™—use nix w—s origin—lly develop ed on slow

teletyp e printing termin—lsD nix ™omm—nds tend to ˜e shortD with m—ny PE

—nd QEletter ™omm—ndsF

„he „opsEPH iˆig h—s knowledge of the synt—x for —ll of its ˜uiltEin ™omE

m—ndsD —nd €gv gives ordin—ry users the —˜ility to —dd new ones whi™h —re

indistinguish—˜le from iˆig ™omm—nds —s f—r —s their user interf—™e is ™onE

™ernedF ‡hen you typ e something like gyw€svi GcD the iˆig knows wh—t

swit™hes —re —v—il—˜leD —nd will displ—y them in resp onse to your queryD˜utno

—ttempt h—s ˜ een m—de to lo—d —ny p—rti™ul—r ™ompiler into memoryF e progr—m

whose synt—x is not ˜uiltEin to the iˆigD su™h—s py‚„‚eFiˆiD™—nnotgiveyou

help until it is runningF „h—t is why py‚„‚e Gc do es not workD ˜ut py‚„‚e

followed ˜y — ™—rri—ge return —nd Gc do esD sin™e ˜y th—t timeD the progr—m

is exe™utingF „he p—rti™ul—r order of swit™hes —nd len—mes on the ™omm—nd

line is up to who ever dened the p—rsing synt—xD —nd ™onsequentlyD „opsEPH

™omm—nds exhi˜it — v—riety of stylesD in™luding su˜ ™omm—nd mo desD su™h —s

used ˜y the f svh —nd hs‚ig„y‚‰ ™omm—ndsD whi™h h—ve — l—rge num˜er of

optionsF

sn nixD the shells do not ™—rry ˜uiltEin knowledge of individu—l progr—m

options —nd len—me exp e™t—tionsF snste—dD they —ssume th—t —l l ™omm—nds

—re invoked with the synt—x ™omm—ndver˜ foption—l swit™hesg filelistF

ƒwit™hes —re ™onvention—lly prexed ˜y—hyphen @though there —re ex™eptionsD

su™h—st—r —nd —rAF sn —nyeventD everything —fter the ™omm—ndver˜ is —ssumed

to ˜ e — p otenti—l lelistD —nd the text is s™—nned for wild™—rd ™h—r—™ters @whi™h

™—use len—me exp—nsionAD —nd the ™omm—nd line is exp—nded into — list of

˜l—nkEsep—r—ted —rgumentsF „he m—in routine in the progr—m itself is then

presented with two p—r—meters|—n integer ™ount of the num˜ er of —rgumentsD

—nd — ve™tor of p ointers to e—™h of the —rgumentsF

por m—ny purp osesD this is quite —dequ—teF xo progr—m h—s to h—ndle wildE

™—rd exp—nsionD sin™e it sees only the n—l list of ™omm—ndEline —rgumentsF Q gywwexh €‚ygiƒƒy‚ƒ R

yption p—rsing is simple ˜ e™—use the initi—l ™h—r—™ter of e—™h —rgument is exE

—mined to see whether it is — hyphen or notY if it isD —n option swit™h is —ssumedD

—nd the rem—ining ™h—r—™ters of the —rgument —re further ex—mined to ™l—ssify

the —rgumentF ytherwiseD the —rgument is —ssumed to ˜ e — len—meF

„here —re sever—l dis—dv—nt—ges of this —ppro—™hF

 xo inEline help is —v—il—˜le from the shellD like it is with the „opsEPH

iˆigF „his is — serious —wofessenti—lly every other op er—ting system

˜ut „opsEPHD —nd for™es — user who h—s p—rti—lly typ ed — ™omm—nd line

—nd then forgotten the n—me of — swit™htore—™h for — printed m—nu—lD or

—˜ ort the typ ein —nd go se—r™h for onEline do ™ument—tionF

 snv—lid synt—x in the ™omm—nd line is not dete™ted until the progr—m h—s

—lre—dy ˜ een lo ™—ted in the le systemD lo—ded into memoryD —nd st—rtedD

whi™hw—stes system resour™esF ƒin™e typ ogr—phi™—l errors —re ™ommonD

this h—pp ens frequentlyF

 „he len—me exp—nsion done ˜y the shell is limited to the size of the

p ointer ve™tor ˜uerD whi™h is unfortun—tely xed when the shell is ˜uiltF

elthough it is l—rgeD it is not l—rge enough to hold exp—nsions of sever—l

l—rge dire™toriesY for ex—mpleD El GusrGm—nGm—ncGB overows the shell

˜uer —nd the ™omm—nd do es nothingF

 fe™—use the shells h—ndle wild™—rd exp—nsionD everyone —ssumed th—t

would —lw—ys ˜ e su™ientD —nd no nix li˜r—ry th—t s —m —w—re of proE

vides — userE™—ll—˜le fun™tion for wild™—rd exp—nsionF „husD — progr—m

like nix uermit ™—nnot h—ndle — get BFB ™omm—ndD unless th—t request

w—s on the ™omm—nd lineF

 ixp—nding wild™—rds implies se—r™hing the le systemD —nd the w—y th—t

the shellsD —nd progr—ms like t—rDh—ve done this is to re—d the dire™tory

les themselvesD m—king user ™o de unne™ess—rily knowledge—˜le —˜ out deE

t—ils th—t re—lly should ˜ e known only to the kernelF sn ƒun9s l—test rele—se

of nixD dire™tories ™—n only ˜ e re—d — sp e™i—l li˜r—ry ™—llsD inste—d of ˜y

expli™it op ens —nd re—ds of dire™tory lesD indi™—ting th—t the imp ort—n™e

of my ™riti™ism is only now ˜ eginning to ˜ e understo o

 „he nonEtrivi—l p—ttern m—t™hing ™o de required ˜y most editors —nd the

shells h—s only re™ently ˜ een —dded to the st—nd—rd li˜r—ries on some nix

systems @regexp@QAAF

„he „opsEPH —ppro—™h for wild™—rd exp—nsion p ermits the user to present

— wild™—rded le sp e™i™—tion to the wonitor through — system ™—llD then to

retrieve one m—t™hing len—me with e—™h su˜sequent system ™—llF sf the progr—m

wishes to oer f—n™ier p—ttern m—t™hingD it ™—n e—sily do so ˜y requesting the

most gener—l le sp e™i™—tion from the wonitor in the rst pl—™eD then —pply the R gywwexh gy‚‚iƒ€yxhixgi S

p—ttern m—t™h lter to e—™h returned n—meF ƒp—™e neverh—sto˜e—llo™—tedto

store —ll the le n—mes —t on™eD sin™e the wonitor is —˜le to h—ndle the ˜uering

of len—mesY there is no di™ulty then in —sking for — listing of —ll the les in

the le systemD hs‚ig„y‚‰ €ƒX`BbBFBFBF sn nixD this ™—n only ˜ e done ˜y—

su˜terfuge of —ddition—l options of some ™omm—ndsD like lsF sf the user re—lly

w—nts — ™omplete list of —ll the les in the wild™—rd exp—nsionD then there is no

di™ulty in dyn—mi™—lly —llo ™—ting the sp—™e for them —s they —re retrieved one

˜y oneF

sn some re™ent implement—tions of RFQfƒhD users h—ve mo died shells to

provide some limited inEline help with len—me exp—nsionF yn the ƒunD if the

™sh environmentv—ri—˜le ™ is setD then if gtlEh is typ ed on the ™omm—nd

line @not —t the ˜ eginningD ˜ e™—use th—t would ˜ e —n endEofEle sign—lAD — list

of —ll les whi™hm—t™h to th—t p oint is displ—yedF „his —™tion is suppressed for

the rst word on e—™h line @the ™omm—nd ver˜AD so you ™—nnot use it to ndD

s—yD —ll ™omm—nds th—t ˜ egin with — ™ert—in letterF st is unfortun—te th—t nix

™hose the query —s — p—ttern m—t™hing ™h—r—™terY it should h—ve ˜ een reserved

for future use —s — help ™h—r—™terF gtlEh is mu™h less o˜viousF

R gomm—nd gorresp onden™e

„he following t—˜les give — ˜rief summ—ry of „opsEPH ™omm—nds @o˜t—ined ˜y

typing ’c4 to the iˆigA —nd p opul—r progr—ms with nix equiv—lentsF

sn some ™—sesD there is — ™lose m—t™h ˜etween themD —nd in othersD only

very rough equiv—len™eF por ex—mpleD —lthough nix h—s mount —nd umount

™omm—ndsD these ™orresp ond to privileged „opsEPH y€‚ ™omm—nds ƒi„ hsƒu

e†esvefvi —nd hsƒwy x„D r—ther th—n to the iˆig eƒƒsqxD hieƒƒsqxD wy x„D

—nd hsƒwy x„ ™omm—ndsF „here is no w—yfor— nix user to request th—t the

op er—ting system eƒƒsqx or wy x„ — devi™eD su™h —s — t—p e driveY the op er—ting

system provides no su™h ™ontrolF snste—dD the user just referen™es the devi™e

n—me —nd hop es no one else h—d the s—me ide— —t the s—me time @eFgF t—r E™v

B writes on GdevGrmtH without —nyvolume veri™—tionAF R gywwexh gy‚‚iƒ€yxhixgi T

€riv—te „y€ƒEPH gomm—nds nix iquiv—lents

evi‚„ le—ve

exy„ri‚hs‚ig„y‚‰ ls

fivv e™ho En gtlEq

gh ™dD

hƒu ƒi duD df

psviEeggiƒƒEgy x„ EnG—E

psxqi‚ nger

ui‰vyeh ™—t

v€ lpr

wuhs‚

€gv EnG—E

€ lpr

€ƒ‰ƒ ngerD l—stD psD rwhoD who

€ ‚qi EnG—E

ƒ€ivv sp ell

‚i€ie„ for

ƒ„gy€‰ ™pioD ™pD t—r

ƒ„‚ƒpQ strsfQ

„hivi„i nd |

„iƒ„ test

„‰€i ™—t

€he„iEevi‚„ le—ve

‡es„ sleepD w—it

‡re„ envD printenv

ˆhs‚ig„y‚‰ ™shD kshD sh R gywwexh gy‚‚iƒ€yxhixgi U

ƒt—nd—rd „y€ƒEPH gomm—nds nix iquiv—lents

c —prop osD m—nD wh—tisD whereisD whi™h

eggiƒƒ EnG—E

eh†sƒi EnG—E

eqesx 33D 35

e€€ixh ™—t bb

e‚grs†i —rD t—r

eƒƒsqx EnG—E

e„„egr EnG—E

feguƒ€egi ddD mt

fvexu ™le—r

f‚ieu gtlEh —fter write

f svh mkdirD

gexgiv —trmD lprm

gvyƒi EnG—E

gyw€svi ™™D fUUD m—keD p ™D piD pixD px

gyxxig„ ™dD pwd

gyx„sx i ™shX fg

gy€‰ ™p

g‚ie„i edD em—™sD exD vi

g‚ip ™xrefD ™t—gsD pxref

gƒe†i stripD ™shX gtlEnY see —lso gyw€svi

he‰„swi d—te

hh„ —d˜D d˜xD d˜xto olD sd˜

hieƒƒsqx EnG—E

hif q ™™ EgD fUU EgD p ™ Eg plus —d˜D d˜xD d˜xto olD sd˜

higve‚i EnG—E

hipsxi ™shX setenvD shX exp ort xewia

hivi„i rm

hi€yƒs„ EnG—E

hi„egr EnG—E

hs‚ig„y‚‰ ls

hsƒefvi gtlEh from su

hsƒge‚h EnG—E

hsƒwy x„ EnG—E

hy shel l ™omm—ndle

ihs„ edD em—™sD exD sedD texteditD vi

ixefvi su

ixhEeggiƒƒ EnG—E

iyp EnG—E

i‚ x EnG—E

iˆewsxi EnG—E R gywwexh gy‚‚iƒ€yxhixgi V

ƒt—nd—rd „y€ƒEPH gomm—nds nix iquiv—lents

iˆig „i ™omm—ndn—me

iˆ€ xqi EnG—E

phs‚ig„y‚‰ ls El

py‚u ™shX ˜gD fgY swit™her

p‚iii ™shX fg plus gtlE

qi„ EnG—E

riv€ —prop osD m—nD em—™s gtlEr s

rsƒ„y‚‰ history

sxpy‚we„syx —tqD envD lp qD printenv

uii€ ™shX ˜g

uwsg EnG—E

vyeh ™™D fUUD ldD m—keD p ™D piD pixD px

vyqy „ logout or gtlEh

wi‚qi EnG—E

wyhsp‰ EnG—E

wy x„ EnG—E

xewi EnG—E

y‚sqsxev EnG—E

€y€ gtlEh

€‚iƒi‚†i EnG—E

€‚sx„ lpr

€ xgr EnG—E

€ ƒr ™shD sh

h EnG—E

‚ EnG—E

‚hs‚ig„y‚‰ ls Eltu

‚igis†i

‚iix„i‚ EnG—E

‚ip ƒi mesg

‚iwe‚u ™—t bGdevGnull

‚ixewi

‚iƒi„ ™shX EW 75

‚i„‚si†i EnG—E

‚i‡sxh ddD mt

‚ x ™omm—ndn—me

ƒe†i ™shX gtlEn

ƒi„ le—veD ™shX set ver˜ oseD p—sswd

ƒus€ ddD mt

ƒ„e‚„ ™shX fg

ƒ fws„ —t

ƒ‰ƒ„e„ ngerD l—stD psD rwhoD wD who R gywwexh gy‚‚iƒ€yxhixgi W

ƒt—nd—rd „y€ƒEPH gomm—nds nix iquiv—lents

„eui ™sh leD sh leD ™shX sour™e leD shX F le

„evu mesgD write

„hs‚ig„y‚‰ ls Elt

„i‚wsxev resetD sttyD tset

„‚exƒve„i EnG—E

„‰€i ™—tD lessD moreD view

xe„„egr EnG—E

xhigve‚i EnG—E

xhivi„i EnG—E

xuii€ EnG—E

xvyeh ddD mt

†hs‚ig„y‚‰ ls El

‡hs‚ig„y‚‰ ls Elt R gywwexh gy‚‚iƒ€yxhixgi IH

gommon „y€ƒEPH €rogr—ms nix iquiv—lents

ewƒ„iˆ —mstex

e‡u —wk

ffye‚h rn

fyvhx tgrindD vgrind

gf ™˜D indent

gtlE„ gtlE„D time

hi„ef exp—ndD unexp—nd

hspp diD diQD sdi

hyg wix„ form—tD roD nroD tro

hy‡xvh ™—tD setkeys

igry e™ho

iq‚i€ egrep

pesv —s

pq‚i€ fgrep

psvgyw diD diQD sdi

psxqi‚ nger

py‚€‚„ fpr

py‚€„ˆ fpr

p„€ ftpD r™pD tftpD uu™pD uusend

qi„ƒ€h stty

q‚i€

rieh he—d

sxhix„ ™˜D indent

sxpƒg‚ du

ui‚ws„ kermit

ve„iˆ l—tex

vsf‚ip li˜refD

v€„y€ƒ devpsD lptopsD tr—ns™ript

weg‚y —s

weui m—ke

weupsv fsplitD m—klD

weuvsf —rD r—nli˜

we€vi m—ple

wsheƒ —s

wv„gyv pr

ww m—il

xi„ƒ„e„ ngerD netst—tD ruptimeD rwhoD tr—™ S psvi „‚ii y‚qexse„syx II

gommon „y€ƒEPH €rogr—ms nix iquiv—lents

€eƒ„yg p—sto ™

€grsƒ„ gprofD monitorD profD t™ov

€gvyyu gprofD monitorD profD t™ov

€py‚w EnG—E

€py‚„ pfort

€ry„y s™ript

€‚i„„‰ pretty

ƒ€ivv sp ell

‚e„py‚ eD fUUD r—tfor

‚ih gi redu™e

‚ xypp form—tD roD nroD tro

ƒg‚sfi s™ri˜ e

ƒih sed

ƒihs„ edD exD sed

ƒi„ƒ€h stty

ƒpQ sfQ

ƒxyfyv i™onD sno˜ ol

ƒy‚„ sortD

ƒ‚ggyw diD diQD sdi

„esv t—il

„ivxi„ telnetD rloginD rshD uux

„iˆ tex

„weg‚y ™ppD mRD tm—™ro

„xi„ tip

„€ „sv —nsit—p eD ddD mtD t—r

„‚swUP —wk

„ƒ„eqi nd

riv€ uhelp

xs„ƒ units

ƒ‚vƒ„ ls Gusr

higyhi uude™o de

ixgyhi uuen™o de

†eˆ„e€ —nsit—p e

†wƒriv€ vmshelp

ˆ‚ip ™xrefD pxref

ˆƒie‚gr egrepD fgrepD grepD ngrep

S pile „ree yrg—niz—tion

„opsEPH —nd nix ˜ oth oer wh—t —pp e—rs to the user to ˜ e — treeEstru™tured

le system m—de up of ordin—ry d—t— les —nd dire™tory lesY the dire™tory les

™ont—in lists of lesD in™luding p ossi˜ly dire™tory lesF „opsEPH le n—mes —re S psvi „‚ii y‚qexse„syx IP

™—se insensitiveD —nd ™onvention—lly displ—yed in upp erE™—seF nix le n—mes

—re ™—se sensitive X les fooD pyyD—ndpoo —re distin™tF ƒin™e eƒgs s upp erE™—se

letters ™oll—te ˜ efore lowerE™—se lettersD nix users tr—dition—lly sp ell —ll le

n—mes in lowerE™—seD ex™ept those few sp e™i—l les th—t they w—ntto—ppe—r—t

the st—rt of — dire™tory listingD su™h—s w—kefileD ‚iehwiD —nd „yhyD where they

—re more likely to ˜ e noti™edF

rere is — ™omp—rison of these le tree stru™turesF

hire™tory y˜je™t „opsEPH

hire™tory file n—meFhs‚ig„y‚‰FI

‚oot dire™tory devi™eX`‚yy„Ehs‚ig„y‚‰b

„opElevel dire™tory n—me devi™eX`‚yy„Ehs‚ig„y‚‰bpyyFhs‚ig„y‚‰FI

„opElevel dire™tory devi™eX`pyyb

ƒu˜dire™tory devi™eX`pyyFfe‚b

yrdin—ry file devi™eX`pyyFfe‚bfileFextFgen

hire™tory y˜je™t nix

I

hire™tory file —nyn—me

‚oot dire™tory Gdevi™e

„opElevel dire™tory n—me Gdevi™eGfoo

„opElevel dire™tory Gdevi™eGfoo

ƒu˜dire™tory Gdevi™eGfooG˜—r

P

yrdin—ry file Gdevi™eGfooG˜—rGfileFext

„here —re ˜ oth go o d —nd ˜—d p oints of these le systemsF

foth h—ve the ™on™ept of — def—ult login dire™tory —nd — ’™urrent def—ult

dire™tory4D so frequentlyD only the le n—meD not its full dire™tory p—thD h—s

to ˜ e sp e™iedF nix supp orts rel—tive dire™tory p—thsD —nd „opsEPH will to o

with the next version of the wonitor to ˜ e inst—lled in l—te spring IWVUF „his

redu™es the —mountoftyping users h—ve to doD —nd m—kes it p ossi˜le to dene

™omm—nd les whi™hnever h—ve to n—me — full dire™tory p—th expli™itlyD —llowing

dire™tory trees to ˜e moved from m—™hine to m—™hine without h—ving to edit

` b

their ™omm—nd lesF „he €vy„UW nix implement—tion m—kes extensive

use of this ™—p—˜ilityF

yn nixD les in the ™urrent dire™tory ™—n ˜e n—med without —n expli™it

p—thD or prexed ˜y — rel—tive p—th FGD sin™e F is — shorth—nd for the ™urE

rent dire™toryF „he p—rent dire™tory shorth—nd is FFD so — le in th—t dire™E

tory ™ould ˜e referred to —s FFGfilen—meF „his not—tion ™—n ˜e rep e—tedX

I

nix h—s no sp e™i—l dire™tory n—me form—tY the dire™tory le —ttri˜ute is stored with the

le prote™tion ˜its

P

nix do es not h—ve le gener—tionsD —lthough multiple p erio ds —re p ermitted in n—mesD so

they ™—n ˜ e simul—ted|fileFextFI is — v—lid le n—meF S psvi „‚ii y‚qexse„syx IQ

FFGFFGFFGfilen—me is — le in the gre—t gr—ndp—rent dire™toryF ‰ou r—rely

need to use the FG not—tionD ˜ut it is sometimes h—ndy to dis—m˜igu—te — leE

n—me with —n initi—l hyphen from —n option swit™hD whi™his—lw—ys ˜ egun ˜y

—hyphen in nixY for ex—mpleD rm Efoo r—ises —n error mess—ge rmX unknown

option D˜utrm FGEfoo deletes the le su™™essfullyF

enother useful shorth—nd supp orted ˜y ™sh —nd sever—l utilitiesD ˜ut not ˜y

shD is tilde to represent the login dire™toryX GF™shr™ is — le in th—t dire™toryF

por shD you must use — st—nd—rd environment v—ri—˜leD rywiX 6rywiGF™shr™Y

this works with ™sh to oF

yn ˜ oth systemsD dire™tory les —re sp e™i—l|they m—y˜ere—d—˜le˜y—user

progr—m @on „opsEPHD only ˜y m—king system ™—llsD for re—sons m—de evident

˜ elowAD ˜ut only the op er—ting system kernel is ever p ermitted to write themD

in order to m—int—in le system integrityF

„he nix form—t is simple —nd ™onsistentD ˜ut one ™—nnot tell from the n—me

if — le represents — dire™tory le or notF „his often do es not m—tterD for if you

—sk for — dire™tory listing of — le whi™h is — dire™toryDyou get — list of the les

in th—t dire™toryD ˜ut if it is — norm—l d—t— leD you just get the n—me ˜—™kY

˜ oth ™—ses —re ™onsidered legitim—teD —nd no error is r—ised for eitherF

„he nix le n—ming synt—x —nd op er—ting system supp ort for it m—ke

devi™es equiv—lent to les from the p oint of view of the progr—mmerF rere —re

some ex—mplesX

GdevGtty user termin—l

GdevGmt t—p e drive

GdevGlpr line printer sp o oler

GdevGnull null devi™e

GuGm—GjonesGfooF˜—r ordin—ry le

„he null devi™e is —lw—ys empty for inputD —nd never full for outputY it is priE

m—rily useful for providing dummy input —nd output lesF

„he „opsEPH form—t is more ™omplexD ˜ut ™le—rly distinguishes dire™tory

les from ordin—ry d—t— lesF hevi™e n—mes ™—n ˜ e used in pl—™e of le n—mesD

˜ut the dire™tory —nd le sp e™i™—tion —re just ignoredF „husD for the —˜ ove

nix ex—mplesD „opsEPH h—s

„„‰X user termin—l

w„X t—p e drive

v€„X line printer sp o oler

x vX null devi™e

e€ƒX` FtyxiƒbpyyFfe‚FQ ordin—ry le

„here isD howeverD — signi™—nt distin™tion in the implement—tion of the dire™tory

systemF e „opsEPH dire™tory ™ont—insD —mong other thingsX

 le n—mesY S psvi „‚ii y‚qexse„syx IR

 le —ttri˜utes @˜yte ™ountD ˜yte sizeD p—ge ™ountD prote™tionD —™™ountD login

or lesEonlyD owner n—meD l—st writer n—meD referen™e ™ountsD temp or—ry

or p erm—nentD deleted ˜ut not expungedD —r™hivedD visi˜leGinvisi˜leD XXXAY

 times of ™re—tionD l—st re—dD l—st writeD l—st up d—teD l—st ˜—™kupD —nd expiE

r—tionY

 for —r™hived lesD n—mes of two sep—r—te t—p es on whi™h the le ™ontents

reside oElineY

 logi™—l disk —ddress p ointers to the p—rent dire™toryY

 logi™—l disk —ddress p ointers to e—™h le9s ™ontentsY

 disk quot—sY

 login p—sswordsF

ƒin™e the „opsEPH op er—ting system ™—™hes —™tive dire™tories in memoryD nding

— le in the ™urrent dire™tory norm—lly do es not require —ny disk —™™essesF „he

pointers to p—rents —nd ™hildren em˜ edded in the dire™tory le me—n th—t it

™—nnot ˜ e ren—med or moved to — new disk stru™ture without ˜ eing reorg—nized

—nd rewrittenF „here is no ee™tive limit to the num˜er of les in the entire

le systemY les ™—n ™ontinue to ˜e ™re—ted until there is no more disk sp—™e

left in the le systemF sf — dire™tory le ˜lo ™k ˜ e™omes ™orruptedD it is still

usu—lly p ossi˜le to re™onstru™t —nd re™over virtu—lly —ll of the whole le system

˜y virtue of the forw—rd —nd ˜—™kw—rd p ointers of the dire™tory ˜lo ™ks @e—™h

le h—s —n index ˜lo ™k whi™h p oints to its owner dire™toryAF „his is the jo˜ of

the griguh utility whi™hisrunwhenever the higEPHGTH is re˜ o oted —fter —

h—rdw—re or ele™tri™—l f—ilure whi™h p otenti—lly ™ould ™orrupt the le systemF

nder nixD dire™tory les ™ont—in essenti—lly only two thingsX

 le n—mesY

 for e—™h leD its index into — m—ster t—˜le of —ll les in the system @the

nix inode t—˜leAY

e nix dire™tory le —lw—ys ™ont—ins —n entry for its p—rent dire™tory —nd itselfD

—nd soD like—„opsEPH dire™toryD™—nnot˜emoved without intern—l reorg—niz—E

tionF yn the other h—ndD nding the p—rent dire™tory from — su˜ dire™tory ™—n

˜ e done e™iently from inform—tion in the dire™tory le itselfF

nix stores — le referen™e ™ount in its m—ster ino de t—˜leD whi™h —llows —

le to h—vemultiple n—mesF heleting —le removes its n—me from its owning

dire™tory —nd de™rements the referen™e ™ountY only when the ™ountre—™hes zero

is the le sp—™e —™tu—lly freedF yne imp ort—nt use of these ’linked les4 is

repli™—tion of d—t— les to l—rge groups of usersD su™h —s students in — ™l—ss|

they ™—n e—™hh—ve their own ™opies of — pro˜lem test leD ˜ut only one ™opyis T ƒi‚D hs‚ig„y‚‰D exh psvi xewiƒ IS

ever stored on diskF ‚ewriting the le ˜re—ks the links to the other ™opiesD so

one user ™—nnot ™h—nge —nother9s les this w—yF st —lso m—kes it e—sy to ™re—te

—li—ses for les or for le treesF

„he m—ster le t—˜le is indexed ˜ytheinodenum˜ er from the dire™toryD—nd

the entry it sele™ts is — stru™ture ™ont—ining le —ttri˜utes @ownershipD prote™E

tionD et™FA —nd physi™—l disk —ddressF „he we—k p oint here is this single m—ster

le t—˜leX

 if it is lostD the whole le system is lostY

 it is — sp—rse line—r t—˜le of p erh—ps IHHDHHH to SHHDHHH entries in — l—rge

systemD so —™™ess ™—n ˜ e slowY

 it is not extend—˜leY on™e it lls upD the le system is fullD even if lots of

disk sp—™e is still emptyF

„hese issues h—ve re™eived ™onsider—˜le —ttention from nix develop ersF hupliE

™—te ™opies of the m—ster le t—˜le —nd frequent up d—tes to diskD plus in™re—singly

reli—˜le disk medi— —nd intelligent extern—l disk ™ontrollersD h—ve m—de the freE

quent le system losses of the p—st r—re to d—yF sntern—l memory ™—™hing of l—rge

p—rts of the m—ster t—˜le improves the lo okup p erform—n™eF xeither system h—s

yet ˜ een —˜le to de—l with the third pro˜lemY when it strikesD the only re™ourse

is — ™omplete rollo of the le system to t—p eD then — ™omplete system re˜uild

with —n enl—rged le t—˜leF yn — l—rge systemD this ™ould e—sily ˜ e —n —llEd—yjo˜

for the op er—tions st—F „o redu™e the likeliho o d of — systemEwide ino de t—˜le

overowD —nd to —llow for sele™tive le system ˜—™kupD nix disks —re norm—lly

™ongured into multiple logi™—l volumesD e—™h with their own ino de t—˜leF sf one

of these logi™—l volumes suers overowD —s long —s it is not the ro ot volumeD it

™—n ˜ e unmounted —nd re˜uilt without h—lting the systemF

hisk quot—s in nix —re m—int—ined on the ˜—sis of le ownership from limits

set in the user —uthoriz—tion lesD not ˜y dire™tories —s they —re on „opsEPHF

„he nix —ppro—™h is usu—lly more ™onvenient for — userD sin™e the quot— is

indep endentofthenum˜ er of su˜ dire™toriesD ˜ut it —lso m—kes it imp ossi˜le to

regul—te disk us—ge ˜y dire™tory —s ™—n ˜ e done on „opsEPHF

nix le systems tend to m—ke he—vy use of dire™toriesD whi™h ™—n ˜ e ™onE

fusing for new usersF wostD howeverD —dhere to ™ert—in ™ommon ™onventions for

n—ming of system dire™toriesF ƒee the m—n p—ge on hier@UA for —n outline of

the imp ort—ntonesF

T serD hire™toryD —nd pile x—mes

yn „opsEPHD — usern—me is used to form the n—me of the login dire™toryY user

ƒws„r h—s — login dire™tory €ƒX`ƒws„rbF nder nixD the usern—me is deterE U hi†sgi xewiƒ IT

Q

mined from — system —uthoriz—tion leD —nd need h—ve no p—rti™ul—r ™onne™tion

with the login dire™tory n—meF

e nix login n—me is limited to V ™h—r—™ters in lengthY „opsEPH usern—mes

™—n˜euptoQW™h—r—™ters longF

pilen—me length limits v—ry with the version of nixF yrigin—llyD len—me

™omp onents @the p—rts ˜etween sl—shes in the full n—meA ™ould not ex™eed IR

™h—r—™ters in lengthY the limit on the full len—me in™luding the p—th sp e™iE

™—tion w—s un™le—rF ‡ith RFQfƒhD —ny len—me ™omp onentm—y˜euptoPST

™h—r—™ters longD —nd the entire len—me with ™omplete p—th sp e™i™—tion m—y

not ex™eed IHPR ™h—r—™ters in lengthF

pilen—me ™omp onents m—y ™ont—in —ny ™h—r—™ters ex™ept x v —nd sl—shY

some versions of nix even p ermit nonEprint—˜le ™h—r—™ters in len—mesF sn

gener—lD use of nonEprint—˜le —nd sp e™i—l ™h—r—™ters is likely to interfere with

shell wild™—rd pro ™essing —nd p—rsing synt—xD so the re™ommended pr—™ti™e is to

restri™t len—me ™h—r—™ters to lettersD digitsD hyphenD —nd unders™oreF „ilde —nd

sh—rp —re used ˜y s™™s —nd some editors to m—rk ˜—™kup ™opiesF st is p erfe™tly

—™™ept—˜le to h—vemultiple p erio ds in — n—meY for ex—mpleD y—™™ ™re—tes — le

n—med yFt—˜FhF roweverD to e—se le p ort—˜ility to other op er—ting systemsD

you should limit yourself to one p erio d p er len—meD —nd —void mixed ™—se —nd

sp e™i—l ™h—r—™tersF

wost nix l—ngu—ge ™ompilers require xed len—me suxesD like F™D FfD

FoD Fp —nd FsF ixe™ut—˜le progr—ms —nd shell s™ripts ™onvention—lly h—ve no

len—me suxD m—king them indistinguish—˜le from one —notherY the shells —™E

tu—lly re—d the rst few ™h—r—™ters of the le to gure out whi™h of the twole

typ es it isF

pilen—mes ˜ eginning with — le—ding p erio d —re tre—ted —s hidden lesF ƒhell

wild™—rd exp—nsion do es not in™lude them unless — p—ttern ˜ eginning with —

p erio d is givenF „he ™omm—nd ls E— will show —ll lesD in™luding the hidden

onesF „ypi™—llyD su™h les —re used for providing progr—m def—ult initi—liz—tion

d—t—D su™h —s for loginD —nd for shells —nd editorsF

U hevi™e x—mes

yne of the gre—t strengths of nix is th—t the op er—ting system provides —

uniform view of devi™es —s lesD —llowing st—nd—rd sGy fun™tions to ˜e used

to re—dD writeD —nd ™ontrol ˜oth without reg—rd to the sometimes su˜st—nti—l

dieren™es ˜etween themF uernel devi™e drivers —re provided for e—™h of the

devi™es on the systemY devi™e xxx —pp e—rs to the user —s — le GdevGxxxF

hoing ls Gdev will list —ll of the system devi™esF GdevGtty is the st—nd—rd

n—me for the jo˜9s ™ontrolling termin—lF GdevGnull is the null devi™e|re—ding

Q

yn nixD the norm—l text le Get™Gp—sswd is m—int—ined ˜y the system m—n—gerF „hese

les list —uthorized usersD their en™rypted p—sswordsD group —nd user num˜ ersD login dire™toryD

—nd def—ult ™omm—nd interpreterF V vyqsgev xewiƒ IU

from it —lw—ys returns immedi—te endEofEleD —nd writing to it dis™—rds the

outputF yn — ƒun workst—tionD GdevGf˜ is — gr—phi™s fr—me ˜uerF

GdevGmt is the st—nd—rd m—gneti™ t—p e driveF ƒever—l p oints should ˜ e noted

—˜ out itX

 „—p es —re usu—lly —v—il—˜le —s — ’r—w4 devi™e —s wellD n—med GdevGrmtF

 wultiple drives —re identied ˜y tr—iling digits GdevGmtHD GdevGmtID FFFD

GdevGmtISF

 „he drive num˜er is frequently keyed to — def—ult t—p e densityD —s well

—s to —n —utoErewindE—fterEwrite fe—tureF gonsult m—n se™tion mtio@RA for

det—ilsF „his ˜iz—rre ˜ eh—vior is o ™™—sioned ˜yl—™k of supp ort in the kernel

for t—p e fun™tions whi™h ™ould p ermit sep—r—te ™ontrol of t—p e form—ts —nd

p ositioningF

V vogi™—l x—mes

nix h—s shell —nd environment v—ri—˜les whi™h —re somewh—t —n—logous to

„opsEPH logi™—l n—mesF „hey dier in two imp ort—nt —sp e™tsF pirstD their

v—lues —re —r˜itr—ry text stringsD inste—d of ˜ eing restri™ted to len—me stringsF

ƒe™ondD they —re h—ndled ˜y the shellsD —nd not ˜ythe nix kernelF

„his me—ns th—t they ™—n ˜ eD —nd ™ommonly —reD used for ™ommuni™—ting

—r˜itr—ry to progr—ms —t runtimeD whi™h ™—n o˜t—in their v—lues with the

getenv@A system ™—llF

e „opsEPH progr—m ™—n op en — le n—med w xqXpyyFfe‚D —nd the wonitor

will lo ok up the denition of the logi™—l n—me w xqXD whi™hmight ˜e —™h—in

of dire™tory n—mesD —nd prex e—™h one in turn to the len—me pyyFfe‚ until it

nds—v—lid le sp e™i™—tionF sn nixDevery progr—m whi™hw—nts this fe—ture

must h—ndle it expli™itlyD —nd there is not even — st—nd—rd li˜r—ry fun™tion to do

the jo˜F „he shells —utom—ti™—lly se—r™h the dire™tory list in the €e„r v—ri—˜le

to nd — le to ˜ e exe™utedF

‡ith ™shD you set — lo ™—l shell v—ri—˜le ˜y set xewiav—lueD —nd view the

list of ™urrent v—ri—˜les ˜y setF ‡ith shD the synt—x is xewiav—lueD —nd the

set ™omm—nd —g—in displ—ys the ™urrent listF ƒu™h v—ri—˜les ™—n ˜e used for

l—ter string su˜stitution in shell ™omm—ndsY wherever the string 6xewi is found

on the ™omm—nd lineD its ™urrentv—lue will ˜ e su˜stitutedF

„om—kev—ri—˜les —v—il—˜le to progr—ms whi™h —re run from the shellD they

must ˜e put into the environmentF ‡ith ™shD this is done ˜y setenv xewi

v—lueD —nd with shD ˜y export xewiav—lueD or for the dur—tion of — single

™omm—ndD ˜y xewiav—lueY ™omm—ndn—meF ‡ith ˜oth shellsD printenv will

displ—y the ™urrentv—ri—˜le listF W €s€iƒD sGy ‚ihs‚ig„syxD exh feguq‚y xh tyfƒ IV

W €ip esD sGy ‚edire™tionD —nd f—™kground to˜s

nix intro du™ed three enormously v—lu—˜le notions whi™hh—d previously not

existed in ™ommer™i—l op er—ting systemsF „hey —re the su˜ je™t of this se™tionF

„he rst of these is th—t every jo˜ h—s —sso ™i—ted with it three st—nd—rd

sequenti—l sGy stre—msX stdinD stdoutD —nd stderrF „hese —re intended for

norm—l inputD norm—l outputD —nd —˜norm—l outputD —nd —ll three —re —utom—tE

i™—lly op ened —nd —v—il—˜le for use when —ny jo˜ ˜ egins exe™utionD independent

of the progr—mming l—ngu—ge it is written inF

„he shells h—ndle —ssignmentof les to these three stre—msY if you do not

sp e™ify otherwiseD they def—ult to the ™ontrolling termin—lF „o redire™t themD

you just —dd — phr—se —nywhere on the ™omm—nd lineX

ƒtre—m ‚edire™tion

stdin `infilen—me

stdout boutfilen—me @overwritesA

stdout bboutfilen—me @—pp endsA

stderr ™shX 8filen—me @overwritesA

stderr ™shX 88filen—me @—pp endsA

stderr shX Pbfilen—me @overwritesA

stderr shX Pbbfilen—me @—pp endsA

st is frequently desir—˜le to merge the output of stderr —nd stdoutF ‡ith

™shD you use b8Y with shD you use Pb8IF „he p e™uli—r num˜ers used in the

sh synt—x —re —n o˜vious p o or designY they ree™t the f—™t th—t the op er—ting

system gu—r—ntees th—t these will ˜ e represented in system ™—lls ˜ytheinteger

le des™riptors H @stdinAD I @stdoutAD —nd P @stderrAF

„he se™ond imp ort—nt ™on™ept is piping|stdout from one pro™ess ™—n ˜e

’pip ed4 into stdin of —nother ˜y using the synt—x progI | progPY the verti™—l

˜—r is the pip e sym˜ olF €ip es —re oneEw—y sequenti—l d—t— stre—ms whi™h for

e™ien™y —re not m—teri—lized in disk lesF ‡hen the rst pro ™ess lls up the

pip eD it is susp ended until the se™ond pro ™ess empties the pip eF „ypi™—l pip e

˜uer sizes —re —˜ out Ru ˜ytesD —lthough this m—y dep end on the p—rti™ul—r imE

plement—tionF fesides s—ving on disk stor—geD pip es m—ke it p ossi˜le for — single

pro ™ess to ™ommuni™—te to —nother —n —mount of d—t— l—rger th—n the le sysE

tem ™ould ™ont—inD —nd they p ermit simple simult—neous pro ™essingF €rogr—ms

th—t tr—nsform their single input to pro du™e — single output stre—m —re known

—s lters D —nd most nix to ols ™—n ˜ e used th—t w—yF es —n ex—mpleD — simple

sp elling ™he™ker ™ould ˜ e implemented ˜y — progr—m whi™h˜roke — do ™ument

into — stre—m of wordsD with its output pip ed into — di™tion—ry lo okup progr—m

whi™h in turn e™ho ed ex™eptions to its outputF „his ™ould st—rt pro du™ing ex™epE

tions so on —fter st—rtupD inste—d of w—iting until — p ossi˜ly very long do ™ument

w—s ˜roken into wordsF snstru™tion pip elining is one of the imp ort—ntw—ys to

improve h—rdw—re p erform—n™eD —nd it helps in softw—re p erform—n™e to oF IH „i‚wsxev ƒ €€y‚„sx xsˆ IW

ƒometimes you w—nt to tr—p the d—t— owing through — pip eD p erh—ps to view

error mess—ges on the termin—lD or ™olle™t them in — leF ell th—t is required is —

progr—m th—t ™opies its stdin to its stdoutD —nd simult—neously m—kes — ™opy

in—leF „he progr—m @n—med for — „Ejoint in — plum˜ing pip eA do es thisX

progI | tee filen—me | progPF

„he third imp ort—nt ™on™ept is ˜—™kground jo˜ pro ™essingF ‡hen the shell

st—rts —nother pro ™ess running through the fork@A —nd exe™@A system ™—llsD it

norm—lly w—its for the pro ™ess to ™omplete ˜ efore re—ding more of its own inputF

roweverD if the ™omm—nd line is termin—ted ˜y —n —mp ers—nd @8AD the shell do es

not w—itD —nd the pro ™ess runs in the ˜—™kgroundD usu—lly —t — lower priorityD

while the shell immedi—tely resumes its input pro ™essingF „his is —n extremely

™onvenient fe—tureD ˜ e™—use it —llows the user to —void h—ving the termin—l tied

up while — long running pro ™essD su™h —s — text se—r™hor — ™ompil—tionD is in

progressF

‰ou ™—n even st—rt — ˜—™kground jo˜ —nd logoutD letting it run to ™ompletionD

providing you prote™t it from the h—ngup sign—l issued —t logout whi™h norm—lly

termin—tes —ll running pro ™esses ˜ elonging to th—t shellF „he @no h—ngupA

™omm—nd t—kes ™—re of thisY typ e nohup some™omm—nd —nd then logoutF

„he ™sh even —llows you to susp end —nd resume pro ™essesY the l—™kofthis

jo˜ ™ontrol fe—ture in e„8„ ƒystem s s s —nd ƒystem † nix is one of its more

serious —ws in ™omp—rison to ferkeley nixF

IH „ermin—l ƒupp ort in nix

„ermin—l ™ontrol h—s ˜ een — p erenni—l pro˜lem in every ™omputer systemD ˜ eE

™—use few termin—l vendors h—ve ˜ een —˜le to —gree on wh—t ™omm—nd sequen™es

should ˜e used to do the s—me thingD —nd even when they ™l—im to —greeD in

pr—™ti™eD devi—tions —re often foundF w—ny ™omputer vendors therefore tend

to only oer supp ort for their own termin—lsD whi™h n—tur—lly ™ost more th—n

™omp eting pro du™tsF

„he ferkeley nix develop ers h—d no su™h h—rdw—re ˜i—sD —nd ™hose the

’™orre™t4 w—y to h—ndle termin—l supp ort|they dened — termin—l ™—p—˜ility

d—t—˜—seD term™—pD —nd — set of utility progr—ms to supp ort itF term™—p on

most nix systems h—s entries for ˜ etween RHH —nd SHH termin—l typ esF

€rogr—msD su™h —s s™reen editors —nd spre—dsheetsD th—t use term™—p need

not ™ont—in —ny termin—lEsp e™i™ ™o deD —nd require only th—t the user m—ke

the termin—l typ e known to themF „his is done with the „i‚w environment

v—ri—˜leD whi™his™onvention—lly set —t login time ˜y ™omm—nds in the Flogin

leD p ossi˜ly —fter prompting the user to supply — typ eF por ex—mpleD s —m

writing this p—r—gr—ph on — †„IHH ™omp—ti˜le termin—lD so s just need to typ e

setenv „i‚w vtIHH if s—m using ™shD or „i‚wavtIHHY export „i‚w if s —m

using shF

fy def—ultD the d—t—˜—se le is stored in Get™Gterm™—p whi™h is not writ—˜le II iyp exh vyqy „ PH

˜y ordin—ry usersF „o —llow testing — termin—l des™riptionD you ™—n put it in

— lo ™—l leD s—y myterm™—pD then dene —n environmentv—ri—˜le to p ointtoitX

setenv „i‚wge€ GuGlogindirGmyterm™—pY —n —˜solute p—thn—me is required

hereF

ƒin™e the term™—p le is re—son—˜ly l—rge —nd therefore time ™onsuming to

re—d for every ™omm—nd th—t h—s to use term™—pD the ™onvention h—s ˜een

—dopted th—t the d—t—˜—se entry for the termin—l typ e ™—n ˜ e given inste—d in

the „i‚wge€ v—ri—˜le itselfF „his is —long ugly string whi™h you would never

typ e ˜y h—ndY the tset progr—m will do it for youF „he le—ding sl—sh in the

—˜solute p—th n—me for — priv—te term™—p leisusedtodis—m˜igu—te it from

—n —™tu—l term™—p entryF

II iyp —nd vogout

„he endEofEle sign—l in nix is gtlEhD r—ther th—n the gtlE you —re used to

in „y€ƒEPH —nd other op er—ting systemsF „o ˜ e re™ognized —s su™hD it must ˜ e

typ ed —t the ˜eginning of — lineF „he shells —re just ordin—ry progr—ms without

—ny sp e™i—l privilegesD —nd they to o —™™ept —n endEofEle sign—l —s p—rt of the

norm—l ™ourse of eventsD —nd when they get itD they termin—teF „his me—ns if

you typ e — gtlEh to your login shellD you —re logged outF sf you intended to do

th—tD wellD it ™ert—inly is qui™ktotyp e — single ™ontrol ™h—r—™ter —nd ˜ e logged

outF fut supp ose you thoughtyou were exe™uting — nested shellD or p erh—ps you

typ ed —he—d input to your own progr—mD —nd then ™ouldn9t remem˜ er whether

you g—ve it the endEofEle sign—lF qetting unexp e™tedly logged o is — nuis—n™e

in th—t you lose your ™omm—nd history —nd —ny environment ™h—ngesD —nd if

you logged in vi— — di—lup or networkD you h—ve —lso lost th—t ™onne™tion to oF

portun—telyDthe™sh oers — w—ytoprevent this unh—ppy —™™identY you just

set the shell v—ri—˜le ignoreeof to —n —r˜itr—ry v—lue @eFgF set ignoreeofAF

„he shell will then resp ond with ’ se 4logout4 to logoutF4 if you typ e in —

gtlEhF

IP gomm—nd eli—ses

„he fourne shellD shD h—s no ™omm—nd —li—s f—™ilityY if you w—nt to m—ke —n

—li—s for some ™omm—ndD then you must ™re—te — ™omm—nd s™ript le for th—t

purp oseF

™sh h—s the —li—s ™omm—ndY you ™ould typ e —li—s tdir ls Elt to m—ke

— ™omm—nd tdir whi™hworks likethe„opsEPH „hs‚ig„y‚‰ ™omm—ndF „his is

mu™h f—ster th—n ™re—ting — sep—r—te ™omm—nd leD sin™e no le system —™™ess

is requiredF ™sh users tend to he—vily ™ustomize their environments through the

—li—s ™omm—ndF e ˜—re —li—s will displ—y the ™urrent list of ™omm—nd —li—sesF IQ ix†s‚yxwix„ g ƒ„ywse„syx PI

IQ invironment gustomiz—tion

w—ny progr—ms in nix p ermit the user to provide def—ult st—rtup options in —

hidden le @one ˜ eginning with — le—ding p erio dAD usu—lly in the login dire™toryF

por ex—mpleD the login progr—m re—ds the Flogin le when you login to

the systemD just like the „opsEPH vyqsxFgwh le is pro ™essedF ƒimil—rlyD the

Flogout le is re—d —nd exe™uted when you logoutF ‚egrett—˜lyD nix h—s

no ™on™ept of groupEwide or systemEwide login ™omm—nd lesY this m—kes it

ne™ess—ry for e—™h user9s Flogin —nd Fprofile les to referen™e —ny group or

system les expli™itlyF

™sh re—ds st—rtup inform—tion from the le F™shr™Ythism—kes it —n—logous

to the „opsEPH gywwexhFgwh leF „he ™orresp onding st—rtup le for sh is

FprofileF „hese les —re the —ppropri—te pl—™es to insert your p erson—lized

—li—ses —nd environmentv—ri—˜lesF ho not put them in the Flogin leD ˜ e™—use

th—t le is not re—d ˜ysp—wned shellsF

im—™s re—ds st—rtup inform—tion from Fem—™sF

„he m—il progr—m h—s Fm—ilr™ —s its st—rtup leD —nd will —utom—ti™—lly

forw—rd m—il senttoyou to one or more —ddresses listed in the le Fforw—rdF

ƒin™e ww on „opsEPH is v—stly sup erior to nix m—ilDssetmy Fforw—rd le to

™—use —ll mym—ilon nix systems to ˜ e sentto „opsEPHF

sn order to use r™pD rloginD—ndrsh ˜etween dierent nix systemsD you

must est—˜lish — Frhosts le in your dire™tory with the prop er ™ontentsF ƒee

m—n rlogin for det—ilsF

IR qetting relp ynEline

ell ˜ut the sm—llest nix systems tend to h—ve su˜st—nti—l onEline do ™umenE

t—tionD mostly in the form of m—nu—l p—gesF „he origin—l nix do ™ument—tion

™onsulted l—rgely of fell v—˜ or—tories rep ortsD p—p ers pu˜lished in the fell ƒysE

tem „e™hni™—l tourn—lD —nd short ™omm—nd des™riptions form—tted in — uniform

synt—x for the printed m—nu—lF

„he printed m—nu—l w—s divided into V se™tionsD with se™tion I des™ri˜ing the

m—in user ™omm—ndsD —nd se™tion Q the op er—ting system interf—™eY the rem—inE

ing se™tions were devoted to more o˜s™ure ™omm—ndsD —nd system m—n—gement

to olsF xewer rele—ses of nix m—yh—ve more m—nu—l se™tionsD —nd sometimes

these —re further su˜ dividedY eFgF se™tion Qp des™ri˜ es the portr—nE™—ll—˜le opE

er—ting system interf—™eF nix do ™ument—tion gener—lly refers to m—nu—l p—ges

˜y n—me —nd se™tionD su™h—sls@IA —nd hier@VAF

„he les th—t pro du™e the printed m—nu—l —re stored in dire™tories GusrGE

m—nGm—nI XXXGusrGm—nGm—nV —s les suit—˜le for input to the troff typ esetter

progr—mD —s well—sforthenroff typ ewriter text form—tter progr—mF „he m—n

™omm—nd se—r™hes these dire™tories for the requested leD runs the required

form—tter on itD —nd displ—ys the output textF por e™ien™yD the output is —lso IS y€i‚e„y‚ƒD ‡riivƒD exh ƒ €i‚E ƒi‚ƒ PP

™—ptured —nd stored in — ™orresp onding dire™tory GusrGm—nG™—tI XXX GusrGE

m—nG™—tVY m—n —™tu—lly se—r™hes these dire™tories rst in —n —ttempt to —void

the form—tting stepF

m—n9s se—r™h order is ˜y in™re—sing se™tionD —nd it stops with the rst m—t™h

it ndsF „husD if you typ e m—n ttyD it will displ—y the se™tion I entryF „here is

—lso —n entry in se™tion R for this topi™Y to see itD you must typ e m—n R ttyF

ƒometimes there is — ƒii evƒy entry on — m—nu—l p—ge whi™h p oints you to

extended do ™ument—tion in —nother se™tionD ˜ut often there is notF

„o nd out wh—t m—nu—l p—ges might˜eofinterestD you ™—n typ e —propos

keywordDorm—n Ek keywordY this will displ—y the title lines of —ll les in the

m—nu—l dire™tories th—t ™ont—in the requested keywordF „his inform—tion is

—™tu—lly stored sep—r—tely in the le GusrGm—nGwh—tis to —void h—ving to se—r™h

— l—rge num˜ er of lesF

m—n m—n will displ—y m—n9s own do ™ument—tionF m—n R intro shows the

intro du™tory p—ge for se™tion RD whi™h™ont—ins — useful summ—ry of the se™tion

™ontentsF

sn desp er—tionD you ™—n resort to se—r™hing —n entire m—nu—l p—ge dire™toryD

eFgF egrep 4foo|˜—r4 GusrGm—nGm—nIGBF

IS yp er—torsD ‡heelsD —nd ƒup erE sers

ivery op er—ting system h—s some ™riti™—l fun™tions whi™h only ™ert—in privileged

users —re p ermitted to exe™uteF y˜vious ones —re shutting down the systemD —nd

—™™essing prote™ted lesF yn „opsEPHD these —re —sso ™i—ted with y€i‚e„y‚

—nd ‡riiv ™—p—˜ilities norm—lly restri™ted to systems p ersonnelF sn —dditionD

they —re not in ee™t until expli™itly requested ˜y the ixefvi ™omm—ndD —nd

they —re turned o ˜y the hsƒefvi ™omm—ndF elsoD more th—n one user ™—n

h—vesu™h privilegesD whi™h is imp ort—nt when the st— ex™eeds one p ersonF

nix reserves sp e™i—l privileges to — single login n—meD rootD —nd th—t user is

™—lled the superEuserF fe™—use op er—ting st— m—yh—vefrequent need for sup erE

user privilegesD the su ™omm—nd is provided to —llowsp—wning — new ™omm—nd

shell for root from — running jo˜Y —nyone who knows the p—ssword ™—n issue

this ™omm—ndF ‡hen the user logs out from this jo˜D ™ontrol returns to the

origin—l shellF „his org—niz—tion is unfortun—teD ˜ e™—use it m—kes it ne™ess—ry

for sever—l p eople to know the s—me p—sswordD —nd it do es not provide for —

distri˜ution of privileges —™ross sever—l levels of p ersonnelF

IT smp ort—nt nix „ools

nix oers — ˜ ewildering v—riety of softw—re to olsD —nd it is h—rd for — novi™e to

w—de through their m—n p—ges —nd determine whi™h—rethemostv—lu—˜le ones

to le—rn rstF es — little exp erimentD s r—n two ™omm—nds on sever—l dierent IT sw€y‚„ex„ xsˆ „yyvƒ PQ

nix systemsF „he rst ™ounts the num˜ er of ™omm—nds in the three st—nd—rd

dire™tories where system ™omm—nds resideX

ƒystem gomm—nd pile gount

qould „ˆEQP ls G˜in GusrG˜in GusrGu™˜ | w™Ew PVR

r€WHHH r€ ˆ ls G˜in GusrG˜in GusrGu™˜ | w™Ew PVI

sƒg RFPfƒh ls G˜in GusrG˜in GusrGu™˜ | w™Ew PWS

ƒun Q ls G˜in GusrG˜in GusrGu™˜ | w™Ew QHP

†eˆ RFQfƒh ls G˜in GusrG˜in GusrGu™˜ | w™Ew PVU

„he se™ond ™ounts the num˜er of ™omm—nds in the st—nd—rd lo ™—l —dditions

dire™toryY most systems will h—ve more th—n one of theseF

ƒystem gomm—nd pile gount

qould „ˆEQP ls GusrGlo ™—l | w™Ew IHU

r€WHHH r€ ˆ ls GusrGlo ™—l | w™Ew T

sƒg RFPfƒh ls GusrGlo ™—l | w™Ew RP

ƒun Q ls GusrGlo ™—l | w™Ew TH

†eˆ RFQfƒh ls GusrGlo ™—l | w™Ew ITP

sn summ—ryD there —re QHH to RSH dierent ™omm—nds on — typi™—l nix systemD

not ™ounting the few dozen ˜uiltEin shell ™omm—ndsF

rerethenis—listofthe„op „wenty ™omm—nds you should le—rn rstY those

ne—r the st—rt of the list h—ve higher priorityF

 m—n —nd —propos | get help

 ™sh or sh | ™omm—nd shell

 more or less | p—ge through ™omm—nd output @—utom—ti™ on newer nix

systemsA

 ls | dire™tory listing

 ™d —nd pwd |™h—ngeGprint ™urrent dire™tory

 ™—t |typ e or ™opyle

 ™p |™opy le or dire™tory

 mv |move @ren—meA le or dire™tory

 mkdir |m—ke — dire™tory

 e™ho |™he™k shell ™omm—nd line exp—nsion

 em—™s or vi | s™reen editors

 m—ke | ˜uild softw—re IU p ‚„ri‚ ‚iehsxq PR

 grepD egrepD fgrepD ngrep | string se—r™h

 sed | —utom—ted text editing

 —wk | text pro ™essing l—ngu—ge

 —r —nd r—nli˜ | sour™eGo˜ je™t li˜r—ry utilities

 | sour™e ™omp—rison

 s™ript | log termin—l session

 rm |remove @deleteA le

 rmdir |remove @deleteA dire™tory

‡ith this rep ertoire of — s™ore of ™omm—ndsD you should ˜ e —˜le to work quite

su™™essfullyF xote th—t not — single ™ompiler is listed hereY m—ke ™—n h—ndle th—t

for you for simpler ™—sesF ƒe—soned nix users v—lue m—ke highlyD —nd —sk it to

dire™t mu™h of their routine workF

IU purther ‚e—ding

ƒun provides—num˜ er of feginner9s quides whi™h —re useful for new usersX

 qetting ƒt—rted with nix

 ƒetting p ‰our nix invironment

 ƒelf relp with €ro˜lems

 ‡indows —nd ‡indow f—sed „o ols

 w—il —nd wess—ges

 hoing wore with nix

 sing the xetwork

 q—mesD hemosD —nd yther €ursuits

„here —re now — gre—t m—ny intro du™tory ˜ooks —˜ out nix on the m—rketD

—nd you m—y wish to p eruse lo ™—l ˜ o okstore shelvesD or ™ome —nd ex—mine my

p erson—l li˜r—ryF rere —re some whi™hs h—ve found p—rti™ul—rly v—lu—˜leX

 w—uri™e tF f—™hD „he hesign of the nix yper—ting ƒystemD €renti™eEr—ll

@IWVTA ‘—dv—n™ed denitive tre—tise on the intern—ls of nix“

 fri—n ‡F uernigh—n —nd ‚o˜ €ikeD „he nix €rogr—mming invironmentD

€renti™eEr—ll @IWVRA ‘— must for every serious nix user“ IU p ‚„ri‚ ‚iehsxq PS

 w—r™tF‚o™hkindD edv—n™ed nix €rogr—mmingD €renti™eEr—ll @IWVSA ‘—

must for every systems progr—mmerD or p erson writing ™o de whi™hmust

run in — v—rietyof nix implement—tions“

 u——re ghristi—nD „he nix yper—ting ƒystemD ‡iley @IWVQA ‘—n intermeE

di—te tre—tmentof nix to ols —nd intern—lsD without the det—il in f—™h9s

˜o ok“

 e„8„D nix ƒystem ‚e—dings —nd eppli™—tionsD†olumes I —nd PD €renti™eE

r—ll @IWVUA ‘— ™olle™tion of reprints from the fell ƒystem „e™hni™—l tourn—l

of key p—p ers on the development —nd evolution of nix“ sndex

e h

ehoD eF†FD I devi™e n—mesD IRD IU

esˆD P dire™tory lesD IR

—li—sesD PI dire™tory n—mesD IU

—proposDPP dire™tory p—thD IQ

—uthoriz—tion lesD IT disk quot—sD IT

h‡fD P

f

i

fD P

environmentv—ri—˜lesD IV f—™hD wFtFD PT

iypD PI

˜—™kground jo˜sD IW

iˆigD P f—™kusD tFD Q

fg€vD P

fell v—˜ or—tories rep ortsD PP

p

fell ƒystem „e™hni™—l tourn—lD PPD

PT

peldm—nD ƒFsFD I

ferkeley nixDPDPH

le —ttri˜utesD IT

˜ o oks —˜ out nixDPS

le gener—tionsD IQ

fourne shellD PD PI

le referen™e ™ountD IS

fourneD ƒF‚FD P

le system rolloD IT

fƒh @ferkeley ƒt—nd—rd histri˜uE

le tree ™omp—risonsD IQ

tionAD P

le tree org—niz—tionD IQ

len—me length restri™tionD IU

len—me sp elling ™onventionsD IQ

g

len—mesD IU

fo otnoteD IQD IU gD P

portr—nD ID PP

™—se distin™tionD IQ

pujitsuD I ghgD I

ghristi—nD uFD PT

™omm—nd shellsD P

q

™orresp onden™e ˜ etween „opsEPH —nd

nix ™omm—ndsD S

g—me of the n—meD P

gr—yPDI

gener—tionsD IQ

gtlEhD PI

™urrent def—ult dire™toryD IQ

™ustomiz—tionD PP

r

helpD PP

PT sxhiˆ PU

hier—r™hi™—l le systemD IQ x

rywi environmentv—ri—˜leD IR

n—me of the g—meD P

roneywell qgyƒD I

nroffDPQ

r€ ˆD P

y

s

onEline do ™ument—tionD PP

sGy redire™tionD IW

op er—torD PQ

sfw QTH seriesD I

sfw €gD I

imp ort—nt to olsD PR

€

inode t—˜leD IS

p—rent dire™toryD IS

€e„r environmentv—ri—˜leD Q

t

€gvD P

€h€EIID I

tohnsonD ƒFgFD I

€ikeD ‚FD PT

toyD ‡FD P

pip esD IW

€yƒsˆD P

punD P u

€‡fD P

uernigh—nD fF‡FD ID PT

uleenixD P

‚

uorn shellD Q

re—ding —˜ out nixDPS

‚iehwiDIQ v

ren—ming dire™toriesD IS

linked lesD IT

‚it™hieD hFwFD I{P

logi™—l n—mesD IV

‚o ™hkindD wFtFD PT

logoutD PH{PI

ro otD PQ

w

ƒ

w—kefileDIQ

shell v—ri—˜lesD IV

m—nDPP

shellsD P

w—ple —lge˜r— systemD P

short ™omm—nds|whyD Q

w—rg—yD P

sup erEuserD PQ

m—ster le t—˜leD IT

sup er™omputerD I

memory ™—™hingD IT

ƒ‰ƒX logi™—l n—meD Q

wsgD P

system —uthoriz—tion leD IU

wi™rosoftD P

ƒystem s s sD PD PH

wulti™sD P

ƒystem †D PD PH sxhiˆ PV

„

teletyp eD Q

„i‚w environmentv—ri—˜leD PH

term™—pDPH

„i‚wge€ environmentv—ri—˜leD PI

termin—l supp ortD PH

„hompsonD uFD I{P

„yhyDIQ

„op „wenty ™omm—ndsD PR

tree stru™tureD IQ

troffDPQ

xsgyƒD P

usern—me length restri™tionD IU

usern—mesD IU

„ˆEQPD P

†

†enixD P

†enturegomD P

†ersion TD P

†ersion UD P

†ersion VD P

‡

w—rtsD I

‡—terlo P

‡ein˜ ergerD €FtFD I

wheelD PQ

ˆ

ˆenixD P