You are on page 1of 89
A Quick Reference for the Rest of Us! by Margaret Levine Young and John R. Levine “Inver reaied UNIX was, to loa until UNDX For Dares!” hg i ac P Vk Caf € Looking for a fun, fast, and © sree. pc terired wa covwuren ser seme oncom pe Beginning to * Steals sassusa 51135 anda (1599 UK Bre Anditsccs referenced 1 UNI Far Duns fo Damo vice ef and Fr Daas books ae awalableon ll yout avorte o otsoavoite ha products Look or thes F i 4 ‘i : e e e tem nt | Acinovtdomens Sencopngecio UI rights reserved, No ‘ata as ot ny beeper trated any ry {Reo acti nocpynrecrng oer) out he ere Cater nog angby Wooton My-Lidn meth and Reena anwar Pulser inthe oe 10 purchase IDK Books outside the US. orem on ato cote ac rey Mie, Foren ‘i Manager ot DG Books Wonkwide: PAK NUMBER 4153581250, Lantos mpeg tak Bc ore temerity cn yes, Gamage, including bt x ted to spec ode, consequent ear ore names thar repeciee holies BORA ‘Word ist ssocated with any produto vendor men ie {REID ia ademas of DG Books Workwie,e The authors would ike to thank Jordan Young, Lyla Spitzer, Meg Young Steve Emer ich and the entre gang at Lenngton Playeare Center especially Cate Rachel Belge, Terie Chris) or thee support in writing this book We sso warn acknowledge Becy Whitney lor her ine etng job end eed Grieshop or her sharp prootreading eye |n addition, we have enjayed and appreciated the feedback we've otten from readers ol CREX For Dummies Ityouhiee coceseane ‘bout this book, be sure to emall us at dumiiesBune con ‘The publisher would ike to give special thanks to Patrick ‘McGovern, without whom this book would tas Nave bee possible Publisher Managing Editor Mary Bednarek Acqusions Edtor Sanna Cuter Production Manager Bath Jenne Senior Eators Tracy Bare Diane Graves Stele Production Coordinator Cindy Phippe Acquisitions Assistant Meg Bonar ioral Assistant Patricia Reynolds Project Eator Technical Reviewer Sharon Potter Newsome ‘Shery Goma Gina Ste Sandy Grieshop e e@ Say What You Think! 'Usten up, al you readers of ID's international bestsellers: the one — the only — absolutely world famous For Dummics books! es time for you to take advantage ofa new direct pipeline tothe authors and editors of IDG Books Worldwide. In betwee putting the finishing touches on the next round of For Dummicsbcka {he authors and editors of IDG Books Worldwide ike tostt acoged and mull over what the readers have to say, And we low ten you readers always say what you think So here's your cheney, \Ne'd really tke your input for future printings and editions of his book and ideas for future ..For Dummies titles as well Telos shat {you tiked (and didn ike) about this book: How about the chapters You found most useful —or most funny? And since we know etre ‘ot abit shy. what about the chapters you tink can be Improsed? Just to show you how much we appreciate your input, we'll add Yyou to our Dummies Database/Fan Club and keep you up to date onthe latest. For Dummies books, ‘ews, cartoons, calendars, and mote: Please send your name, address, 8nd phone number as well a8 your comments, questions, and suggestions, to.our very own For Dummies coordinator atthe following address: For Dummies Coordinator IDC Books Worldwide 2250 North Post Road, Suite 140 indanapolis, IN 45226 SSH Coes via tere reat ta a For Dummies coordinator SE ioectetmg tans IDG Prssemention te nan ot BOOKS bo comments ‘Thanks for your input! Caco John Levine and Margaret Levine Young were members of computer cub inhigh achool (tis was belor high school students, or evea high sols, hha computers) They came contact with Theodor H. Nelson the author [tComputer Lib and the uventor of hypertet who fostered the Wea that ‘computers should not be taken seriously. He showed them that everyone ‘an understand and uve computers Joh wrote is fst program in 1967 onan IBM 1130 (a computer roughly 2s powerful as your typeal moder digtal wristwatch — only more ‘ica to use) is rst exposure to UNE was while hanging out with Iriends in Princeton In 1974 he became an oil UNDX system amis torat Yale in 1075 John began working parttime foe nteracive Systems, the first commercial UNDCeompary In 1977 and has been in and ou ofthe UND blz ever since. He used to spend mast of his ume wring sotware, but now he mostly wrltes books becase is more un. Healso teaches $ome computer courses and publishes and ets an incredibly technoid fnagarine called The Joural oF Language Traraation He as aB.A and a PhD. in computer science rom Yale Unversity Margy hasbeen using small computers since the 1970s, She graduated from UNDX on a POP/TI to Apple OOS on an Apple to MS-DOS and UN fon variety of machines. She hae done al nds offs that involve explaining to people that computers aren't as mysterious as they ight {hin including managing the use of PCs at Columbia Pictures teaching ‘Sent and engineers what computer re good or, and wring ‘omputer manuals shehas been president of NYP, the New York PC Users Group Margy has writen several computer books, including Understanding neck PLUS Gio soo ote part off) and The Complete Gul fo PCF Se has a degree in computer science War Yale University. ede ee ‘Welcome to the word aD Books Worldwide ‘Ste ote nna Ge, ews ‘paternal Secs Su oy on opera ‘more IDG publications each month. ae peoplesead one (safe prc eriaas emegc (igen pares i a Sct er ae re ‘Sc) een treme op ba aha 1 DG book sve orig etre ae ad slung nstton othe ‘reader. Our book are writen by experts, wth te backing IDG pores ‘nih ciel hough devote ance ch sun efor desi. se ol cons and tastratons. Our editorial stl acres a ghee Ioumalsts ad experienced took people Our les cmt wh the makes of ‘aur products hes esure accu and tharcagh coverage. Gur hen ie of sna comput every step inprodcton mean we candle bos cere eor an eens ease oar meaneees ae ‘Wen you have to type something, It appears ke this: terribly important UNIK comand Be sure totype jus ast appears. Use the ste capitalization we do, ‘because UNK considers the capital and stall versions of the sae tier tobe totally diferent beast. Then press the ater or Return key Inthe text, UND commands and flames are shown in this typeface. Parl contains acryptie“UNXspea” verson ofeach command that shows alls options and argument. normation n bold sreqtred when youre using the command. tl n (square brackets] is optional so try leaving i out. Tet in ales represents information You provide: you se flename, or example lin the name othe ile you want o work wth. Don't worry, we explain tal Introduction Part I: Using the Shell Part I: UNIK Commands Part MI: Using Mot Part IV: Using Text Editors Part U: Sending and Receiving Mail Part VI: The Network .. Index .. Atlast— a UNIK reference book that ncles only the commands nd options you might concetvably have some interest at nts book you wil ind information about ots of UNDE comma more than 100—and how to use them, Bu we have lel out the ‘ther 10 ation commands options tat only nerds love We have also inciued intonation abost several widely used pars of UNK: the Meu window manager: the ed, 11 and sas tent editors electronic ma and networking Do fp through lots of diferent, confusing manuals to ind that command you are ooking for jst checkout the relevant part of tls book How to find things in this book This bok vied io scsetons sth yo can hing fat Part, “Using the Sell” hs information about how to type ‘commands, ame fies and dretores, and use pipes ad ers Pat “UND Commands,” contains our favorite 100 or 30 UND. ‘commands, with the option you ae tel to use We howe Included examples and warnings when necesary. Parl, “Using Moni” was weten for people who use UNX's most popular window manage. Part, "Using Text Etrs” contain command summaries for teed vivandemses editors Far V, Sending and Receiving Mall has instructions fo using ‘the etn anda? programs to handle your electronic mall, Part Vi “The Network," contains commands for accessing, computers ona network The cast of icons For each command we describe — and whenever we prove other important information — we nce eons that el yo bout what you are reading vad m. For Dummies Quick Reference Recommended for your average UND user, Not recommended for your average UN user. Not stable for your average UNIX user, bu you may have to use You cant do any real damage wi sell but you could do sme damage by accident. Potenily dangerous but sometimes necessary Try to stay away trom this command, or got a UNDX wizard to review what you plan {odo before you doit Ati that can save you tine or impress your local UNIX gun Watch out Something about his command or task can make trouble for you, ‘Acommand or task that is useful i your computer ls connected toanetwork Wot dn use [Ahandy cross elerence othe sections in UNDX For Dummies that over this topic in more deta ‘A command that doesn't wor n BSD UN you use UN. System V. you aren ick ‘A command that works ony In BSD UNDE. you use UNX System Vip this command The shell prompt (ae) Using the Shell ‘We tart rom te outside, so the shel sounds ke a good place {begin (this statement makes you think that UNIX resembles, sninsect only nota attractive, we think elon the sane ee The sels the program that reas your command and doce Something wit them, (How's that fr presse technical an ‘age! Sc diferent sells ar lurking around but forte most Dar they do the same thing Unless you're the vetn — er, beneticlary —ot a Fay Win dowed Graphical User inerlace, the onl way to get UNDE to do Something isto type commande att Here, we discuss what commands lok ke and some general rule that apy al ‘commands. Even you have an FNCU you wl et op pg shel commands into a window, so you need some sel smarts 'nyway (To use the most popula FWGLI~ Moti see Pat} ‘The sel tel you that t's ready for yu to type a command by playing a prom string. usualy s percent sug or the Shelland a dolla sign (3) forthe other tells. Some syste re Set up with more complex prompts, including the trial mae directory name, phase ofthe moon, and ahr foe <0) Commands consist of series of words, fllowed by pressing He Enter (or Return) key. The fist word the name of he com ‘mand, and theres are agurents that alec the way the comand ‘works ithe command te remove ales rn for example arguments specty which ile to remove. One space between ‘words s plenty, although more wont hurt Upper and lowercase eee OD Met characters and what they do leters defintely do matte. Al standard UNE command names ae lowercase so you genealy type commands in lowercase More stuff S Rear ce ee ‘Nearly every punctuation character means something special the shel, Unortunately the exact characters vary ram ne ‘System to another (You can ese the sty command to change these characters; see the entry for sy i Part) Th section resets a roundup ofthe mos useful special characters ‘Commands can be as long as you want you type a command that doesn ftom line, fst kep typing and UNIX wl continue ‘on the net ine. may lok Ike two ines on your screen, but Unt you press Enter, the compoter thinks tha its one ne For mor information abou typing shell commands, se “Finally ‘You're Ready to Workin Chapter of UND For Dares, Cherecter What It Does Enter Ends aline you're typing or Return Space Separates words in commands ortab Backspace, Backspaces over erors. none of those characters Delete or works ty anduse sty to change to some Cutt thing le sou preter). ‘Separates two commands on the sane ne, Whoopee « ‘Altera command, tls the shell torn that com- tai inthe backround and return ned for {nother command. See b9,79,and e111 in Sect ir comming rama) A pir ol ampersands (28) an obscure fray to pevlor the command lowing the sk only {the one preceding the Ab sucenede ' Between two commands splice the outpat ofthe frst command tothe npt of the second, cresting & Dipelne ce the secon “Redirection pipes and ‘ters” later inthis part) A pal of verteal bare) 'Sam obscure way to perirm the command fallow Ingthe | only ithe oe preceding the I! ald © spc ttn tty | Character 28, and {1 oO cn cutu orci ane What Ie Does Inthe C shell only, repeats «previously typed command dented by wha follows the "Other than! which repeats the preceding comand, avoldeiclamatin pont. Waatever follows ia comment the shell ignores, Atte end of ine, neates that the command is continued onthe net line, Anjvhers else, “quotes” Ue following character so that lt it rested as special character (ae the section "Quang chara ters onthe command ie” ate nhs pr “Quotes a proup of characters so that they arent weed as pil characters (ee “Quoting charac ters onthe coms eit n thts par) Introduces a reterence toa variable. See “Shell Varlables andthe environment ltr ti pat Wikcard characters 2c the Wildcards" setion Intern this pa). ln the Korn and Bourne shel, group together ‘ommands you want to trata. single command ‘Theyre kind of obscure and are wsed most often for redirecting the output of bunch of commands (ee the section "Redirect: pips and fiers later in spat). On second thou forget about ther, Inthe Bourne and Korn shells group commands sort fe parentheses. Not widely use except maybe in shell serps, ‘Stops programs that are stuck posible, use the Drogran’stex!t command or the equivalent Some Drograms, particulary teat editors, cate CLC and ‘nai for you to type another command tothe Program. You can als try pressing the Delete key, Ides work as a backspace Marks the end of input when you're yping rectly to program. Canoes thetine you're typing an starts ver. neither of those work, ry (and use S11) to change tt something more nal). Pauses the program you'r runing. Then use the shell commands 12,09 and kl 0 restart ot Stop them. Your shell hs to kxow how to handle az; some older shes don (Se the ents for the f9,03.and k11T commands in Part IL) @ iM..; More stuff S you dont want to remember al this punctuation lop, just don't use special characters n our sbll commands'To use ther In commands as though they were normal characters “quot” them (Gee "Quoting characters onthe comand line ltr tn hs par), Most shells interpret CUrLD asa comman to og you out So don't Dress when you se the shell prompt, To terminate te program {youre running. try Cui or Delete tate nat backspace). ‘Even though your keyboard has arrow keys and the cursor moves sit should wien you press them, the only UND programs tat Understand them are ubscreen text editor. Anywhere elt Drodceuseless junk ke "TC OE (BCC Don't conuse the Backspace ky, which usually works everywhere ‘wth the lt aero key, which works only in flrereen editors, For information about using Ce, see the section “The Magi of Job Contr” in Chapter 15 f UND For Dummies Permanently store information in UNIX is stored ines. Each ile hha a name (each one can have many names infact, but well worry about tha iter eee the In entry inPart You can use lters, igs, periods, hyphens, and underscores in your names. (You can se other characters aswell but sik to these to avoid contusion) Upper and lowercase are dierent, so tadpole, TadPole.and TAOPOLE are thre diferent frames, Don't use weld characters in lenames, such as any ofthese: rreesrer- cre tre ‘so, dont use spaces in enames. Most programs dott you may. Use periods or underlines to sng wore opt Cr 4 16) ‘Aircon i. special kindof le that contains the names of other les All UND es are arranged in crctole. Atany given moment, one directory your cuent directory (or working directory) oes you are usta right now, When you st login, your curent directory is yout home aero or lin. tet), which the system administrator made fr You Wildcards @ ‘You can-— and wsualy should — make other directories in which tore files fr varous projects. You can switch tother irectories with the chido 3 command, make new directories with nk rand get dof directories you no longer want with "ir (Gee the entries for these comands in Pat More stuff Inthe Cand Korn shells the name - (de is shorthand for your Some decoy yourhate dreciory is /uer/ele's tre 8 ‘See “What Is Directory” in Chapter 5 of UNIX For Dummies. ‘swith lenames, you can use upper and lowercase eters ‘igs. periods, hyphens, and underscores in your directory ames! Upper and lowercase ae dierent ‘Agood rule of thumb sto use all lowercase fr files and use —C) ‘A patiname tals UNIX how to find the particular ile you wat you use a plain flename (tp 01, for example), UN under Sands ita ale athe curren rectory. You refer t lesa ther dectriesby ting isto ames strung togeer wlth Slashes. The name stachs/tadpale means talookin the ‘current directory fora subdirectory called snacks and ora ile ‘aled tadpole: This system ean be erred t ult tents: snacks/vertebrate/green/crunchy/wiggly/tadpole the path begins with a sleh ts an able pth one that stars rom the root of thee system. typial abut pat is ‘usr/elvis/ songs hound_dog. An abeoke pth aways means ‘he same thing regards of what your curren eiectry See "Divide and Canquerin Chapter 5 of UNDX For Dummies. Cc ad es i) 2) Often, you want to have command operate ona gro of tes wth sina names. The shel lts you se special wildcard ‘characters to speci a group of les. This Ist shows the tree Drnary kinds of widcarae BY Arg characterson the commandline Character What Ie Does ? Matches any singe charcer : Matches any number of characters 0 Matches any oe of teeters inthe brackets More stuff S For example, )* indicates all the les inthe current directory that begin with an "9 inleates ll the les that Begin with h land end with part {1231 indicates fle named por, par, and prt part 6 3) indates al par through part and" Inalates every lente dvectary. atte sme cheesy PC systems, UNK wildcards do the right thing ‘even when you use drectories For example, */*¢ means a es thot end withthe eter cn subdectries ol the curren iectory Wildcard are handled by the shel sl ot by the command You are running The good news s that ll commands handle Wildcards inexact the eae way you dat haveto remember that ome do oF some don't. The bad news that even when part ofa ‘command snt a lename,ithae stars or question mati ot brackets, the sel res to make lenames cat of ness You uote (Gee “Quoting characters onthe command ine” te isp). snot sways easy to know how wildeard wil work Bere doing omething dangerous with them sich ae deieting a bunches, se the = command to see which ilenames your wideards match, ‘See Wild and Crazy Wildcards in Chapter 6 of UN For Dummies. ee ed Sometimes you have to use special characters in your commands. For example, tls lenses hat havea question mark in them, {You need el he shell thatthe question mark you are png ‘Should nt be interpreted as a wildcard character. This scaled ‘quoting the character You ean quote an sigle speclal character Ieluding a space by preceding with a backslash (\), You can ‘even ype \\ to quote abacslash, Fr example, this command iste fenames that contain a question mark ise More stuff Sine and double quotation marks quote strings of characters ‘They must match correct Single quotes are somewhat mare “Potent” than double quotes Everything between oll ques istaken tray even backslashes, wth the following caveat * Wilear characters suchas" and? retaken ter that dont mach pou enmen Y + Dotlarsin variable names are replaced by thee vales + You can quote double quotes in single quotes and vce versa Gay that thre tmesiast) = MASP To display thetext “Too #821: sreen, you can use 20h ke tis echo “Too #481) much punctuat ion! te last character on lines a bacslash it means that the ‘command coatines on the nest ne Se) Every UND command as standard int and standard ou tare normaly the terminal. You can el the el to eect, ‘hemp or out fay command. Character What be Does Redirects outpot ofa command toa ile or device Redirects the output ofa command adding ito the exiting le there tone Redirects input of command from ie or device. Sends pipes" the output of one command to ‘become the input of another command More stuff For example, to storealiting of les itomy 1, type this ine: Is -1 > myfites 2) Redirection: pipes and filters a | do a Cae Rr © 3 shell am I using? append the isting tothe edo an existing fle: Ts -1 >> myfiles To sot the contents of the le mya. and send the results othe Tosort ay et. and produce mysorteddats: Sort < mygata > mysorteddata You can redirect the output of one program into the input of another by sing a pipe which is wrten as vertical bar ()-To make se lstng an send it to the printer 1s -1 | tp You can pipe together as many programs as you wat. To make a fle isting ad headings with 3 id print the result 1s -1 | pr -h ny Files" | 1p Programs that ae usually used wit redirection ae called ters ‘Thelters you are most likly to run into are moe, sors and maybe tee (Ge tet entries in Part I). ‘See “Tis Outputs Going To Havana Redirection” and “Gurge, ‘Gg: Running Data Through Pipes in Chapter 6 ol UND For : 2 C) To figure out which shel you're using, type the allowing line ‘echo SRANDOM and then press the Enter key. you get a blankie’ the ‘Beare sel you get the folowing ne: RANDOM: Undefined variable its the C shell you gta Sgt random number, I's the Kom Shel See the section “Cracking the Shell” in Chapter 2 UNIX For Part II UNIX Commands ‘Yuck — commands! iit werent or commands, UND woulda be ‘hat hard to use really But grep? avi ?'Tese words doa eek lke commands ~ they lok ike intestinal nae! you use UND. however, you have to se UNIX commas, UNE. has lions of them, and we have selected jst te oes that oe *+ You might want to ust yourselt * AUN expert (also known a gun) might tel you to use Ether way, you have to know how they work, what to type, ad Which takes to avoid. Ts part of the ook ts te est Useful UNIX commands, along with the options and arguents they expect Oops sorry abou that argon: Opions and arguments are te information you type onthe comand Ke, ‘igtalter you type the command: Some commands cas werk in 17 ailerent ways depending on the options you we, so welll ‘youabout jus the ones you re key to run into. We ls include cute tle cons to tll you which types of UNKK {he command works with, whether its afeto use Gwhethet W' likely to erase your disk, and how lel you ae to have A ‘he eons and thelr meanings ae listed athe Introduction f this book) For each command, we include a “UNKpeik” section, showing allth option and arguments you might have tous ats Section, Information abode required when you Te wang the ‘command, tll in {square brackets i optional so you can ‘sual leave it ot, Text in dates represeats information you rove: for example, where you se lena you flit the mane ofthe te you want to work wth (dot type ilenome", a a alias (Cand Korn sels only Creates an alia ora command or shows which aliases ext UNIXspeak (C shell) altas Coane [ conmand'}} UNIXspeak (Korn shell) atta. Cname=(" comand") pine Argent Fein —e Spe te an name Command Specie te cman he name Soke aor Sample | You ae sik of typing a long UND command you use often. tad, you wa to assgn ta shor lckrame, ras, which i erotype, You are red oftyping |, fr example, and ‘would rather os typed to se the sin your directory you use the C shell you type alias d cs -1" ltyou use the Kor sell you be alias des 1 [ther way, you have just crested anew command, which is the fame g's 1-This command cool although the next ime you login, UND wit have lorgotten all about this alias. More stuff To see which aliases you have defined, ust type aiias See the section “Using a las" in Chapter 1 of LN For Dum ims, Tomake anal peranent ato a UNE ward bout Putin the 8108 command into your rot Yeor «10g fe {any ward worth her sat knows wht hs statement means), Or {evthe instructions nthe section “Do Have to Type the Same ‘Tings Every Time Log ln n Chapter 28a UND For Dummies : «@ Sete command tbe ata pater ine This ‘et asinthe mice ofthe might ne ommands te, @ UNIKspeak AE CF Fitenewel Cm) etme (aace} aa Cption or Argument Fanevion A flename ‘Species the name of the ile that ‘mands) to run E score mireonnyernnranen emai rea siocumgiem inmost Soifemnci ate ee Sesion dels Sr : tfc om pace Option or Argument Function “Kb sieht One conn ie ypeite eb umber aherTo mama name athe pica ced Sample ‘You want to print «huge document during the night (You dont ant oe up the pinter because you are the soul of consider aon) You pe at midnight Alter you press Enter, UND doesnt dep a prompt. stadt ‘waits for you to type the command (or commands) you want to Fun at midnight. You type pr big.report Mer pressing Enter agan you press Ctr. to tll UN that you fre finied typing commands or 8 to schedule, Now you have ‘eheduled a job More stuff Ate you have scaled nob you can ck tha thant trate tatoos 7 T ou sea sof your sched ob, wh throb numbers Jeane et eter edn the fb ose mabe Busou) seuype at or 7534603002 Your system sisratr can control whois lowed tous ot SesReten tpt on tet sl you when yout meses you kee ec oe ou can our on theta For mor information, see the section “Tine ls Money — Steal Some Today in Chapter 13 of UN For Durmies. % a @) ©) a P18) ‘A strange programming language uted by UNDX nerds to perform fevamazing ary of asks, Cancels «command gob) you prev «@ UNIXspeak ak -f program File Option o Argument Function program Species the name ofthe awk program torn Gon even think bout learning towrte them yoursel, unless you want to become a nerd) te Specs the ame ofthe file you want to moat by using the suk program, ‘orthat serves as put to Saimple Programs writen nook usualy read oe fe (the np) ane azeate acter le he oped you keep your cheek na ie fr eagle oe check alist ea) (aa, anyway) 1 whip up program ta conpute i cavers More stuff (ter verano kage aed nk and nah Thy al work soc ores the same i you wa to este Jour own ak Programs, read a good book about t, suas Oly esc Sey sed out Oy Dale Dougherty soles ‘Ahandy-dandy desk caleulatr. UNIXspeak be (ited Opin Argument Function | ie Spee ts nae faa tbe ommands you vant only st Stew umber eve ot ts open @.e@ Sample More S bg You have just aed your bots nt spending $500 on a beaut {ul UND workstation for you. Alter you ttl he stop by ‘your desk al about budgets, rd you ave toad up afew gute. magne how embarrased you woul be your expensive ‘ew toy coulda’ sum few numbers! No problem you Pe {UMD int usta taiturn way says noting You type 4500 * .67 to calculate a qulek discount, Whew! De dplays the answer. ‘Wien you are fished doing caleuatons, you press CUD or ‘ype quit stuff ‘The be caleulator can do an unbelevable number of comput: tons, including square rots, trigonometry and conditional ‘aeulatons, ad converting between hexadecimal ora nd ‘decimal numbers alto uttreds or thousands o it, You can ‘even define your own functions. On the other hand, when was he Tas time you needed the cosine of something? Se the section “A Desk Caleulatoin Chapter 18 of UNDX For i) Continues a stopped ob inthe backround. (Some aier versions fof the Bourne and Korn shells cannot do this) UNIKspeak | be (Job) Option or Argument Function Species tiebaunberyouvanto | 2 ‘run in the background. If you leave it {MILUNDC aso tha jou mean te arent ob a _ at & Sample You srt big sow program and then reais tht you wan to ‘omit in the background so that you can get some wher work shoei matinee iz toe OSes ‘omethingite Stopped To cone the joanne gece a andere he foreground es or youth cg aes youtpe bs More stuff Tofind out which jobs are euningin the background, you type ‘To canceajob that is running ia the backround, you use the 111 command, To mowe a background eth ground into the forego you tse the Fa command. Both ate described later nt pats wee (Goth are described later inthis part of 25% Some vero he Noun and Kor shes dt have (@) cel wich isthe capability to un jobs in the backed. $@) pressing i dosnt op, you shell decane Se a Sethe ston “Te Mag of Cnt n Chapter ISU For Dummies, oa a Prints calendar fora month ora year gz “4 () UNIXspeak eat Coonth) (yea Ortion or Argument Faction ‘month Species the month (140 12) for which you want calendar year Specs the yea (1 to 999 for which you want aedendar Be ai, Sample ‘You ar planning big trip down the Amazoa for next Marchand {your dak ealendar doesnt go that far tothe ature. You type cal 3 1995 More stuff youtype just ca] wth no month or year, you ge the calendar forthe current month you provige a year but to month, €31 print T2aonth calendarfor the year And yest can print a alendar forthe yar I, i'you wan thats ADD, To sve the calendar i tet ile rather than print onscreen, redirect 31's output toa le, ke this: sug, ©8112 1995 > xmas. trip. calendar 72S Because cal can do calendars back tothe year 1, typing 2 95 B)) prints calendar forthe year 95 AD. not T985 so wateh out > LEX seetme section Calendar Games” in Chapter 1 of UNE For @) Dummies Displays appointments and reminders fr today. UNIXspeak calendar Sample “Tousethe calendar program, you frst needa calendar fe. Uscany tent editor to createae named calender in your home ‘rectory In you te spoken, emerson snide Temar slong with he dat on which you want them daplayed, Here sa sample c2 ender Me: ov § Send invitations for Meg's birthday party ov 20 Bought decorations for Meg's birthday party yet? 11/30 Get Meg a present! 12/4 Meg's birthday party at LIAM! @ Cancels ap UNIXspeak cancel ae When yourun theca endar progr rogram play ny ines that begin with today's date. To dapay calendar renders every day when youlogin addthisinetotheend of your Tago profit nie calender When you login on November 20, you see this message 11/30 Get Neg a present! More stuff you use electronic mall (see na on, you don't have to run the colendar program If youve ale named cates a Your home directory, UNIX autemagialy runs the cal cer very day at midnight and mals you te tulting message, ‘When you arrive inthe morning Your reminders ae nur small Pretty cute! ‘Sethe section "Calendar Games” in Chape 15 of UX For Donmies Sapir ob (UNDKSystem Von), cancel request10 Option o Argument Function ree Species te pit ob you want to tee by ugh rect me etc tran esrb ern pat of the book) pat Sample You sed age report to the printer. Looking careully at your ord processor, you se tht heuer wrong ani htc Single age therlore messed up. To cane te prt ob You fai outs request 1D by png Ipstat as [UNDG responds wth sing he this 14-1756 margy1 94832 Jan 12 10:43 on 15 15-1762 aaray) 1298 Jan 12 10:45 on 15 ‘Thelrst ine describes the print jb you want to cancel jou an tellbecause its sae, M4802 characters, bi). You pe cancel 1J-1756 UNE responds request More stuff é 51756" canceled You can ship using 1p stat ithe fob you want to cancels printing, Instead, Yu can just spely the name othe printer, ke cancel 14 ‘Tis ine cancels whatever jb printing on the printer named you use BSD UNK, ee pr ‘See the section "Cancel the order, System V"in Chapter 9 of ALK For Durnies a «aM {1 mors ne or text es, bother type ffs took !eroglyphics. To peekin other kinds of ile, you have tk which program creates o interprets them to lookst sn ‘rocesing document for example youve ioe ea ‘processor, " aaa More stuff he fle you aot tolook ats ng, use the nor command instead You can aso use th 0 use the cat command (which stands for eatenate ‘you care) to combine two or more les ict titel fiTe2 F11e3 > one.big.fite Seethe section Looking at the Gut of ln Chapter 4, the Section “The 31 ad the kd, ein Chapter te oon ‘COPY AC" In Chapter 16 adie sect “The oor Gees mand” in Chapter 29 of ND For Dummies, hangs to another di tory (changes the current working QZ) seein whe dacoy eas UNIXspeak rion gument __Fnion icy ces ts dca wach yon nian i eae — | Yon caret working doy ie | ieee opdoren geen : _ | yourown Sane Sete tenant you a | Sample Sample You se a rather interesting fle in your bos's directory Not that} youare nosy or anything, but you wonder what's nie Youtype cat bonus.plan ‘Youlogin and do some workin your howe rectory. Net, you there: You type ed budget Your Budget directory to se which ies ane ‘Tomove back up tothe paren directory of budget, youtype Oe oa More stuff you use BSD UNIX, you mus ask your system administrator to : ‘change the group to which ae Boongs To moe ‘back to your home directory, type S ‘See the section “File seeks new group; can sing, dance, and do treks" in Chapter 28 of UN For Dumonies ‘Tomove ta directory that i not a subdirectory ofthe current working drctry, you can seal pathname one tat begins Srna dash Toleckacundin he tare tence Nome dirctors are stored, or example you cat ype, ZX you use the Korn she thie command moves to the lst (Changes the prmissns fora ie directory you were in, as shown a the allowing ine cd UNIXspeak ‘28% See te seton"Tve been workin the directory” Chapter Sand fehaod [-R) permtsstons #11 {he section “The ci Command” Chapter 29 of UND Fr Dummies, peratsstons ftTenanes Option or Argument Function R “Tells cho to change perisslons on ; Ales in sobekretores too. om 48 0 fae ‘Changes the group that has acces toa leo directory System V ‘ae assign othe le or es). or | ermissions consist fetter that eis ino wets the permission. character that Indlctes whether to add (») or remowe UNIXspeak the permission sna letter tha els whieh nd of permlsston harp newgroup ft Tenanes frie pms fain ee Saye, BB an Sainple a oe ° Other (everyone else) ‘ort jt tec lorie ty you : Sranniatons accounting cepartnet To ale then tase, Alves) suimarendeeennteh mara peas eget Voge i inkl emis corp acta. for oe eine More stuff Read thee Yen nto dt hi command To s Wor ete ‘Sugpacyeparnesoatea ts cimans : Soa ‘ou can uses wildeara in he Mleame, | Q.®. Sample ‘Youcrete sel script and now you want beable texte ioe ‘This allows everyone to execute the srt. (you write memo eiczing the top management of your ‘orgenization and stating your intention to qt and take 2a with ‘competitor, On reflection you decde tht would be better {he teat ofthe memo din leak out belore your meeting with the Dig boss. To prevent others fom reading It you type chmod go-r Tast meno More stuff You have to own the le ordrectory to se this command, you leave the “who” eter oto the permission, hod assigns the permision to everyone. ‘Some heavy-duty UNDX nerds use numeri permission coves rather than the letter codes we favor. someone tells yout et & fle's permission to 440 or some ether momber jst a for an Englth translation, ‘See the section “Abn of shells" in Chapter 14 and the section “i Mam says no ask Dad Chapter 28 of UND For Durie, om fs ”» angst ower le yen Vol) UNIKspeak chown [-R} newowner ffTenanes Option or Argument Faction _ ® Tals chown to change the ownership lies in susiectories to. ewonner Species the name of the new owner of the fle he caret owner must be you ‘rele the command doesnt wor). Use the person's UND username. ftenames Specie thei (or fle) to chang. mara. ter By report and now you want to pas i along to Helen, who wil nish up. Alter moving the tet Helen's home rectory, you ype chown helen final report Nov Helen owns the le More stuff You have to own the ile to be able to se this command you want to gvea eto someone se, ou might think tha it would ‘be enough to copy tte the person's ome decry To give the person permissions to fool with thei: however, is best to ey Change the e's ownership: Ater i you ean always keep 2 copy. Another way to creat ale withitlerent owner is or the new ‘owner to copy the fle. Helen cole make a copy a your report, {or example she peor the command, se owns the copy ‘You ust have to ge her read person forte ile (ee shes}, ZS} seth secon Finding anew owner" In Chapter 28 of UN For QD) deme Chests Bra Sample ‘You have just ried to use the ct command to look at a word- processing document and your screen i fll givers hich [Suing you headache: You ype ab, More stuff ‘This command doesnt alec Hes or jobs —it just clears the luter rom your screen ao GQ ‘ste Besse the ne mers whey er UNIXspeak cap onettle anothertite Option or Argument —_Fanetion one Species the name oon ae eso notre Species the ame ote thereto Sample ‘Youhave two versions of eter you have writen and you cannot tll which ithe fal version, You type mp letter.to.cad letter.to.deddy UND says nothing, the two letters are exact the sae, ‘character for characer ters, UND tells yu how far got Into the ie before found something dierent, More stuff The problem with np Is that t doesn show you whats dierent bout the les, Fr text fle, you et ar ore ntormaton by ting dF. On the other ha, cannot work with noe es, tndenp can, 2S} seein secon “Comparing Apples and Oranges Chaper Bot int For aries Sent een eet kaa QD rset UNIXspeak compress [-v) F1Tenemes o%® cinta faci " Displays how much the le (ries) Sint ‘enames Species the ler esto compress Sample More 6 S You haveinished writing your magnus opus and have male the manuscript to the publisher You want to sve al your ‘manuscript es (named chapter, chapter? end soon) ina ‘compressed formal to save space. You ype compress -v chapters Compress creates compressed es named chapter.2 [hapter2.t,and soon that contain eezedel version of each chapter Italbo deletes the orignal es stuff Wen you want oget your oral les ack you ue Uncanpress or £e5¢ (esr erin th art fhe Bok) Wa good idea to compres yur tes belore transtrtng them ‘ver the network to another computer. Th sale the He the fester wansers. Ifyou want one big compressed eerste ‘combined fle by using ar and compress the combined fle See also pack, unpack, and peat. See the section Squshing Your Fle" ia Chapter 19 ol UN For Demme a g pls one or more speak © (-1) ofdtttes newtttes ep (-1) [or] oldttes dtractoryt /newsites: @.e ino Argument Fnction 4 Ack it lore you replace an {Stig ew coped ie ons Say MUN Suen @ Ree) : ‘Wen you copy recy copies HOSRectek to anf reas new ‘urectres ss teeny tts Specs the ame ofthe te youvan reies Species the mae to gv tote new coor dmetny Species the name of he directory in stichyouwunt ta sore toy, Sample ‘You have ale that contains your January expense report. Rather than crete your February expense report om scratch, ou want tobeign witha copy ofthe one for lary. You type cp January expenses february expenses LUND doesn't change the contents of January expenses in any way —itjust creates anew le called February expenses with encal content. you want to copy your finshed february expenses Mletmo sour bore's ome directory, you type cp february. expenses /usr/harold/ margys.feb. expences By ineuding both a path andaflename to which to copy, you tll Eptocopy thefleinothe /usr/haros/ directory ahd to pamme thenew copy margys.feb-expenses, More stuff fname tele cp to copy leit te current working erecory. seks teeta men ero eazy 5 See ee ea ears iennememortr Gee seco, Seca @ Sex the section “Copying Flex: Senin the Clones in Chapter 4 apd the section “The co Command’ in Chapter 29 of UNE For hee me " tyne pt a ts SS QD) Steciasptaraomaaaer te Mec UNIXspeak emo Loe) Ga) CE strane) Cul C4) CV) epte -0 (-<) f-¥) CV) ete -p 6-6) £-1] -(u) Cv) £-¥) atrectory Option or Argument Fanetion < Reads and writes archive in portable ‘character format ater than ‘uportal binary format 4 Creates rectries ae necessary; doesn't work wth 3 & Species that ae contains ais of Alenames tobe copied doesit work with ore 4 Spectes that cpio copy the files rom other device (usually tape) or an “archive back tothe disk 4 Creates links tothe files, if posible ether than copies the oes wok wh oro ° Specifies that po copy the ile trom the dds another device stall a tape) of toanarchivetie “e * pects that p10 copy the files from one Arectory to another on the ask ® Option or Argument Function * Coples es even fk means replacing testing es withthe same nes (wath ft doesn't work with 3 “ Displays alist of flenanes a copies then y Displays a dot for each fe copes so that you can tll ow lst t's going tismame Species the name of fle that contains a sto les to copy you use this option, ‘on’ use flenames ftenanes Specs the name ofthe fest copie iouusethsopion denise fame! cry Spectes the name athe directory to Bieta coy thee Sample ‘You have just finished a large project for which you created a ! buch les. You personaly newer want a see the fies ga, but you know that you should save them or poster To copy the les to an archive le you P= epfa -0c proj.plan report-draft report.final > proj.archive ‘This command creates an archive le anne pro} .archive that, contains your project les. Later, ofcourse ttuns out that you have to make one or two tle changes te your final report To get the report fin] Me (Go other les) ack rom te archive you ype cpio ~icd < proj.archive More stuff § ‘Tomove a bunch of les rom one dectory to another, inelading all the subdirectories, you maybe able to use the cD“ com Tnand Iftdoest work on your system, use the following mage Incantation (i's ugly, buts easier than any ofthe serie 4 oldair Find * print | cpio -pdlay /usr/wnatever/newdir ‘These commands move al the files from the 0160 rectory andits subdirectories tothe /usr/whetever news directory, ‘rating new sublrectores as necessay. sorta esembes, ‘rating limb fom one re to another roma OD “Important: Specty the name othe new directory a fl pathname. The new directory must ready exit. (Use Mr to ‘create tf neceeary.) Alter tis command as rhe ls exist imboth the od and new directories se rm" to get dof the ‘ld rectory. And yes, this techniques barave The 0 commands used also for copying est and rom ‘apes, as part ofa backup procedure. See ala Makes 1st of programs you wane to un on a regular schedule UNIXspeak ‘crontab (fi en: Option o Argument Function ftename Specs the ile tha contains the ist ‘tcommands and when you want to un each one ‘Touse crontab, you ned aroma filets le contains a ist of ‘commands you want to run andthe time and day wien you want {orun them. Acronab le sa texte and each ine ofthe fe contains ene command, ie hs min Nour 00M month DOH command ‘The est tive tems specty when the command shoul! be run, as described in thi table Line in cone file item ______—Deseritiow nin Minute (01038) tr Hour (0102) ow Day ofthe mont 14031) month Month (1012) Dow Day ofthe week (0106, where Dis Sonny) command Command torn @.° e Sample ‘You want to mall yoursella message every Friday to remind {ours to pickup groceries on the way home. Vou create ont teamed my cerontab. Te (sing any text eto) thot contains this ine: (0.0 * # 5 echo “Pick up groceries! @ “This tne indicates that at midight (0 minute and O Now), Tegardless ofthe day ofthe month (, inal months (02 Fridays (ay 3), to send a meneage to yourself by way of UND ‘mal (his line assumes that your username sar). To tel he ‘Cron program to run this command regulary ou Pe crontab *More vant 1a!" she safd again 62a The Ena port describes the dferences by teling how to turn the frst tothe second: 2362 means tat lie 23h the st ile (ts listed beginning witha) should be changed tine 23 nthe eo rcp QB second tle (sted beginning with a>), 450 indicates that a line ‘should beaded atthe new ine 45, and 624 means tha line 6 of Thetis le should be deleted More stuff ‘Tocompare two really bi es, use bf instead It works jst lke gion shower To compar ile that don cota ext tse cnp. Se also cmp, dre. and S617 See the section “Comparing Apples nd Oranges” in Chapter 18 of {iN for Dummies Compares wo directories and tes you which ies arin both, ‘which aein just one. and which aren ust the oer Fores a both directories, the dren command tels you whether the contents ofthe tes are the same UNIKspeak Atrcap [-1} (51 dtractoryt directorye pion Argument Feton 4 Forte ta arent dren Spartina yuan neat * Doesnt say anything bout es that enn dire! Species one decir o compare ‘dnc? Spree tote decor to Sample Both you and your boss have been keeping coples of your ‘department's monthly reports. Fach of you has a decry ned Reports that contains a bunch oles, and they seam oe more ‘or les the same, You wonder whether ether oa of you is missing ny ies or wheter the all are exactly the same, You type ‘Girenp /usr/margy/Reports. /usr/ydia/Reports @P The result of rnp tes you only whether les are dential ‘See also df, which ean sso compare two directories nd tell youesactly how es ler ca Tals you how much skspace your es cco UNIXspeak GB 822 sitar Ontos Argument Funetiow 7 splays te pace used by each le thot by cat cy * Displays he tt spce ose or ech theaoy. bt nat cabretones dices Species th ceca or rect ‘Binclaetnthe sage ing Sample ‘Your system administrator complains that your les ake up too Imuch space onthe dak "Nonsense. you fey, ut then you ‘ealze hat might be better oto make im angry. Instead, You ‘decide to refute the accusation wit cold hard evidence. You ‘ype You see 162 /ust/nargy/ganes 1492" fusr/maray/ book 5403 fusr/margy/ gossip 8580 /usr/maray More stuff “The sizes reported nik block, which ar 52 characters Call. ‘slbyte) in UND Sytem Vand 1024 (1 kobe) In BSD UN Cag o a16) Echoes back whatever you type onthe command neater echo and expands any wildcards BY wing vor 1 UNIXspeak ‘echo (0) sturt Option or Argument Function a Doesnt begin anew ln alter echoing theinfoemation (830 on). Species he information to echo it [more than one word or contains Punctuation, enciowe the message in {uote Part this book, nthe Seetion “Quoting characters onthe ommand lin" contansnlrmaton bout including special characters Such a cariage returs tab and ‘Quotes themelve, Sample Youare writing a shell script ad you want to display a messa onsereen nthe bel cit, seca tis ne - echo "Your report 1s now printing!™ ‘When you run the shal erp, this ine displays Your report $5 now printing! Runs one ofthe world's ules lneoriented tet etre. Part explain how to use itor preferably how to use a better ext fedtor suchas Vor emacs ‘$25 abo the secon “Talo Mr, in Chapter 12 f UN For GB) et youradand senda Pa Vex how ose CB Seaternesetonravne oman Pat wt ache 1s @ Tsien, Gud Runs a powerful screen-riented text er, Part 1 expan hows few PNG 2 ‘Shows you information about your UNIX environment variables, UNIXspeak Sample You are wondering which environment variables are defined for yyouanyeay You type ‘You seea bunch o tins that ok ke this: NOME=/usr/margy More stuff (On some BSD systems, this command i called prnteny, See ‘lig set and setenv A yucky ineoriented text eto that uses commands which are Similar to ed and I's an extended version of e¢ (hence the ‘ame) For maximum contsion, you can alo use commands ‘thin v'- Part W expan how to use therm al See the section “Oh, no's my ex” in Chapter 12 of UN Fur ) Danner Ce) GQ) ezsgres Mien yovse tn atenia wn cee 2) iad, UNIXspeak exit Sample You ae ished working with UND and you want to go home. Yeutype You see « message saying that you have logged ou. (Or youare using terminal window in Moti and you are finished Wich To make t go away, you ype “The window closes More stuff exit doesn work, try typing logout. Pressing CtrKD may also Jog you out When you use Moti typing ex inthe login window (he fist window created when Moti starts up) not ony closes the window san, it alo sual logs you out ZH seetne sections “Ciao, UNIXT in Chapter 1 and “Getting Rid of {Windows in Chapter of LN For Dummies. a@P Continues a stopped ob by running it inthe foreground. Some @ versions ofthe Bourne and Kom sels cannot dots) UNIXspeak #0 (4300) Option or Argument Function a ob Species he ob number you want o Finitetoregeund tea teave ft UN aoses tat fou mean the cent Sample You ae runing along, consuming program nthe back ‘round by using the Ds command (described carr n this part ‘tthe bo). You tnd out that you ned the ests ne fora big meeting in half an hour, so Jou decide to move it tothe foreground. This means that you cant do anyother work with our computer wile the program furs, bull iiss a toon as Bossibie To check that'll running nthe background, you type Jobs You see your job iste as job number 2 You ype fo 32 Because the program runs inthe foreground, you cant get any other werk done but’ running talk speed. More stuff Rather than use the job umber from the 0's sting, you can tse the rst eters othe program that running I the 0 rogram is running inthe background, for example you can move tothe foreground by typing 9 tind Soe the section “The Mage of Jab Control” in Chapter 15 of UN ForDummies ite B Tals you whether something i fe, directory, o something se entely the thing ea fle, the 12 ommnand testo fess which type of ntormatlon contains. UNIXspeak ‘110 names pion or Argument Faction -_ om Specie decor or you wonton about Sample You see an object name pda youwonder wich tl: You type File Updates You see someting ke this update You wonder what's inthe lectry, 0 ou type Fie Updates/* You se alist ofthe ienames in the directory. with a guess about ach e's contents ln your home directory, nd More stuff “The '1e command can determine whether a ile contain ASC text Ii does ean recognize certain types of ASC tet es, Such as those that contain rot Yor trot commands Kal recognizes compressed files created by using the compress Dc programs iff cannot tel what econ, ‘Suggests that is data ruses some rules of thumb to guess ‘wats nail, 20 now sd then guesses wrong See nroff,troff, compress and pack. See the section “Whats in Tat Fle?” ln Chapter 13 of UX Far Bocce ae Ap rita en UNIXspeak {find dfrectortes{-nane fi lena 1 C-user username} Caine sdays] Comtine vaays) (prints Een comand 113 {0k command A Sption or Argument Function alrectories Species of rectors a which you want to beg the search. The ‘nd command searches all the subdirectories of these directories too, Ifyou want to startin the curent rectory just type a single period (). Species the name ofthe fle or files) You want to fie I you don't know the ‘exact name, you can use the wildcard characters Pand*. A stands for any Single character and a* stands for fr0up of characters. You must quote theMlename you use any wildcards Specifies the user who ows the les you want to find. Specifies that you wantonly files ‘which haven't been accessed (looked 4) nat least days (he number of days). Ifyou usea minus sgn rather {han the plus sig before the number ‘of days, you get ony files that were last looked at within that umber of days, ‘Specifies that you wantonly fies ‘hich haven’ been mosifid nat least days days you use amis sign rather than the pis sign belore the ‘numberof days, you get only les that ‘were last changed within that number of days. ‘ame filename atime days Sample Displays the names of est finds. ‘you don’t include this option, the Find command may find lots o fies, butt doesnt tll you about them. Runs the command every time i finds afl. When it runs the command, t Substitutes the name ofthe filet found forthe {1 Be sure to type \: at the end of the command, ‘Works the same way asthe “exec ‘option, except that asks you to oni that you want to perform the ‘command ast finds each fle exec command i \: -ekecommand i} You know that you made file eaed bus Snes s-pan, but you ‘cannot find it Perhaps its nthe wrong subdirectory. n your home directory, youtype find . -name business.plan -print UNIX els you that a fe by that name's in your Planning Airectory, ke this /Panning/bus ness. plan (Or you want to print al les with filenames that Bega wth eipe You type Find -nane "recipes" -exec Ipr () AS UNK tind each file, it run the 1p command to pint i and ‘substitutes the flename forthe |) on the command ine, Notice that you must encloge the flename in quotation mark it ‘contain wikdeard characters. What you ae asked to delete some les because your depart- ‘ment is running out of disk space? You decide to see whether you have les you haven’ looked tn atleast three months (90 days), You type find -atine 490 -print ‘Alternatively, you want to see which files you have changed within the lst week, You type fing -mtine -7 -print i Mm. More stuff you want to lookin several places fra file, you can type several directories onthe command line, te tis find . fusr/john -nawe chapter3 -print ‘This command looks inthe current worklng directory (and alts subdirectories) as wel asin uSr/ jh (and alts, subdirectories) forthe le chapters ‘Tosearch ora directory, use the typed option lke this find . -name OldVersions type d -print This command searches fora directory named 0 ders To search forall the les you own (assuming that your username Isharold), youtype Find / -user harold -print ‘This command bein the search atthe root directory (ofthe entre te system, 30 might take a while Sce the sections “When You Care Enough to Know the lename” In Chapter 26 and “The nd Command! in Chapter 29 of UNI For Dummies, GAS permet meee raat Just thelr UNE users UNIXspeak Hager (usernanes} Option ov Argument Function ssemames Species the user (or users) about ‘whom you want more information Sample "You are wondering who elses using your computer, You type Finger Mii You see a listing of usernames, real names, and other miscella- ‘neous information You notice a username you don't recognize, 50 you want more information. You type Finger dougm You see several lines about yout triend Doug Mader, including his fullname, his home alretory, whieh shel he runs, when he ogged in, which project he's working on (assuming tat this Information is stored in afile named = project) in his home irectory and his plans (rom ale named pan hls home ‘rector More stuff You an als ind out who is using other computers on your network, To find out who's onthe us system, you pe Finger @xuxa The@ tells UNDX that this the name ofa system, not the name of ser To find out more about a user an another system, you type Finger Jordan@xuxa you are onthe Interne, you can get information about any user ‘on any system on the entive network. To find out who i onan Internet system named ted, for example, you ype Finger @nit edu ‘Some internet systems respond with general information about the system rather than ait of who's logged on ‘See also uo “Finding Out Who's on Other Computers” in Chapter 17 of UNIX For Dummies lua ide] S ‘See the sections Finding Ot Who's on Your Computer” and Aletransler program, from one computer to another over a ‘network. See Part Vor deta srep (-1] [-1] (-v) text #¥Tenames Option or Argument Function ‘ Ignores case (uppercase and lower- case) when youre searching 1 Displays only the names ofthe les that contain the text, na the actual lines w ‘Specifies that you are looking fo ines that doar contain the ext text ‘Species the word or phrase to search forthe text includes spaces or Punctuation that might confuse UNDX, fneloseit in quotation marks Specs the fle (or ils) in which to search; to search al the file inthe ‘current directory. type * ‘tenames a you mentioned “imirowaveable sell stale foods" To search ll he files inthe current directory. you'ype arep “nicrowaveable shelf stable* * You don't find the fle you want, You realize that the M might be capitalized, s0 you tell grep to ignore captalization by typing grep -i *microwaveable shelf stable" * More stuff In addition o searching for just plan text, grep can search forall Kinds of patterns. In fat ep stands for global regula expres ‘sion and print, and searches for regular expressions Lak ‘Tegular expressions look just ke text except for some puncta- tion that has special meanings to grep. The characters to watch ‘ont for are shown inthe folowing table: S Ur Matches any single character, ; Matches any number ofthe characte Mat precedes t For example, ‘means to match any numberof any character. means any number of Xe a Matches ay one of the characters Inside the brackets. For example, TABC) matches one one Bor one {4-2} matehes any capital eter, Represents the begining ofthe ine For example, "T matches aT atthe Deginning of tine 8 Represents the end ofthe line For example, 18 matches an exclamation pola tthe end ofa line \ ‘ells grep to take the next character IMeraly, not asa special character. It you wai to search for BM. for example, you can type [VB Related programs are egep and farep. egrep i more powerful ‘but more confusing and fore faster but more lnited. For your sanity’ sake, stick with grep, See the sections "When You Don't Know the Filename” in Chapter 2and “The grep Command” in Chapter 29 of UND For Dummies Displays just {le (usually thelist ten), UNIXspeak head [-Iines) fienane Option or Argument Function wines Speeiis the numberof ines you want {0x you omit ts option. you get ‘lenamne Species the fle you want to look at Sample You are wondering what's nai, but because i's very large, you ‘want to see just the begin head master. plan ‘You se the rt ten ines ofthe ie More stuff You decide that you want to see more To se the it 20 tines, you ‘ype head -20 master.plan Tose the ile one screen ata tne, type nore master.plan 1 You ype ‘You can also use head to ee the tis few ines ofthe output of another command, To se jst the first TS ins ofthe a Page about the Ts command, you type a fan 1s | head -15 ‘On systems without ahead command, you can get the same elect with the sed command, se¢ docs all kinds of things, (escrbed later in this part ofthe book), but is 9 option displays lines atthe Begining of he, You can display the fst 20 lines of themasterplan fle, for example, ie tl: sed 20q masterplan ‘See the section "Looking a the Guts of Fle"in Chapter 4 of UNIX Por Dummies your UND system has an ortine help system, dplays possibly help! information about commands, UNIXspeak hep. Sample (On Some UNKX systems, you can type @ sisory GB) You see ite menu of topes, and you can depay information about many UND commands ‘Most UNIX ystems, however, have no help system, and you see Just an error message I's worth ty, though See man to lean how touse the omline reference mana st the last 20 or so commands you typed, Works with only the Cand Koen shel, UNIXspeak history Sample You inaly gota long, involved command to work such as grep or find). few minutes ater ithas disappeared from the top of {your screen (or terminal window), You want to give the command gain You type history You see listo the lst 20 oso commands, includ you want to give again, More stuff © IH you use the shel, you dont have totype the command again Instead, you can execute the ast command you gave by ping the command you wants several commands back, you can still ‘erunit,To execute command number in the history Ist, you ‘ype 5 the command you wants the most recent command you gave that begins with gr you can type ‘or Wyou use the Korn shell you can aso reexecute commands. To fefecute the last command again, you type @? a PB “Torerun the ast 9rep command, you ype neither the fore A ‘ground or the background, aswell s any stopped jobs. (You ean ae Stop the ob in the foreground by pressing Cut?) More stuff PES Anter you have listed your jobs, you can move jobs to the (B) foreground or the background — see b9 and £9. Fora general option withthe | comand Ma file (ra tink already has the same name asthe ink you are ‘creating, some versions of In destroy the exiting le orth) and ‘teae the new one. I's good idea to use the = command Doelorehand, to check whether se already has the name you plan to use. Then use the “option ofthe 19 command 50 that it tasks belore clobbering existing les, See the sections “When You Want To Share a Fle” in Chapter 26 and "The In command” in Chapter 2 of UNDY or Dummies Prints a fle (works in UNK System V ony), UNIXspeak @ Ip C-c) C-d printer tom) C-n copies] Fo options} {-P pagerumbers} Cw) f Option or Argument Function © “ells 1p to make copy ofthe eto be printed: you edt the le between thetime you give the |p command and when ts printed, the changes don't appear inthe printout i 2 ‘Specifies the printer on whieh you want the le printed = ‘ells 1p to send you emall when the fle has been printed; usefl when the printer is very busy and you may have fo wait your turn Option or Argument A priner Function scopes Spt ne ber copes the ictopran options Spel pri options te erin ® pagrumters Specs whlch pges ora (at's conta ee Daplays amesage on your screen x foonasthetic has ited fierame Species the fle you want pint Sample You have ust ereated a tet file that contains some important ‘nancial information you want to pass along to Your boss. You type Vp Fin.info Alter you print, you decide that you want two more copies, $0 youtype Ip -n 2 Fin.info More stuff In response to the 1p command, you see a message ike this: request 1d 1s 1-024 (1 file “The request ID number canbe useful if you decide to cance Drntng thee (ee Caice] earl in this pat ofthe book). Suppose that you want to print your fle on the high-quality printer in the executive suite ona peter named exec Taser Youtype \p -d execlaser fin. info many people share one printer along dela can occur before your les printed. you want to see a message on-screen when thet prints, you can type 6 @P (r 1p can send you electronic mail when the le has been printed you type Ip -8 Fin.info you want to print the output of another command, use redirec: {ono print a directory of Mes, for example, you ean type 1s | 1p ltyou want to print several les, you can type several lenames, Ike thi Ip Fin. info menos Tetter.to.nom Depending on the capabilities of your printer, you may be abe to ‘contro the format of the output with the options in the following table, which you type rig ate the “0 option: Option _ nobanner Description 7 ‘Doesnt print a banner page (a page with your username and the name of he ile) UNDC usualy prints a banner age before each print Job, to separate ‘ne rom the next Doesnt start each leona new page Prints the lea ich characters pet Inch, Your printer maybe capable of Printing tami numberof Pitches, usually only 10 or 12 Prints the leat ines lines per inch (Casual 0). Some printers can print tet lines per neh Prints pages that are inches inches Jong (oe sure to include the smal /at theend ofthe option). Prints pages that are fines lines long, (Ge sureto include the small. Prints a maximum of chars characters perline. Prints pages that area maximum of Inches inches wide ‘To print several les with no page breaks between them, for ‘ample, you can type Ip +0 nofitebreak int noflebresk epkpitch Ipttines length -inchest lenathstines width-chare wihinchest See the sections “Printing Stuf in Chapter 9 and “The 1p ‘Command (UNIX System V Only" Chapter 29 of LINX For Dummies sts the statu oll the avallable pinters (works in BSD UND only). UNIXspeak Vpq (-a) Cprinter] Option or Argument Function 7 * sts information about al printers printer Species the printer you want 1 know about if you don't speeily the printer, ‘assumes a default usually the Printer closest to you Sample You have tried to prin several large documents, but they haven't appeared on te printer. To look at the print queue or your printer, which is named laser, you type pq laser UNIX responds no entries Hmm... nothing there, Maybe the documents are waiting to print ‘on some other printer. To see the print queues forall the aval sable printers, you type Wpq

You might also like