tar.texi 335 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename tar.info
  4. @settitle GNU tar
  5. @finalout
  6. @smallbook
  7. @setchapternewpage odd
  8. @c %**end of header
  9. @c ======================================================================
  10. @c This document has three levels of rendition: PUBLISH, DISTRIB or PROOF,
  11. @c as decided by @set symbols. The PUBLISH rendition does not show
  12. @c notes or marks asking for revision. Most users will prefer having more
  13. @c information, even if this information is not fully revised for adequacy,
  14. @c so DISTRIB is the default for tar distributions. The PROOF rendition
  15. @c show all marks to the point of ugliness, but is nevertheless useful to
  16. @c those working on the manual itself.
  17. @c ======================================================================
  18. @ifclear PUBLISH
  19. @ifclear DISTRIB
  20. @ifclear PROOF
  21. @set DISTRIB
  22. @end ifclear
  23. @end ifclear
  24. @end ifclear
  25. @ifset PUBLISH
  26. @set RENDITION The book, version
  27. @end ifset
  28. @ifset DISTRIB
  29. @set RENDITION FTP release, version
  30. @end ifset
  31. @ifset PROOF
  32. @set RENDITION Proof reading version
  33. @end ifset
  34. @c ---------------------------------------------------------------------
  35. @c The @FIXME's, @UNREVISED and @c comments are part Fran@,{c}ois's work
  36. @c plan. These annotations are somewhat precious to him; he asks that I
  37. @c do not alter them inconsiderately. Much work is needed for GNU tar
  38. @c internals (the sources, the programs themselves). Revising the
  39. @c adequacy of the manual while revising the sources, and cleaning them
  40. @c both at the same time, seems to him like a good way to proceed.
  41. @c ---------------------------------------------------------------------
  42. @c Output marks for nodes needing revision, but not in PUBLISH rendition.
  43. @macro UNREVISED
  44. @ifclear PUBLISH
  45. @quotation
  46. @emph{(This message will disappear, once this node revised.)}
  47. @end quotation
  48. @end ifclear
  49. @end macro
  50. @c Output various FIXME information only in PROOF rendition.
  51. @macro FIXME{string}
  52. @allow-recursion
  53. @quote-arg
  54. @ifset PROOF
  55. @strong{<FIXME>} \string\ @strong{</>}
  56. @end ifset
  57. @end macro
  58. @macro FIXME-ref{string}
  59. @quote-arg
  60. @ifset PROOF
  61. @strong{<REF>} \string\ @strong{</>}
  62. @end ifset
  63. @end macro
  64. @macro FIXME-pxref{string}
  65. @quote-arg
  66. @ifset PROOF
  67. @strong{<PXREF>} \string\ @strong{</>}
  68. @end ifset
  69. @end macro
  70. @macro FIXME-xref{string}
  71. @quote-arg
  72. @ifset PROOF
  73. @strong{<XREF>} \string\ @strong{</>}
  74. @end ifset
  75. @end macro
  76. @c @macro option{entry}
  77. @c @quote-arg
  78. @c @opindex{--\entry\}
  79. @c @value{\entry\}
  80. @c @end macro
  81. @set op-absolute-names @kbd{--absolute-names} (@kbd{-P})
  82. @set ref-absolute-names @ref{absolute}
  83. @set xref-absolute-names @xref{absolute}
  84. @set pxref-absolute-names @pxref{absolute}
  85. @set op-after-date @kbd{--after-date=@var{date}} (@kbd{--newer=@var{date}}, @kbd{-N @var{date}})
  86. @set ref-after-date @ref{after}
  87. @set xref-after-date @xref{after}
  88. @set pxref-after-date @pxref{after}
  89. @set op-append @kbd{--append} (@kbd{-r})
  90. @set ref-append @ref{add}
  91. @set xref-append @xref{add}
  92. @set pxref-append @pxref{add}
  93. @set op-atime-preserve @kbd{--atime-preserve}
  94. @set ref-atime-preserve @ref{Attributes}
  95. @set xref-atime-preserve @xref{Attributes}
  96. @set pxref-atime-preserve @pxref{Attributes}
  97. @set op-backup @kbd{--backup}
  98. @set ref-backup @ref{Backup options}
  99. @set xref-backup @xref{Backup options}
  100. @set pxref-backup @pxref{Backup options}
  101. @set op-block-number @kbd{--block-number} (@kbd{-R})
  102. @set ref-block-number @ref{verbose}
  103. @set xref-block-number @xref{verbose}
  104. @set pxref-block-number @pxref{verbose}
  105. @set op-blocking-factor @kbd{--blocking-factor=@var{512-size}} (@kbd{-b @var{512-size}})
  106. @set ref-blocking-factor @ref{Blocking Factor}
  107. @set xref-blocking-factor @xref{Blocking Factor}
  108. @set pxref-blocking-factor @pxref{Blocking Factor}
  109. @set op-bzip2 @kbd{--bzip2} (@kbd{-j})
  110. @set ref-bzip2 @ref{gzip}
  111. @set xref-bzip2 @xref{gzip}
  112. @set pxref-bzip2 @pxref{gzip}
  113. @set op-checkpoint @kbd{--checkpoint}
  114. @set ref-checkpoint @ref{verbose}
  115. @set xref-checkpoint @xref{verbose}
  116. @set pxref-checkpoint @pxref{verbose}
  117. @set op-compare @kbd{--compare} (@kbd{--diff}, @kbd{-d})
  118. @set ref-compare @ref{compare}
  119. @set xref-compare @xref{compare}
  120. @set pxref-compare @pxref{compare}
  121. @set op-compress @kbd{--compress} (@kbd{--uncompress}, @kbd{-Z})
  122. @set ref-compress @ref{gzip}
  123. @set xref-compress @xref{gzip}
  124. @set pxref-compress @pxref{gzip}
  125. @set op-concatenate @kbd{--concatenate} (@kbd{--catenate}, @kbd{-A})
  126. @set ref-concatenate @ref{concatenate}
  127. @set xref-concatenate @xref{concatenate}
  128. @set pxref-concatenate @pxref{concatenate}
  129. @set op-create @kbd{--create} (@kbd{-c})
  130. @set ref-create @ref{create}
  131. @set xref-create @xref{create}
  132. @set pxref-create @pxref{create}
  133. @set op-delete @kbd{--delete}
  134. @set ref-delete @ref{delete}
  135. @set xref-delete @xref{delete}
  136. @set pxref-delete @pxref{delete}
  137. @set op-dereference @kbd{--dereference} (@kbd{-h})
  138. @set ref-dereference @ref{dereference}
  139. @set xref-dereference @xref{dereference}
  140. @set pxref-dereference @pxref{dereference}
  141. @set op-directory @kbd{--directory=@var{directory}} (@kbd{-C @var{directory}})
  142. @set ref-directory @ref{directory}
  143. @set xref-directory @xref{directory}
  144. @set pxref-directory @pxref{directory}
  145. @set op-exclude @kbd{--exclude=@var{pattern}}
  146. @set ref-exclude @ref{exclude}
  147. @set xref-exclude @xref{exclude}
  148. @set pxref-exclude @pxref{exclude}
  149. @set op-exclude-from @kbd{--exclude-from=@var{file-of-patterns}} (@kbd{-X @var{file-of-patterns}})
  150. @set ref-exclude-from @ref{exclude}
  151. @set xref-exclude-from @xref{exclude}
  152. @set pxref-exclude-from @pxref{exclude}
  153. @set op-extract @kbd{--extract} (@kbd{--get}, @kbd{-x})
  154. @set ref-extract @ref{extract}
  155. @set xref-extract @xref{extract}
  156. @set pxref-extract @pxref{extract}
  157. @set op-file @kbd{--file=@var{archive-name}} (@kbd{-f @var{archive-name}})
  158. @set ref-file @ref{file}
  159. @set xref-file @xref{file}
  160. @set pxref-file @pxref{file}
  161. @set op-files-from @kbd{--files-from=@var{file-of-names}} (@kbd{-T @var{file-of-names}})
  162. @set ref-files-from @ref{files}
  163. @set xref-files-from @xref{files}
  164. @set pxref-files-from @pxref{files}
  165. @set op-force-local @kbd{--force-local}
  166. @set ref-force-local @ref{file}
  167. @set xref-force-local @xref{file}
  168. @set pxref-force-local @pxref{file}
  169. @set op-group @kbd{--group=@var{group}}
  170. @set ref-group @ref{Option Summary}
  171. @set xref-group @xref{Option Summary}
  172. @set pxref-group @pxref{Option Summary}
  173. @set op-gzip @kbd{--gzip} (@kbd{--gunzip}, @kbd{--ungzip}, @kbd{-z})
  174. @set ref-gzip @ref{gzip}
  175. @set xref-gzip @xref{gzip}
  176. @set pxref-gzip @pxref{gzip}
  177. @set op-help @kbd{--help}
  178. @set ref-help @ref{help}
  179. @set xref-help @xref{help}
  180. @set pxref-help @pxref{help}
  181. @set op-ignore-failed-read @kbd{--ignore-failed-read}
  182. @set ref-ignore-failed-read @ref{create options}
  183. @set xref-ignore-failed-read @xref{create options}
  184. @set pxref-ignore-failed-read @pxref{create options}
  185. @set op-ignore-zeros @kbd{--ignore-zeros} (@kbd{-i})
  186. @set ref-ignore-zeros @ref{Reading}
  187. @set xref-ignore-zeros @xref{Reading}
  188. @set pxref-ignore-zeros @pxref{Reading}
  189. @set op-incremental @kbd{--incremental} (@kbd{-G})
  190. @set ref-incremental @ref{Inc Dumps}
  191. @set xref-incremental @xref{Inc Dumps}
  192. @set pxref-incremental @pxref{Inc Dumps}
  193. @set op-info-script @kbd{--info-script=@var{script-name}} (@kbd{--new-volume-script=@var{script-name}}, @kbd{-F @var{script-name}})
  194. @set ref-info-script @ref{Multi-Volume Archives}
  195. @set xref-info-script @xref{Multi-Volume Archives}
  196. @set pxref-info-script @pxref{Multi-Volume Archives}
  197. @set op-interactive @kbd{--interactive} (@kbd{-w})
  198. @set ref-interactive @ref{interactive}
  199. @set xref-interactive @xref{interactive}
  200. @set pxref-interactive @pxref{interactive}
  201. @set op-keep-old-files @kbd{--keep-old-files} (@kbd{-k})
  202. @set ref-keep-old-files @ref{Writing}
  203. @set xref-keep-old-files @xref{Writing}
  204. @set pxref-keep-old-files @pxref{Writing}
  205. @set op-label @kbd{--label=@var{archive-label}} (@kbd{-V @var{archive-label}})
  206. @set ref-label @ref{label}
  207. @set xref-label @xref{label}
  208. @set pxref-label @pxref{label}
  209. @set op-list @kbd{--list} (@kbd{-t})
  210. @set ref-list @ref{list}
  211. @set xref-list @xref{list}
  212. @set pxref-list @pxref{list}
  213. @set op-listed-incremental @kbd{--listed-incremental=@var{snapshot-file}} (@kbd{-g @var{snapshot-file}})
  214. @set ref-listed-incremental @ref{Inc Dumps}
  215. @set xref-listed-incremental @xref{Inc Dumps}
  216. @set pxref-listed-incremental @pxref{Inc Dumps}
  217. @set op-mode @kbd{--mode=@var{permissions}}
  218. @set ref-mode @ref{Option Summary}
  219. @set xref-mode @xref{Option Summary}
  220. @set pxref-mode @pxref{Option Summary}
  221. @set op-multi-volume @kbd{--multi-volume} (@kbd{-M})
  222. @set ref-multi-volume @ref{Multi-Volume Archives}
  223. @set xref-multi-volume @xref{Multi-Volume Archives}
  224. @set pxref-multi-volume @pxref{Multi-Volume Archives}
  225. @set op-newer-mtime @kbd{--newer-mtime=@var{date}}
  226. @set ref-newer-mtime @ref{after}
  227. @set xref-newer-mtime @xref{after}
  228. @set pxref-newer-mtime @pxref{after}
  229. @set op-no-recursion @kbd{--no-recursion}
  230. @set ref-no-recursion @ref{recurse}
  231. @set xref-no-recursion @xref{recurse}
  232. @set pxref-no-recursion @pxref{recurse}
  233. @set op-no-same-owner @kbd{--no-same-owner}
  234. @set ref-no-same-owner @ref{Attributes}
  235. @set xref-no-same-owner @xref{Attributes}
  236. @set pxref-no-same-owner @pxref{Attributes}
  237. @set op-no-same-permissions @kbd{--no-same-permissions}
  238. @set ref-no-same-permissions @ref{Attributes}
  239. @set xref-no-same-permissions @xref{Attributes}
  240. @set pxref-no-same-permissions @pxref{Attributes}
  241. @set op-null @kbd{--null}
  242. @set ref-null @ref{files}
  243. @set xref-null @xref{files}
  244. @set pxref-null @pxref{files}
  245. @set op-numeric-owner @kbd{--numeric-owner}
  246. @set ref-numeric-owner @ref{Attributes}
  247. @set xref-numeric-owner @xref{Attributes}
  248. @set pxref-numeric-owner @pxref{Attributes}
  249. @set op-old-archive @kbd{--old-archive} (@kbd{-o})
  250. @set ref-old-archive @ref{old}
  251. @set xref-old-archive @xref{old}
  252. @set pxref-old-archive @pxref{old}
  253. @set op-one-file-system @kbd{--one-file-system} (@kbd{-l})
  254. @set ref-one-file-system @ref{one}
  255. @set xref-one-file-system @xref{one}
  256. @set pxref-one-file-system @pxref{one}
  257. @set op-overwrite @kbd{--overwrite}
  258. @set ref-overwrite @ref{Overwrite Old Files}
  259. @set xref-overwrite @xref{Overwrite Old Files}
  260. @set pxref-overwrite @pxref{Overwrite Old Files}
  261. @set op-owner @kbd{--owner=@var{user}}
  262. @set ref-owner @ref{Option Summary}
  263. @set xref-owner @xref{Option Summary}
  264. @set pxref-owner @pxref{Option Summary}
  265. @set op-posix @kbd{--posix}
  266. @set ref-posix @ref{posix}
  267. @set xref-posix @xref{posix}
  268. @set pxref-posix @pxref{posix}
  269. @set op-preserve @kbd{--preserve}
  270. @set ref-preserve @ref{Attributes}
  271. @set xref-preserve @xref{Attributes}
  272. @set pxref-preserve @pxref{Attributes}
  273. @set op-record-size @kbd{--record-size=@var{size}}
  274. @set ref-record-size @ref{Blocking}
  275. @set xref-record-size @xref{Blocking}
  276. @set pxref-record-size @pxref{Blocking}
  277. @set op-recursive-unlink @kbd{--recursive-unlink}
  278. @set ref-recursive-unlink @ref{Writing}
  279. @set xref-recursive-unlink @xref{Writing}
  280. @set pxref-recursive-unlink @pxref{Writing}
  281. @set op-read-full-records @kbd{--read-full-records} (@kbd{-B})
  282. @set ref-read-full-records @ref{Blocking}
  283. @set xref-read-full-records @xref{Blocking}
  284. @set pxref-read-full-records @pxref{Blocking}
  285. @c FIXME: or should it be Reading, or Blocking Factor
  286. @set op-remove-files @kbd{--remove-files}
  287. @set ref-remove-files @ref{Writing}
  288. @set xref-remove-files @xref{Writing}
  289. @set pxref-remove-files @pxref{Writing}
  290. @set op-rsh-command @kbd{rsh-command=@var{command}}
  291. @set op-same-order @kbd{--same-order} (@kbd{--preserve-order}, @kbd{-s})
  292. @set ref-same-order @ref{Scarce}
  293. @set xref-same-order @xref{Scarce}
  294. @set pxref-same-order @pxref{Scarce}
  295. @c FIXME: or should it be Reading, or Attributes?
  296. @set op-same-owner @kbd{--same-owner}
  297. @set ref-same-owner @ref{Attributes}
  298. @set xref-same-owner @xref{Attributes}
  299. @set pxref-same-owner @pxref{Attributes}
  300. @set op-same-permissions @kbd{--same-permissions} (@kbd{--preserve-permissions}, @kbd{-p})
  301. @set ref-same-permissions @ref{Attributes}
  302. @set xref-same-permissions @xref{Attributes}
  303. @set pxref-same-permissions @pxref{Attributes}
  304. @c FIXME: or should it be Writing?
  305. @set op-show-omitted-dirs @kbd{--show-omitted-dirs}
  306. @set ref-show-omitted-dirs @ref{verbose}
  307. @set xref-show-omitted-dirs @xref{verbose}
  308. @set pxref-show-omitted-dirs @pxref{verbose}
  309. @set op-sparse @kbd{--sparse} (@kbd{-S})
  310. @set ref-sparse @ref{sparse}
  311. @set xref-sparse @xref{sparse}
  312. @set pxref-sparse @pxref{sparse}
  313. @set op-starting-file @kbd{--starting-file=@var{name}} (@kbd{-K @var{name}})
  314. @set ref-starting-file @ref{Scarce}
  315. @set xref-starting-file @xref{Scarce}
  316. @set pxref-starting-file @pxref{Scarce}
  317. @set op-suffix @kbd{--suffix=@var{suffix}}
  318. @set ref-suffix @ref{Backup options}
  319. @set xref-suffix @xref{Backup options}
  320. @set pxref-suffix @pxref{Backup options}
  321. @set op-tape-length @kbd{--tape-length=@var{1024-size}} (@kbd{-L @var{1024-size}})
  322. @set ref-tape-length @ref{Using Multiple Tapes}
  323. @set xref-tape-length @xref{Using Multiple Tapes}
  324. @set pxref-tape-length @pxref{Using Multiple Tapes}
  325. @set op-to-stdout @kbd{--to-stdout} (@kbd{-O})
  326. @set ref-to-stdout @ref{Writing}
  327. @set xref-to-stdout @xref{Writing}
  328. @set pxref-to-stdout @pxref{Writing}
  329. @set op-totals @kbd{--totals}
  330. @set ref-totals @ref{verbose}
  331. @set xref-totals @xref{verbose}
  332. @set pxref-totals @pxref{verbose}
  333. @set op-touch @kbd{--touch} (@kbd{-m})
  334. @set ref-touch @ref{Writing}
  335. @set xref-touch @xref{Writing}
  336. @set pxref-touch @pxref{Writing}
  337. @set op-unlink-first @kbd{--unlink-first} (@kbd{-U})
  338. @set ref-unlink-first @ref{Writing}
  339. @set xref-unlink-first @xref{Writing}
  340. @set pxref-unlink-first @pxref{Writing}
  341. @set op-update @kbd{--update} (@kbd{-u})
  342. @set ref-update @ref{update}
  343. @set xref-update @xref{update}
  344. @set pxref-update @pxref{update}
  345. @set op-use-compress-prog @kbd{--use-compress-prog=@var{program}}
  346. @set ref-use-compress-prog @ref{gzip}
  347. @set xref-use-compress-prog @xref{gzip}
  348. @set pxref-use-compress-prog @pxref{gzip}
  349. @set op-verbose @kbd{--verbose} (@kbd{-v})
  350. @set ref-verbose @ref{verbose}
  351. @set xref-verbose @xref{verbose}
  352. @set pxref-verbose @pxref{verbose}
  353. @set op-verify @kbd{--verify} (@kbd{-W})
  354. @set ref-verify @ref{verify}
  355. @set xref-verify @xref{verify}
  356. @set pxref-verify @pxref{verify}
  357. @set op-version @kbd{--version}
  358. @set ref-version @ref{help}
  359. @set xref-version @xref{help}
  360. @set pxref-version @pxref{help}
  361. @set op-volno-file @kbd{--volno-file=@var{file-of-number}}
  362. @set ref-volno-file @ref{Using Multiple Tapes}
  363. @set xref-volno-file @xref{Using Multiple Tapes}
  364. @set pxref-volno-file @pxref{Using Multiple Tapes}
  365. @include version.texi
  366. @c Put everything in one index (arbitrarily chosen to be the concept index).
  367. @syncodeindex fn cp
  368. @syncodeindex ky cp
  369. @syncodeindex pg cp
  370. @syncodeindex vr cp
  371. @defindex op
  372. @syncodeindex op cp
  373. @dircategory GNU Packages
  374. @direntry
  375. * Tar: (tar). Making tape (or disk) archives.
  376. @end direntry
  377. @dircategory Individual utilities
  378. @direntry
  379. * tar: (tar)tar invocation. Invoking @sc{gnu} @command{tar}
  380. @end direntry
  381. @ifinfo
  382. This file documents @sc{gnu} @command{tar}, which creates and extracts
  383. files from archives.
  384. Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001 Free Software
  385. Foundation, Inc.
  386. Permission is granted to copy, distribute and/or modify this document
  387. under the terms of the GNU Free Documentation License, Version 1.1
  388. or any later version published by the Free Software Foundation;
  389. with no Invariant Sections, with no
  390. Front-Cover Texts, and with no Back-Cover Texts.
  391. A copy of the license is included in the section entitled ``GNU
  392. Free Documentation License''.
  393. @end ifinfo
  394. @shorttitlepage @sc{gnu} @command{tar}
  395. @titlepage
  396. @title @sc{gnu} tar: an archiver tool
  397. @subtitle @value{RENDITION} @value{VERSION}, @value{UPDATED}
  398. @author Melissa Weisshaus, Jay Fenlason,
  399. @author Thomas Bushnell, n/BSG, Amy Gorin
  400. @c he said to remove it: Fran@,{c}ois Pinard
  401. @c i'm thinking about how the author page *should* look. -mew 2may96
  402. @page
  403. @vskip 0pt plus 1filll
  404. Copyright @copyright{} 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001
  405. Free Software Foundation, Inc.
  406. Permission is granted to copy, distribute and/or modify this document
  407. under the terms of the GNU Free Documentation License, Version 1.1
  408. or any later version published by the Free Software Foundation;
  409. with no Invariant Sections, with no
  410. Front-Cover Texts, and with no Back-Cover Texts.
  411. A copy of the license is included in the section entitled ``GNU
  412. Free Documentation License''.
  413. @end titlepage
  414. @ifnottex
  415. @node Top
  416. @top @sc{gnu} tar: an archiver tool
  417. @cindex file archival
  418. @cindex archiving files
  419. @sc{gnu} @command{tar} creates and extracts files from archives.
  420. This manual documents version @value{VERSION} of @sc{gnu} @command{tar}.
  421. The first part of this master menu lists the major nodes in this Info
  422. document. The rest of the menu lists all the lower level nodes.
  423. @end ifnottex
  424. @c The master menu, created with texinfo-master-menu, goes here.
  425. @c (However, getdate.texi's menu is interpolated by hand.)
  426. @menu
  427. * Introduction::
  428. * Tutorial::
  429. * tar invocation::
  430. * operations::
  431. * Backups::
  432. * Choosing::
  433. * Date input formats::
  434. * Formats::
  435. * Media::
  436. * Free Software Needs Free Documentation::
  437. * Copying This Manual::
  438. * Index::
  439. @detailmenu
  440. --- The Detailed Node Listing ---
  441. Introduction
  442. * Book Contents:: What this Book Contains
  443. * Definitions:: Some Definitions
  444. * What tar Does:: What @command{tar} Does
  445. * Naming tar Archives:: How @command{tar} Archives are Named
  446. * posix compliance::
  447. * Authors:: @sc{gnu} @command{tar} Authors
  448. * Reports:: Reporting bugs or suggestions
  449. Tutorial Introduction to @command{tar}
  450. * assumptions::
  451. * stylistic conventions::
  452. * basic tar options:: Basic @command{tar} Operations and Options
  453. * frequent operations::
  454. * Two Frequent Options::
  455. * create:: How to Create Archives
  456. * list:: How to List Archives
  457. * extract:: How to Extract Members from an Archive
  458. * going further::
  459. Two Frequently Used Options
  460. * file tutorial::
  461. * verbose tutorial::
  462. * help tutorial::
  463. How to Create Archives
  464. * prepare for examples::
  465. * Creating the archive::
  466. * create verbose::
  467. * short create::
  468. * create dir::
  469. How to List Archives
  470. * list dir::
  471. How to Extract Members from an Archive
  472. * extracting archives::
  473. * extracting files::
  474. * extract dir::
  475. * failing commands::
  476. Invoking @sc{gnu} @command{tar}
  477. * Synopsis::
  478. * using tar options::
  479. * Styles::
  480. * All Options::
  481. * help::
  482. * verbose::
  483. * interactive::
  484. The Three Option Styles
  485. * Mnemonic Options:: Mnemonic Option Style
  486. * Short Options:: Short Option Style
  487. * Old Options:: Old Option Style
  488. * Mixing:: Mixing Option Styles
  489. All @command{tar} Options
  490. * Operation Summary::
  491. * Option Summary::
  492. * Short Option Summary::
  493. @sc{gnu} @command{tar} Operations
  494. * Basic tar::
  495. * Advanced tar::
  496. * create options::
  497. * extract options::
  498. * backup::
  499. * Applications::
  500. * looking ahead::
  501. Advanced @sc{gnu} @command{tar} Operations
  502. * Operations::
  503. * current state::
  504. * append::
  505. * update::
  506. * concatenate::
  507. * delete::
  508. * compare::
  509. How to Add Files to Existing Archives: @code{--append}
  510. * appending files:: Appending Files to an Archive
  511. * multiple::
  512. Updating an Archive
  513. * how to update::
  514. Options Used by @code{--create}
  515. * Ignore Failed Read::
  516. Options Used by @code{--extract}
  517. * Reading:: Options to Help Read Archives
  518. * Writing:: Changing How @command{tar} Writes Files
  519. * Scarce:: Coping with Scarce Resources
  520. Options to Help Read Archives
  521. * read full records::
  522. * Ignore Zeros::
  523. Changing How @command{tar} Writes Files
  524. * Dealing with Old Files::
  525. * Overwrite Old Files::
  526. * Keep Old Files::
  527. * Unlink First::
  528. * Recursive Unlink::
  529. * Modification Times::
  530. * Setting Access Permissions::
  531. * Writing to Standard Output::
  532. * remove files::
  533. Coping with Scarce Resources
  534. * Starting File::
  535. * Same Order::
  536. Performing Backups and Restoring Files
  537. * Full Dumps:: Using @command{tar} to Perform Full Dumps
  538. * Inc Dumps:: Using @command{tar} to Perform Incremental Dumps
  539. * incremental and listed-incremental:: The Incremental Options
  540. * Backup Levels:: Levels of Backups
  541. * Backup Parameters:: Setting Parameters for Backups and Restoration
  542. * Scripted Backups:: Using the Backup Scripts
  543. * Scripted Restoration:: Using the Restore Script
  544. Setting Parameters for Backups and Restoration
  545. * backup-specs example:: An Example Text of @file{Backup-specs}
  546. * Script Syntax:: Syntax for @file{Backup-specs}
  547. Choosing Files and Names for @command{tar}
  548. * file:: Choosing the Archive's Name
  549. * Selecting Archive Members::
  550. * files:: Reading Names from a File
  551. * exclude:: Excluding Some Files
  552. * Wildcards::
  553. * after:: Operating Only on New Files
  554. * recurse:: Descending into Directories
  555. * one:: Crossing Filesystem Boundaries
  556. Reading Names from a File
  557. * nul::
  558. Excluding Some Files
  559. * controlling pattern-patching with exclude::
  560. * problems with exclude::
  561. Crossing Filesystem Boundaries
  562. * directory:: Changing Directory
  563. * absolute:: Absolute File Names
  564. Date input formats
  565. * General date syntax:: Common rules.
  566. * Calendar date items:: 19 Dec 1994.
  567. * Time of day items:: 9:20pm.
  568. * Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}, ...
  569. * Day of week items:: Monday and others.
  570. * Relative items in date strings:: next tuesday, 2 years ago.
  571. * Pure numbers in date strings:: 19931219, 1440.
  572. * Authors of getdate:: Bellovin, Eggert, Salz, Berets, et al.
  573. Controlling the Archive Format
  574. * Portability:: Making @command{tar} Archives More Portable
  575. * Compression:: Using Less Space through Compression
  576. * Attributes:: Handling File Attributes
  577. * Standard:: The Standard Format
  578. * Extensions:: @sc{gnu} Extensions to the Archive Format
  579. * cpio:: Comparison of @command{tar} and @command{cpio}
  580. Making @command{tar} Archives More Portable
  581. * Portable Names:: Portable Names
  582. * dereference:: Symbolic Links
  583. * old:: Old V7 Archives
  584. * posix:: @sc{posix} archives
  585. * Checksumming:: Checksumming Problems
  586. * Large or Negative Values:: Large files, negative time stamps, etc.
  587. Using Less Space through Compression
  588. * gzip:: Creating and Reading Compressed Archives
  589. * sparse:: Archiving Sparse Files
  590. Tapes and Other Archive Media
  591. * Device:: Device selection and switching
  592. * Remote Tape Server::
  593. * Common Problems and Solutions::
  594. * Blocking:: Blocking
  595. * Many:: Many archives on one tape
  596. * Using Multiple Tapes:: Using Multiple Tapes
  597. * label:: Including a Label in the Archive
  598. * verify::
  599. * Write Protection::
  600. Blocking
  601. * Format Variations:: Format Variations
  602. * Blocking Factor:: The Blocking Factor of an Archive
  603. Many Archives on One Tape
  604. * Tape Positioning:: Tape Positions and Tape Marks
  605. * mt:: The @command{mt} Utility
  606. Using Multiple Tapes
  607. * Multi-Volume Archives:: Archives Longer than One Tape or Disk
  608. * Tape Files:: Tape Files
  609. Copying This Manual
  610. * GNU Free Documentation License:: License for copying this manual
  611. @end detailmenu
  612. @end menu
  613. @node Introduction
  614. @chapter Introduction
  615. Welcome to the @sc{gnu} @command{tar} manual. @sc{gnu} @command{tar} creates
  616. and manipulates (@dfn{archives}) which are actually collections of
  617. many other files; the program provides users with an organized and
  618. systematic method for controlling a large amount of data.
  619. @menu
  620. * Book Contents:: What this Book Contains
  621. * Definitions:: Some Definitions
  622. * What tar Does:: What @command{tar} Does
  623. * Naming tar Archives:: How @command{tar} Archives are Named
  624. * posix compliance::
  625. * Authors:: @sc{gnu} @command{tar} Authors
  626. * Reports:: Reporting bugs or suggestions
  627. @end menu
  628. @node Book Contents
  629. @section What this Book Contains
  630. The first part of this chapter introduces you to various terms that will
  631. recur throughout the book. It also tells you who has worked on @sc{gnu}
  632. @command{tar} and its documentation, and where you should send bug reports
  633. or comments.
  634. The second chapter is a tutorial (@pxref{Tutorial}) which provides a
  635. gentle introduction for people who are new to using @command{tar}. It is
  636. meant to be self contained, not requiring any reading from subsequent
  637. chapters to make sense. It moves from topic to topic in a logical,
  638. progressive order, building on information already explained.
  639. Although the tutorial is paced and structured to allow beginners to
  640. learn how to use @command{tar}, it is not intended solely for beginners.
  641. The tutorial explains how to use the three most frequently used
  642. operations (@samp{create}, @samp{list}, and @samp{extract}) as well as
  643. two frequently used options (@samp{file} and @samp{verbose}). The other
  644. chapters do not refer to the tutorial frequently; however, if a section
  645. discusses something which is a complex variant of a basic concept, there
  646. may be a cross reference to that basic concept. (The entire book,
  647. including the tutorial, assumes that the reader understands some basic
  648. concepts of using a Unix-type operating system; @pxref{Tutorial}.)
  649. The third chapter presents the remaining five operations, and
  650. information about using @command{tar} options and option syntax.
  651. @FIXME{this sounds more like a @sc{gnu} Project Manuals Concept [tm] more
  652. than the reality. should think about whether this makes sense to say
  653. here, or not.} The other chapters are meant to be used as a
  654. reference. Each chapter presents everything that needs to be said
  655. about a specific topic.
  656. One of the chapters (@pxref{Date input formats}) exists in its entirety
  657. in other @sc{gnu} manuals, and is mostly self-contained. In addition, one
  658. section of this manual (@pxref{Standard}) contains a big quote which is
  659. taken directly from @command{tar} sources.
  660. In general, we give both the long and short (abbreviated) option names
  661. at least once in each section where the relevant option is covered, so
  662. that novice readers will become familiar with both styles. (A few
  663. options have no short versions, and the relevant sections will
  664. indicate this.)
  665. @node Definitions
  666. @section Some Definitions
  667. @cindex archive
  668. @cindex tar archive
  669. The @command{tar} program is used to create and manipulate @command{tar}
  670. archives. An @dfn{archive} is a single file which contains the contents
  671. of many files, while still identifying the names of the files, their
  672. owner(s), and so forth. (In addition, archives record access
  673. permissions, user and group, size in bytes, and last modification time.
  674. Some archives also record the file names in each archived directory, as
  675. well as other file and directory information.) You can use @command{tar}
  676. to @dfn{create} a new archive in a specified directory.
  677. @cindex member
  678. @cindex archive member
  679. @cindex file name
  680. @cindex member name
  681. The files inside an archive are called @dfn{members}. Within this
  682. manual, we use the term @dfn{file} to refer only to files accessible in
  683. the normal ways (by @command{ls}, @command{cat}, and so forth), and the term
  684. @dfn{member} to refer only to the members of an archive. Similarly, a
  685. @dfn{file name} is the name of a file, as it resides in the filesystem,
  686. and a @dfn{member name} is the name of an archive member within the
  687. archive.
  688. @cindex extraction
  689. @cindex unpacking
  690. The term @dfn{extraction} refers to the process of copying an archive
  691. member (or multiple members) into a file in the filesystem. Extracting
  692. all the members of an archive is often called @dfn{extracting the
  693. archive}. The term @dfn{unpack} can also be used to refer to the
  694. extraction of many or all the members of an archive. Extracting an
  695. archive does not destroy the archive's structure, just as creating an
  696. archive does not destroy the copies of the files that exist outside of
  697. the archive. You may also @dfn{list} the members in a given archive
  698. (this is often thought of as ``printing'' them to the standard output,
  699. or the command line), or @dfn{append} members to a pre-existing archive.
  700. All of these operations can be performed using @command{tar}.
  701. @node What tar Does
  702. @section What @command{tar} Does
  703. @cindex tar
  704. The @command{tar} program provides the ability to create @command{tar}
  705. archives, as well as various other kinds of manipulation. For example,
  706. you can use @command{tar} on previously created archives to extract files,
  707. to store additional files, or to update or list files which were already
  708. stored.
  709. Initially, @command{tar} archives were used to store files conveniently on
  710. magnetic tape. The name @command{tar} comes from this use; it stands for
  711. @code{t}ape @code{ar}chiver. Despite the utility's name, @command{tar} can
  712. direct its output to available devices, files, or other programs (using
  713. pipes). @command{tar} may even access remote devices or files (as archives).
  714. @FIXME{the following table entries need a bit of work..}
  715. You can use @command{tar} archives in many ways. We want to stress a few
  716. of them: storage, backup, and transportation.
  717. @table @asis
  718. @item Storage
  719. Often, @command{tar} archives are used to store related files for
  720. convenient file transfer over a network. For example, the @sc{gnu} Project
  721. distributes its software bundled into @command{tar} archives, so that
  722. all the files relating to a particular program (or set of related
  723. programs) can be transferred as a single unit.
  724. A magnetic tape can store several files in sequence. However, the tape
  725. has no names for these files; it only knows their relative position on
  726. the tape. One way to store several files on one tape and retain their
  727. names is by creating a @command{tar} archive. Even when the basic transfer
  728. mechanism can keep track of names, as FTP can, the nuisance of handling
  729. multiple files, directories, and multiple links makes @command{tar}
  730. archives useful.
  731. Archive files are also used for long-term storage. You can think of
  732. this as transportation from the present into the future. (It is a
  733. science-fiction idiom that you can move through time as well as in
  734. space; the idea here is that @command{tar} can be used to move archives in
  735. all dimensions, even time!)
  736. @item Backup
  737. Because the archive created by @command{tar} is capable of preserving file
  738. information and directory structure, @command{tar} is commonly used for
  739. performing full and incremental backups of disks. A backup puts a
  740. collection of files (possibly pertaining to many users and
  741. projects) together on a disk or a tape. This guards against accidental
  742. destruction of the information in those files. @sc{gnu} @command{tar} has
  743. special features that allow it to be used to make incremental and full
  744. dumps of all the files in a filesystem.
  745. @item Transportation
  746. You can create an archive on one system, transfer it to another system,
  747. and extract the contents there. This allows you to transport a group of
  748. files from one system to another.
  749. @end table
  750. @node Naming tar Archives
  751. @section How @command{tar} Archives are Named
  752. Conventionally, @command{tar} archives are given names ending with
  753. @samp{.tar}. This is not necessary for @command{tar} to operate properly,
  754. but this manual follows that convention in order to accustom readers to
  755. it and to make examples more clear.
  756. @cindex tar file
  757. @cindex entry
  758. @cindex tar entry
  759. Often, people refer to @command{tar} archives as ``@command{tar} files,'' and
  760. archive members as ``files'' or ``entries''. For people familiar with
  761. the operation of @command{tar}, this causes no difficulty. However, in
  762. this manual, we consistently refer to ``archives'' and ``archive
  763. members'' to make learning to use @command{tar} easier for novice users.
  764. @node posix compliance
  765. @section @sc{posix} Compliance
  766. @noindent
  767. @FIXME{must ask franc,ois about this. dan hagerty thinks this might
  768. be an issue, but we're not really sure at this time. dan just tried a
  769. test case of mixing up options' orders while the variable was set, and
  770. there was no problem...}
  771. We make some of our recommendations throughout this book for one
  772. reason in addition to what we think of as ``good sense''. The main
  773. additional reason for a recommendation is to be compliant with the
  774. @sc{posix} standards. If you set the shell environment variable
  775. @env{POSIXLY_CORRECT}, @sc{gnu} @command{tar} will force you to adhere to
  776. these standards. Therefore, if this variable is set and you violate
  777. one of the @sc{posix} standards in the way you phrase a command, for
  778. example, @sc{gnu} @command{tar} will not allow the command and will signal an
  779. error message. You would then have to reorder the options or rephrase
  780. the command to comply with the @sc{posix} standards.
  781. There is a chance in the future that, if you set this environment
  782. variable, your archives will be forced to comply with @sc{posix} standards,
  783. also. No @sc{gnu} @command{tar} extensions will be allowed.
  784. @node Authors
  785. @section @sc{gnu} @command{tar} Authors
  786. @sc{gnu} @command{tar} was originally written by John Gilmore, and modified by
  787. many people. The @sc{gnu} enhancements were written by Jay Fenlason, then
  788. Joy Kendall, and the whole package has been further maintained by
  789. Thomas Bushnell, n/BSG, and finally Fran@,{c}ois Pinard, with
  790. the help of numerous and kind users.
  791. We wish to stress that @command{tar} is a collective work, and owes much to
  792. all those people who reported problems, offered solutions and other
  793. insights, or shared their thoughts and suggestions. An impressive, yet
  794. partial list of those contributors can be found in the @file{THANKS}
  795. file from the @sc{gnu} @command{tar} distribution.
  796. @FIXME{i want all of these names mentioned, Absolutely. BUT, i'm not
  797. sure i want to spell out the history in this detail, at least not for
  798. the printed book. i'm just not sure it needs to be said this way.
  799. i'll think about it.}
  800. @FIXME{History is more important, and surely more interesting, than
  801. actual names. Quoting names without history would be meaningless. FP}
  802. Jay Fenlason put together a draft of a @sc{gnu} @command{tar} manual,
  803. borrowing notes from the original man page from John Gilmore. This
  804. was withdrawn in version
  805. 1.11. Thomas Bushnell, n/BSG and Amy Gorin worked on a tutorial and
  806. manual for @sc{gnu} @command{tar}. Fran@,{c}ois Pinard put version 1.11.8
  807. of the manual together by taking information from all these sources
  808. and merging them. Melissa Weisshaus finally edited and redesigned the
  809. book to create version 1.12. @FIXME{update version number as
  810. necessary; i'm being optimistic!} @FIXME{Someone [maybe karl berry?
  811. maybe bob chassell? maybe melissa? maybe julie sussman?] needs to
  812. properly index the thing.}
  813. For version 1.12, Daniel Hagerty contributed a great deal of technical
  814. consulting. In particular, he is the primary author of @ref{Backups}.
  815. @node Reports
  816. @section Reporting bugs or suggestions
  817. @cindex bug reports
  818. @cindex reporting bugs
  819. If you find problems or have suggestions about this program or manual,
  820. please report them to @file{bug-tar@@gnu.org}.
  821. @node Tutorial
  822. @chapter Tutorial Introduction to @command{tar}
  823. This chapter guides you through some basic examples of three @command{tar}
  824. operations: @samp{--create}, @samp{--list}, and @samp{--extract}. If
  825. you already know how to use some other version of @command{tar}, then you
  826. may not need to read this chapter. This chapter omits most complicated
  827. details about how @command{tar} works.
  828. @menu
  829. * assumptions::
  830. * stylistic conventions::
  831. * basic tar options:: Basic @command{tar} Operations and Options
  832. * frequent operations::
  833. * Two Frequent Options::
  834. * create:: How to Create Archives
  835. * list:: How to List Archives
  836. * extract:: How to Extract Members from an Archive
  837. * going further::
  838. @end menu
  839. @node assumptions
  840. @section Assumptions this Tutorial Makes
  841. This chapter is paced to allow beginners to learn about @command{tar}
  842. slowly. At the same time, we will try to cover all the basic aspects of
  843. these three operations. In order to accomplish both of these tasks, we
  844. have made certain assumptions about your knowledge before reading this
  845. manual, and the hardware you will be using:
  846. @itemize @bullet
  847. @item
  848. Before you start to work through this tutorial, you should understand
  849. what the terms ``archive'' and ``archive member'' mean
  850. (@pxref{Definitions}). In addition, you should understand something
  851. about how Unix-type operating systems work, and you should know how to
  852. use some basic utilities. For example, you should know how to create,
  853. list, copy, rename, edit, and delete files and directories; how to
  854. change between directories; and how to figure out where you are in the
  855. filesystem. You should have some basic understanding of directory
  856. structure and how files are named according to which directory they are
  857. in. You should understand concepts such as standard output and standard
  858. input, what various definitions of the term ``argument'' mean, and the
  859. differences between relative and absolute path names. @FIXME{and what
  860. else?}
  861. @item
  862. This manual assumes that you are working from your own home directory
  863. (unless we state otherwise). In this tutorial, you will create a
  864. directory to practice @command{tar} commands in. When we show path names,
  865. we will assume that those paths are relative to your home directory.
  866. For example, my home directory path is @file{/home/fsf/melissa}. All of
  867. my examples are in a subdirectory of the directory named by that path
  868. name; the subdirectory is called @file{practice}.
  869. @item
  870. In general, we show examples of archives which exist on (or can be
  871. written to, or worked with from) a directory on a hard disk. In most
  872. cases, you could write those archives to, or work with them on any other
  873. device, such as a tape drive. However, some of the later examples in
  874. the tutorial and next chapter will not work on tape drives.
  875. Additionally, working with tapes is much more complicated than working
  876. with hard disks. For these reasons, the tutorial does not cover working
  877. with tape drives. @xref{Media}, for complete information on using
  878. @command{tar} archives with tape drives.
  879. @FIXME{this is a cop out. need to add some simple tape drive info.}
  880. @end itemize
  881. @node stylistic conventions
  882. @section Stylistic Conventions
  883. In the examples, @samp{$} represents a typical shell prompt. It
  884. precedes lines you should type; to make this more clear, those lines are
  885. shown in @kbd{this font}, as opposed to lines which represent the
  886. computer's response; those lines are shown in @code{this font}, or
  887. sometimes @samp{like this}. When we have lines which are too long to be
  888. displayed in any other way, we will show them like this:
  889. @smallexample
  890. This is an example of a line which would otherwise not fit in this space.
  891. @end smallexample
  892. @FIXME{how often do we use smallexample?}
  893. @node basic tar options
  894. @section Basic @command{tar} Operations and Options
  895. @command{tar} can take a wide variety of arguments which specify and define
  896. the actions it will have on the particular set of files or the archive.
  897. The main types of arguments to @command{tar} fall into one of two classes:
  898. operations, and options.
  899. Some arguments fall into a class called @dfn{operations}; exactly one of
  900. these is both allowed and required for any instance of using @command{tar};
  901. you may @emph{not} specify more than one. People sometimes speak of
  902. @dfn{operating modes}. You are in a particular operating mode when you
  903. have specified the operation which specifies it; there are eight
  904. operations in total, and thus there are eight operating modes.
  905. The other arguments fall into the class known as @dfn{options}. You are
  906. not required to specify any options, and you are allowed to specify more
  907. than one at a time (depending on the way you are using @command{tar} at
  908. that time). Some options are used so frequently, and are so useful for
  909. helping you type commands more carefully that they are effectively
  910. ``required''. We will discuss them in this chapter.
  911. You can write most of the @command{tar} operations and options in any of
  912. three forms: long (mnemonic) form, short form, and old style. Some of
  913. the operations and options have no short or ``old'' forms; however, the
  914. operations and options which we will cover in this tutorial have
  915. corresponding abbreviations. @FIXME{make sure this is still the case,
  916. at the end}We will indicate those abbreviations appropriately to get
  917. you used to seeing them. (Note that the ``old style'' option forms
  918. exist in @sc{gnu} @command{tar} for compatibility with Unix @command{tar}. We
  919. present a full discussion of this way of writing options and operations
  920. appears in @ref{Old Options}, and we discuss the other two styles of
  921. writing options in @ref{Mnemonic Options} and @ref{Short Options}.)
  922. In the examples and in the text of this tutorial, we usually use the
  923. long forms of operations and options; but the ``short'' forms produce
  924. the same result and can make typing long @command{tar} commands easier.
  925. For example, instead of typing
  926. @example
  927. @kbd{tar --create --verbose --file=afiles.tar apple angst aspic}
  928. @end example
  929. @noindent
  930. you can type
  931. @example
  932. @kbd{tar -c -v -f afiles.tar apple angst aspic}
  933. @end example
  934. @noindent
  935. or even
  936. @example
  937. @kbd{tar -cvf afiles.tar apple angst aspic}
  938. @end example
  939. @noindent
  940. For more information on option syntax, see @ref{Advanced tar}. In
  941. discussions in the text, when we name an option by its long form, we
  942. also give the corresponding short option in parentheses.
  943. The term, ``option'', can be confusing at times, since ``operations''
  944. are often lumped in with the actual, @emph{optional} ``options'' in certain
  945. general class statements. For example, we just talked about ``short and
  946. long forms of options and operations''. However, experienced @command{tar}
  947. users often refer to these by shorthand terms such as, ``short and long
  948. options''. This term assumes that the ``operations'' are included, also.
  949. Context will help you determine which definition of ``options'' to use.
  950. Similarly, the term ``command'' can be confusing, as it is often used in
  951. two different ways. People sometimes refer to @command{tar} ``commands''.
  952. A @command{tar} @dfn{command} is the entire command line of user input
  953. which tells @command{tar} what to do --- including the operation, options,
  954. and any arguments (file names, pipes, other commands, etc). However,
  955. you will also sometimes hear the term ``the @command{tar} command''. When
  956. the word ``command'' is used specifically like this, a person is usually
  957. referring to the @command{tar} @emph{operation}, not the whole line.
  958. Again, use context to figure out which of the meanings the speaker
  959. intends.
  960. @node frequent operations
  961. @section The Three Most Frequently Used Operations
  962. Here are the three most frequently used operations (both short and long
  963. forms), as well as a brief description of their meanings. The rest of
  964. this chapter will cover how to use these operations in detail. We will
  965. present the rest of the operations in the next chapter.
  966. @table @kbd
  967. @item --create
  968. @itemx -c
  969. Create a new @command{tar} archive.
  970. @item --list
  971. @itemx -t
  972. List the contents of an archive.
  973. @item --extract
  974. @itemx -x
  975. Extract one or more members from an archive.
  976. @end table
  977. @node Two Frequent Options
  978. @section Two Frequently Used Options
  979. To understand how to run @command{tar} in the three operating modes listed
  980. previously, you also need to understand how to use two of the options to
  981. @command{tar}: @samp{--file} (which takes an archive file as an argument)
  982. and @samp{--verbose}. (You are usually not @emph{required} to specify
  983. either of these options when you run @command{tar}, but they can be very
  984. useful in making things more clear and helping you avoid errors.)
  985. @menu
  986. * file tutorial::
  987. * verbose tutorial::
  988. * help tutorial::
  989. @end menu
  990. @node file tutorial
  991. @unnumberedsubsec The @samp{--file} Option
  992. @table @kbd
  993. @item --file=@var{archive-name}
  994. @itemx -f @var{archive-name}
  995. Specify the name of an archive file.
  996. @end table
  997. You can specify an argument for the @value{op-file} option whenever you
  998. use @command{tar}; this option determines the name of the archive file
  999. that @command{tar} will work on.
  1000. If you don't specify this argument, then @command{tar} will use a
  1001. default, usually some physical tape drive attached to your machine.
  1002. If there is no tape drive attached, or the default is not meaningful,
  1003. then @command{tar} will print an error message. The error message might
  1004. look roughly like one of the following:
  1005. @example
  1006. tar: can't open /dev/rmt8 : No such device or address
  1007. tar: can't open /dev/rsmt0 : I/O error
  1008. @end example
  1009. @noindent
  1010. To avoid confusion, we recommend that you always specify an archive file
  1011. name by using @value{op-file} when writing your @command{tar} commands.
  1012. For more information on using the @value{op-file} option, see
  1013. @ref{file}.
  1014. @node verbose tutorial
  1015. @unnumberedsubsec The @samp{--verbose} Option
  1016. @table @kbd
  1017. @item --verbose
  1018. @itemx -v
  1019. Show the files being worked on as @command{tar} is running.
  1020. @end table
  1021. @value{op-verbose} shows details about the results of running
  1022. @command{tar}. This can be especially useful when the results might not be
  1023. obvious. For example, if you want to see the progress of @command{tar} as
  1024. it writes files into the archive, you can use the @samp{--verbose}
  1025. option. In the beginning, you may find it useful to use
  1026. @samp{--verbose} at all times; when you are more accustomed to
  1027. @command{tar}, you will likely want to use it at certain times but not at
  1028. others. We will use @samp{--verbose} at times to help make something
  1029. clear, and we will give many examples both using and not using
  1030. @samp{--verbose} to show the differences.
  1031. Sometimes, a single instance of @samp{--verbose} on the command line
  1032. will show a full, @samp{ls} style listing of an archive or files,
  1033. giving sizes, owners, and similar information. Other times,
  1034. @samp{--verbose} will only show files or members that the particular
  1035. operation is operating on at the time. In the latter case, you can
  1036. use @samp{--verbose} twice in a command to get a listing such as that
  1037. in the former case. For example, instead of saying
  1038. @example
  1039. @kbd{tar -cvf afiles.tar apple angst aspic}
  1040. @end example
  1041. @noindent
  1042. above, you might say
  1043. @example
  1044. @kbd{tar -cvvf afiles.tar apple angst aspic}
  1045. @end example
  1046. @noindent
  1047. This works equally well using short or long forms of options. Using
  1048. long forms, you would simply write out the mnemonic form of the option
  1049. twice, like this:
  1050. @example
  1051. $ @kbd{tar --create --verbose --verbose @dots{}}
  1052. @end example
  1053. @noindent
  1054. Note that you must double the hyphens properly each time.
  1055. Later in the tutorial, we will give examples using @w{@samp{--verbose
  1056. --verbose}}.
  1057. @node help tutorial
  1058. @unnumberedsubsec Getting Help: Using the @code{--help} Option
  1059. @table @kbd
  1060. @item --help
  1061. The @samp{--help} option to @command{tar} prints out a very brief list of
  1062. all operations and option available for the current version of
  1063. @command{tar} available on your system.
  1064. @end table
  1065. @node create
  1066. @section How to Create Archives
  1067. @UNREVISED
  1068. One of the basic operations of @command{tar} is @value{op-create}, which
  1069. you use to create a @command{tar} archive. We will explain
  1070. @samp{--create} first because, in order to learn about the other
  1071. operations, you will find it useful to have an archive available to
  1072. practice on.
  1073. To make this easier, in this section you will first create a directory
  1074. containing three files. Then, we will show you how to create an
  1075. @emph{archive} (inside the new directory). Both the directory, and
  1076. the archive are specifically for you to practice on. The rest of this
  1077. chapter and the next chapter will show many examples using this
  1078. directory and the files you will create: some of those files may be
  1079. other directories and other archives.
  1080. The three files you will archive in this example are called
  1081. @file{blues}, @file{folk}, and @file{jazz}. The archive is called
  1082. @file{collection.tar}.
  1083. This section will proceed slowly, detailing how to use @samp{--create}
  1084. in @code{verbose} mode, and showing examples using both short and long
  1085. forms. In the rest of the tutorial, and in the examples in the next
  1086. chapter, we will proceed at a slightly quicker pace. This section
  1087. moves more slowly to allow beginning users to understand how
  1088. @command{tar} works.
  1089. @menu
  1090. * prepare for examples::
  1091. * Creating the archive::
  1092. * create verbose::
  1093. * short create::
  1094. * create dir::
  1095. @end menu
  1096. @node prepare for examples
  1097. @subsection Preparing a Practice Directory for Examples
  1098. To follow along with this and future examples, create a new directory
  1099. called @file{practice} containing files called @file{blues}, @file{folk}
  1100. and @file{jazz}. The files can contain any information you like:
  1101. ideally, they should contain information which relates to their names,
  1102. and be of different lengths. Our examples assume that @file{practice}
  1103. is a subdirectory of your home directory.
  1104. Now @command{cd} to the directory named @file{practice}; @file{practice}
  1105. is now your @dfn{working directory}. (@emph{Please note}: Although
  1106. the full path name of this directory is
  1107. @file{/@var{homedir}/practice}, in our examples we will refer to
  1108. this directory as @file{practice}; the @var{homedir} is presumed.
  1109. In general, you should check that the files to be archived exist where
  1110. you think they do (in the working directory) by running @command{ls}.
  1111. Because you just created the directory and the files and have changed to
  1112. that directory, you probably don't need to do that this time.
  1113. It is very important to make sure there isn't already a file in the
  1114. working directory with the archive name you intend to use (in this case,
  1115. @samp{collection.tar}), or that you don't care about its contents.
  1116. Whenever you use @samp{create}, @command{tar} will erase the current
  1117. contents of the file named by @value{op-file} if it exists. @command{tar}
  1118. will not tell you if you are about to overwrite an archive unless you
  1119. specify an option which does this. @FIXME{xref to the node for
  1120. --backup!}To add files to an existing archive, you need to use a
  1121. different option, such as @value{op-append}; see @ref{append} for
  1122. information on how to do this.
  1123. @node Creating the archive
  1124. @subsection Creating the Archive
  1125. To place the files @file{blues}, @file{folk}, and @file{jazz} into an
  1126. archive named @file{collection.tar}, use the following command:
  1127. @example
  1128. $ @kbd{tar --create --file=collection.tar blues folk jazz}
  1129. @end example
  1130. The order of the arguments is not very important, @emph{when using long
  1131. option forms}. You could also say:
  1132. @example
  1133. $ @kbd{tar blues --create folk --file=collection.tar jazz}
  1134. @end example
  1135. @noindent
  1136. However, you can see that this order is harder to understand; this is
  1137. why we will list the arguments in the order that makes the commands
  1138. easiest to understand (and we encourage you to do the same when you use
  1139. @command{tar}, to avoid errors).
  1140. Note that the part of the command which says,
  1141. @w{@kbd{--file=collection.tar}} is considered to be @emph{one} argument.
  1142. If you substituted any other string of characters for
  1143. @kbd{collection.tar}, then that string would become the name of the
  1144. archive file you create.
  1145. The order of the options becomes more important when you begin to use
  1146. short forms. With short forms, if you type commands in the wrong order
  1147. (even if you type them correctly in all other ways), you may end up with
  1148. results you don't expect. For this reason, it is a good idea to get
  1149. into the habit of typing options in the order that makes inherent sense.
  1150. @xref{short create}, for more information on this.
  1151. In this example, you type the command as shown above: @samp{--create}
  1152. is the operation which creates the new archive
  1153. (@file{collection.tar}), and @samp{--file} is the option which lets
  1154. you give it the name you chose. The files, @file{blues}, @file{folk},
  1155. and @file{jazz}, are now members of the archive, @file{collection.tar}
  1156. (they are @dfn{file name arguments} to the @samp{--create} operation).
  1157. @FIXME{xref here to the discussion of file name args?}Now that they are
  1158. in the archive, they are called @emph{archive members}, not files.
  1159. @FIXME{xref to definitions?}
  1160. When you create an archive, you @emph{must} specify which files you want
  1161. placed in the archive. If you do not specify any archive members, @sc{gnu}
  1162. @command{tar} will complain.
  1163. If you now list the contents of the working directory (@kbd{ls}), you will
  1164. find the archive file listed as well as the files you saw previously:
  1165. @example
  1166. blues folk jazz collection.tar
  1167. @end example
  1168. @noindent
  1169. Creating the archive @samp{collection.tar} did not destroy the copies of
  1170. the files in the directory.
  1171. Keep in mind that if you don't indicate an operation, @command{tar} will not
  1172. run and will prompt you for one. If you don't name any files, @command{tar}
  1173. will complain. You must have write access to the working directory,
  1174. or else you will not be able to create an archive in that directory.
  1175. @emph{Caution}: Do not attempt to use @value{op-create} to add files to
  1176. an existing archive; it will delete the archive and write a new one.
  1177. Use @value{op-append} instead. @xref{append}.
  1178. @node create verbose
  1179. @subsection Running @samp{--create} with @samp{--verbose}
  1180. If you include the @value{op-verbose} option on the command line,
  1181. @command{tar} will list the files it is acting on as it is working. In
  1182. verbose mode, the @code{create} example above would appear as:
  1183. @example
  1184. $ @kbd{tar --create --verbose --file=collection.tar blues folk jazz}
  1185. blues
  1186. folk
  1187. jazz
  1188. @end example
  1189. This example is just like the example we showed which did not use
  1190. @samp{--verbose}, except that @command{tar} generated the remaining lines
  1191. @iftex
  1192. (note the different font styles).
  1193. @end iftex
  1194. @ifinfo
  1195. .
  1196. @end ifinfo
  1197. In the rest of the examples in this chapter, we will frequently use
  1198. @code{verbose} mode so we can show actions or @command{tar} responses that
  1199. you would otherwise not see, and which are important for you to
  1200. understand.
  1201. @node short create
  1202. @subsection Short Forms with @samp{create}
  1203. As we said before, the @value{op-create} operation is one of the most
  1204. basic uses of @command{tar}, and you will use it countless times.
  1205. Eventually, you will probably want to use abbreviated (or ``short'')
  1206. forms of options. A full discussion of the three different forms that
  1207. options can take appears in @ref{Styles}; for now, here is what the
  1208. previous example (including the @value{op-verbose} option) looks like
  1209. using short option forms:
  1210. @example
  1211. $ @kbd{tar -cvf collection.tar blues folk jazz}
  1212. blues
  1213. folk
  1214. jazz
  1215. @end example
  1216. @noindent
  1217. As you can see, the system responds the same no matter whether you use
  1218. long or short option forms.
  1219. @FIXME{i don't like how this is worded:} One difference between using
  1220. short and long option forms is that, although the exact placement of
  1221. arguments following options is no more specific when using short forms,
  1222. it is easier to become confused and make a mistake when using short
  1223. forms. For example, suppose you attempted the above example in the
  1224. following way:
  1225. @example
  1226. $ @kbd{tar -cfv collection.tar blues folk jazz}
  1227. @end example
  1228. @noindent
  1229. In this case, @command{tar} will make an archive file called @file{v},
  1230. containing the files @file{blues}, @file{folk}, and @file{jazz}, because
  1231. the @samp{v} is the closest ``file name'' to the @samp{-f} option, and
  1232. is thus taken to be the chosen archive file name. @command{tar} will try
  1233. to add a file called @file{collection.tar} to the @file{v} archive file;
  1234. if the file @file{collection.tar} did not already exist, @command{tar} will
  1235. report an error indicating that this file does not exist. If the file
  1236. @file{collection.tar} does already exist (e.g., from a previous command
  1237. you may have run), then @command{tar} will add this file to the archive.
  1238. Because the @samp{-v} option did not get registered, @command{tar} will not
  1239. run under @samp{verbose} mode, and will not report its progress.
  1240. The end result is that you may be quite confused about what happened,
  1241. and possibly overwrite a file. To illustrate this further, we will show
  1242. you how an example we showed previously would look using short forms.
  1243. This example,
  1244. @example
  1245. $ @kbd{tar blues --create folk --file=collection.tar jazz}
  1246. @end example
  1247. @noindent
  1248. is confusing as it is. When shown using short forms, however, it
  1249. becomes much more so:
  1250. @example
  1251. $ @kbd{tar blues -c folk -f collection.tar jazz}
  1252. @end example
  1253. @noindent
  1254. It would be very easy to put the wrong string of characters
  1255. immediately following the @samp{-f}, but doing that could sacrifice
  1256. valuable data.
  1257. For this reason, we recommend that you pay very careful attention to
  1258. the order of options and placement of file and archive names,
  1259. especially when using short option forms. Not having the option name
  1260. written out mnemonically can affect how well you remember which option
  1261. does what, and therefore where different names have to be placed.
  1262. (Placing options in an unusual order can also cause @command{tar} to
  1263. report an error if you have set the shell environment variable
  1264. @env{POSIXLY_CORRECT}; @pxref{posix compliance} for more information
  1265. on this.)
  1266. @node create dir
  1267. @subsection Archiving Directories
  1268. @cindex Archiving Directories
  1269. @cindex Directories, Archiving
  1270. You can archive a directory by specifying its directory name as a
  1271. file name argument to @command{tar}. The files in the directory will be
  1272. archived relative to the working directory, and the directory will be
  1273. re-created along with its contents when the archive is extracted.
  1274. To archive a directory, first move to its superior directory. If you
  1275. have followed the previous instructions in this tutorial, you should
  1276. type:
  1277. @example
  1278. $ @kbd{cd ..}
  1279. $
  1280. @end example
  1281. @noindent
  1282. This will put you into the directory which contains @file{practice},
  1283. i.e. your home directory. Once in the superior directory, you can
  1284. specify the subdirectory, @file{practice}, as a file name argument. To
  1285. store @file{practice} in the new archive file @file{music.tar}, type:
  1286. @example
  1287. $ @kbd{tar --create --verbose --file=music.tar practice}
  1288. @end example
  1289. @noindent
  1290. @command{tar} should output:
  1291. @example
  1292. practice/
  1293. practice/blues
  1294. practice/folk
  1295. practice/jazz
  1296. practice/collection.tar
  1297. @end example
  1298. Note that the archive thus created is not in the subdirectory
  1299. @file{practice}, but rather in the current working directory---the
  1300. directory from which @command{tar} was invoked. Before trying to archive a
  1301. directory from its superior directory, you should make sure you have
  1302. write access to the superior directory itself, not only the directory
  1303. you are trying archive with @command{tar}. For example, you will probably
  1304. not be able to store your home directory in an archive by invoking
  1305. @command{tar} from the root directory; @value{xref-absolute-names}. (Note
  1306. also that @file{collection.tar}, the original archive file, has itself
  1307. been archived. @command{tar} will accept any file as a file to be
  1308. archived, regardless of its content. When @file{music.tar} is
  1309. extracted, the archive file @file{collection.tar} will be re-written
  1310. into the file system).
  1311. If you give @command{tar} a command such as
  1312. @example
  1313. $ @kbd{tar --create --file=foo.tar .}
  1314. @end example
  1315. @noindent
  1316. @command{tar} will report @samp{tar: ./foo.tar is the archive; not dumped}.
  1317. This happens because @command{tar} creates the archive @file{foo.tar} in
  1318. the current directory before putting any files into it. Then, when
  1319. @command{tar} attempts to add all the files in the directory @file{.} to
  1320. the archive, it notices that the file @file{./foo.tar} is the same as the
  1321. archive @file{foo.tar}, and skips it. (It makes no sense to put an archive
  1322. into itself.) @sc{gnu} @command{tar} will continue in this case, and create the
  1323. archive normally, except for the exclusion of that one file.
  1324. (@emph{Please note:} Other versions of @command{tar} are not so clever;
  1325. they will enter an infinite loop when this happens, so you should not
  1326. depend on this behavior unless you are certain you are running @sc{gnu}
  1327. @command{tar}.) @FIXME{bob doesn't like this sentence, since he does it
  1328. all the time, and we've been doing it in the editing passes for this
  1329. manual: In general, make sure that the archive is not inside a
  1330. directory being dumped.}
  1331. @node list
  1332. @section How to List Archives
  1333. Frequently, you will find yourself wanting to determine exactly what a
  1334. particular archive contains. You can use the @value{op-list} operation
  1335. to get the member names as they currently appear in the archive, as well
  1336. as various attributes of the files at the time they were archived. For
  1337. example, you can examine the archive @file{collection.tar} that you
  1338. created in the last section with the command,
  1339. @example
  1340. $ @kbd{tar --list --file=collection.tar}
  1341. @end example
  1342. @noindent
  1343. The output of @command{tar} would then be:
  1344. @example
  1345. blues
  1346. folk
  1347. jazz
  1348. @end example
  1349. @FIXME{we hope this will change. if it doesn't, need to show the
  1350. creation of bfiles somewhere above!!! : }
  1351. @noindent
  1352. The archive @file{bfiles.tar} would list as follows:
  1353. @example
  1354. ./birds
  1355. baboon
  1356. ./box
  1357. @end example
  1358. @noindent
  1359. Be sure to use a @value{op-file} option just as with @value{op-create}
  1360. to specify the name of the archive.
  1361. If you use the @value{op-verbose} option with @samp{--list}, then
  1362. @command{tar} will print out a listing reminiscent of @w{@samp{ls -l}},
  1363. showing owner, file size, and so forth.
  1364. If you had used @value{op-verbose} mode, the example above would look
  1365. like:
  1366. @example
  1367. $ @kbd{tar --list --verbose --file=collection.tar folk}
  1368. -rw-rw-rw- myself user 62 1990-05-23 10:55 folk
  1369. @end example
  1370. @cindex File name arguments, using @code{--list} with
  1371. @cindex @code{--list} with file name arguments
  1372. You can specify one or more individual member names as arguments when
  1373. using @samp{list}. In this case, @command{tar} will only list the
  1374. names of members you identify. For example, @w{@kbd{tar --list
  1375. --file=afiles.tar apple}} would only print @file{apple}.
  1376. @FIXME{we hope the relevant aspects of this will change:}Because
  1377. @command{tar} preserves paths, file names must be specified as they appear
  1378. in the archive (ie., relative to the directory from which the archive
  1379. was created). Therefore, it is essential when specifying member names
  1380. to @command{tar} that you give the exact member names. For example,
  1381. @w{@kbd{tar --list --file=bfiles birds}} would produce an error message
  1382. something like @samp{tar: birds: Not found in archive}, because there is
  1383. no member named @file{birds}, only one named @file{./birds}. While the
  1384. names @file{birds} and @file{./birds} name the same file, @emph{member}
  1385. names are compared using a simplistic name comparison, in which an exact
  1386. match is necessary. @xref{absolute}.
  1387. However, @w{@kbd{tar --list --file=collection.tar folk}} would respond
  1388. with @file{folk}, because @file{folk} is in the archive file
  1389. @file{collection.tar}. If you are not sure of the exact file name, try
  1390. listing all the files in the archive and searching for the one you
  1391. expect to find; remember that if you use @samp{--list} with no file
  1392. names as arguments, @command{tar} will print the names of all the members
  1393. stored in the specified archive.
  1394. @menu
  1395. * list dir::
  1396. @end menu
  1397. @node list dir
  1398. @unnumberedsubsec Listing the Contents of a Stored Directory
  1399. @UNREVISED
  1400. @FIXME{i changed the order of these nodes around and haven't had a
  1401. chance to play around with this node's example, yet. i have to play
  1402. with it and see what it actually does for my own satisfaction, even if
  1403. what it says *is* correct..}
  1404. To get information about the contents of an archived directory,
  1405. use the directory name as a file name argument in conjunction with
  1406. @value{op-list}. To find out file attributes, include the
  1407. @value{op-verbose} option.
  1408. For example, to find out about files in the directory @file{practice}, in
  1409. the archive file @file{music.tar}, type:
  1410. @example
  1411. $ @kbd{tar --list --verbose --file=music.tar practice}
  1412. @end example
  1413. @command{tar} responds:
  1414. @example
  1415. drwxrwxrwx myself user 0 1990-05-31 21:49 practice/
  1416. -rw-rw-rw- myself user 42 1990-05-21 13:29 practice/blues
  1417. -rw-rw-rw- myself user 62 1990-05-23 10:55 practice/folk
  1418. -rw-rw-rw- myself user 40 1990-05-21 13:30 practice/jazz
  1419. -rw-rw-rw- myself user 10240 1990-05-31 21:49 practice/collection.tar
  1420. @end example
  1421. When you use a directory name as a file name argument, @command{tar} acts on
  1422. all the files (including sub-directories) in that directory.
  1423. @node extract
  1424. @section How to Extract Members from an Archive
  1425. @UNREVISED
  1426. @cindex Extraction
  1427. @cindex Retrieving files from an archive
  1428. @cindex Resurrecting files from an archive
  1429. Creating an archive is only half the job---there is no point in storing
  1430. files in an archive if you can't retrieve them. The act of retrieving
  1431. members from an archive so they can be used and manipulated as
  1432. unarchived files again is called @dfn{extraction}. To extract files
  1433. from an archive, use the @value{op-extract} operation. As with
  1434. @value{op-create}, specify the name of the archive with @value{op-file}.
  1435. Extracting an archive does not modify the archive in any way; you can
  1436. extract it multiple times if you want or need to.
  1437. Using @samp{--extract}, you can extract an entire archive, or specific
  1438. files. The files can be directories containing other files, or not. As
  1439. with @value{op-create} and @value{op-list}, you may use the short or the
  1440. long form of the operation without affecting the performance.
  1441. @menu
  1442. * extracting archives::
  1443. * extracting files::
  1444. * extract dir::
  1445. * failing commands::
  1446. @end menu
  1447. @node extracting archives
  1448. @subsection Extracting an Entire Archive
  1449. To extract an entire archive, specify the archive file name only, with
  1450. no individual file names as arguments. For example,
  1451. @example
  1452. $ @kbd{tar -xvf collection.tar}
  1453. @end example
  1454. @noindent
  1455. produces this:
  1456. @example
  1457. -rw-rw-rw- me user 28 1996-10-18 16:31 jazz
  1458. -rw-rw-rw- me user 21 1996-09-23 16:44 blues
  1459. -rw-rw-rw- me user 20 1996-09-23 16:44 folk
  1460. @end example
  1461. @node extracting files
  1462. @subsection Extracting Specific Files
  1463. To extract specific archive members, give their exact member names as
  1464. arguments, as printed by @value{op-list}. If you had mistakenly deleted
  1465. one of the files you had placed in the archive @file{collection.tar}
  1466. earlier (say, @file{blues}), you can extract it from the archive without
  1467. changing the archive's structure. It will be identical to the original
  1468. file @file{blues} that you deleted. @FIXME{check this; will the times,
  1469. permissions, owner, etc be the same, also?}
  1470. First, make sure you are in the @file{practice} directory, and list the
  1471. files in the directory. Now, delete the file, @samp{blues}, and list
  1472. the files in the directory again.
  1473. You can now extract the member @file{blues} from the archive file
  1474. @file{collection.tar} like this:
  1475. @example
  1476. $ @kbd{tar --extract --file=collection.tar blues}
  1477. @end example
  1478. @noindent
  1479. If you list the files in the directory again, you will see that the file
  1480. @file{blues} has been restored, with its original permissions, creation
  1481. times, and owner.@FIXME{This is only accidentally true, but not in
  1482. general. In most cases, one has to be root for restoring the owner, and
  1483. use a special option for restoring permissions. Here, it just happens
  1484. that the restoring user is also the owner of the archived members, and
  1485. that the current @code{umask} is compatible with original permissions.}
  1486. (These parameters will be identical to those which
  1487. the file had when you originally placed it in the archive; any changes
  1488. you may have made before deleting the file from the file system,
  1489. however, will @emph{not} have been made to the archive member.) The
  1490. archive file, @samp{collection.tar}, is the same as it was before you
  1491. extracted @samp{blues}. You can confirm this by running @command{tar} with
  1492. @value{op-list}.
  1493. @FIXME{we hope this will change:}Remember that as with other operations,
  1494. specifying the exact member name is important. @w{@kbd{tar --extract
  1495. --file=bfiles.tar birds}} will fail, because there is no member named
  1496. @file{birds}. To extract the member named @file{./birds}, you must
  1497. specify @w{@kbd{tar --extract --file=bfiles.tar ./birds}}. To find the
  1498. exact member names of the members of an archive, use @value{op-list}
  1499. (@pxref{list}).
  1500. If you give the @value{op-verbose} option, then @value{op-extract} will
  1501. print the names of the archive members as it extracts them.
  1502. @node extract dir
  1503. @subsection Extracting Files that are Directories
  1504. Extracting directories which are members of an archive is similar to
  1505. extracting other files. The main difference to be aware of is that if
  1506. the extracted directory has the same name as any directory already in
  1507. the working directory, then files in the extracted directory will be
  1508. placed into the directory of the same name. Likewise, if there are
  1509. files in the pre-existing directory with the same names as the members
  1510. which you extract, the files from the extracted archive will replace
  1511. the files already in the working directory (and possible
  1512. subdirectories). This will happen regardless of whether or not the
  1513. files in the working directory were more recent than those extracted.
  1514. However, if a file was stored with a directory name as part of its file
  1515. name, and that directory does not exist under the working directory when
  1516. the file is extracted, @command{tar} will create the directory.
  1517. We can demonstrate how to use @samp{--extract} to extract a directory
  1518. file with an example. Change to the @file{practice} directory if you
  1519. weren't there, and remove the files @file{folk} and @file{jazz}. Then,
  1520. go back to the parent directory and extract the archive
  1521. @file{music.tar}. You may either extract the entire archive, or you may
  1522. extract only the files you just deleted. To extract the entire archive,
  1523. don't give any file names as arguments after the archive name
  1524. @file{music.tar}. To extract only the files you deleted, use the
  1525. following command:
  1526. @example
  1527. $ @kbd{tar -xvf music.tar practice/folk practice/jazz}
  1528. @end example
  1529. @FIXME{need to show tar's response; used verbose above. also, here's a
  1530. good place to demonstrate the -v -v thing. have to write that up
  1531. (should be trivial, but i'm too tired!).}
  1532. @noindent
  1533. Because you created the directory with @file{practice} as part of the
  1534. file names of each of the files by archiving the @file{practice}
  1535. directory as @file{practice}, you must give @file{practice} as part
  1536. of the file names when you extract those files from the archive.
  1537. @FIXME{IMPORTANT! show the final structure, here. figure out what it
  1538. will be.}
  1539. @node failing commands
  1540. @subsection Commands That Will Fail
  1541. Here are some sample commands you might try which will not work, and why
  1542. they won't work.
  1543. If you try to use this command,
  1544. @example
  1545. $ @kbd{tar -xvf music.tar folk jazz}
  1546. @end example
  1547. @noindent
  1548. you will get the following response:
  1549. @example
  1550. tar: folk: Not found in archive
  1551. tar: jazz: Not found in archive
  1552. $
  1553. @end example
  1554. @noindent
  1555. This is because these files were not originally @emph{in} the parent
  1556. directory @file{..}, where the archive is located; they were in the
  1557. @file{practice} directory, and their file names reflect this:
  1558. @example
  1559. $ @kbd{tar -tvf music.tar}
  1560. practice/folk
  1561. practice/jazz
  1562. practice/rock
  1563. @end example
  1564. @FIXME{make sure the above works when going through the examples in
  1565. order...}
  1566. @noindent
  1567. Likewise, if you try to use this command,
  1568. @example
  1569. $ @kbd{tar -tvf music.tar folk jazz}
  1570. @end example
  1571. @noindent
  1572. you would get a similar response. Members with those names are not in the
  1573. archive. You must use the correct member names in order to extract the
  1574. files from the archive.
  1575. If you have forgotten the correct names of the files in the archive,
  1576. use @w{@kbd{tar --list --verbose}} to list them correctly.
  1577. @FIXME{more examples, here? hag thinks it's a good idea.}
  1578. @node going further
  1579. @section Going Further Ahead in this Manual
  1580. @FIXME{need to write up a node here about the things that are going to
  1581. be in the rest of the manual.}
  1582. @node tar invocation
  1583. @chapter Invoking @sc{gnu} @command{tar}
  1584. @UNREVISED
  1585. This chapter is about how one invokes the @sc{gnu} @command{tar} command, from
  1586. the command synopsis (@pxref{Synopsis}). There are numerous options,
  1587. and many styles for writing them. One mandatory option specifies
  1588. the operation @command{tar} should perform (@pxref{Operation Summary}),
  1589. other options are meant to detail how this operation should be performed
  1590. (@pxref{Option Summary}). Non-option arguments are not always interpreted
  1591. the same way, depending on what the operation is.
  1592. You will find in this chapter everything about option styles and rules for
  1593. writing them (@pxref{Styles}). On the other hand, operations and options
  1594. are fully described elsewhere, in other chapters. Here, you will find
  1595. only synthetic descriptions for operations and options, together with
  1596. pointers to other parts of the @command{tar} manual.
  1597. Some options are so special they are fully described right in this
  1598. chapter. They have the effect of inhibiting the normal operation of
  1599. @command{tar} or else, they globally alter the amount of feedback the user
  1600. receives about what is going on. These are the @value{op-help} and
  1601. @value{op-version} (@pxref{help}), @value{op-verbose} (@pxref{verbose})
  1602. and @value{op-interactive} options (@pxref{interactive}).
  1603. @menu
  1604. * Synopsis::
  1605. * using tar options::
  1606. * Styles::
  1607. * All Options::
  1608. * help::
  1609. * verbose::
  1610. * interactive::
  1611. @end menu
  1612. @node Synopsis
  1613. @section General Synopsis of @command{tar}
  1614. The @sc{gnu} @command{tar} program is invoked as either one of:
  1615. @example
  1616. @kbd{tar @var{option}@dots{} [@var{name}]@dots{}}
  1617. @kbd{tar @var{letter}@dots{} [@var{argument}]@dots{} [@var{option}]@dots{} [@var{name}]@dots{}}
  1618. @end example
  1619. The second form is for when old options are being used.
  1620. You can use @command{tar} to store files in an archive, to extract them from
  1621. an archive, and to do other types of archive manipulation. The primary
  1622. argument to @command{tar}, which is called the @dfn{operation}, specifies
  1623. which action to take. The other arguments to @command{tar} are either
  1624. @dfn{options}, which change the way @command{tar} performs an operation,
  1625. or file names or archive members, which specify the files or members
  1626. @command{tar} is to act on.
  1627. You can actually type in arguments in any order, even if in this manual
  1628. the options always precede the other arguments, to make examples easier
  1629. to understand. Further, the option stating the main operation mode
  1630. (the @command{tar} main command) is usually given first.
  1631. Each @var{name} in the synopsis above is interpreted as an archive member
  1632. name when the main command is one of @value{op-compare}, @value{op-delete},
  1633. @value{op-extract}, @value{op-list} or @value{op-update}. When naming
  1634. archive members, you must give the exact name of the member in the
  1635. archive, as it is printed by @value{op-list}. For @value{op-append}
  1636. and @value{op-create}, these @var{name} arguments specify the names
  1637. of either files or directory hierarchies to place in the archive.
  1638. These files or hierarchies should already exist in the file system,
  1639. prior to the execution of the @command{tar} command.
  1640. @command{tar} interprets relative file names as being relative to the
  1641. working directory. @command{tar} will make all file names relative
  1642. (by removing leading slashes when archiving or restoring files),
  1643. unless you specify otherwise (using the @value{op-absolute-names}
  1644. option). @value{xref-absolute-names}, for more information about
  1645. @value{op-absolute-names}.
  1646. If you give the name of a directory as either a file name or a member
  1647. name, then @command{tar} acts recursively on all the files and directories
  1648. beneath that directory. For example, the name @file{/} identifies all
  1649. the files in the filesystem to @command{tar}.
  1650. The distinction between file names and archive member names is especially
  1651. important when shell globbing is used, and sometimes a source of confusion
  1652. for newcomers. @xref{Wildcards}, for more information about globbing.
  1653. The problem is that shells may only glob using existing files in the
  1654. file system. Only @command{tar} itself may glob on archive members, so when
  1655. needed, you must ensure that wildcard characters reach @command{tar} without
  1656. being interpreted by the shell first. Using a backslash before @samp{*}
  1657. or @samp{?}, or putting the whole argument between quotes, is usually
  1658. sufficient for this.
  1659. Even if @var{name}s are often specified on the command line, they
  1660. can also be read from a text file in the file system, using the
  1661. @value{op-files-from} option.
  1662. If you don't use any file name arguments, @value{op-append},
  1663. @value{op-delete} and @value{op-concatenate} will do nothing, while
  1664. @value{op-create} will usually yield a diagnostic and inhibit @command{tar}
  1665. execution. The other operations of @command{tar} (@value{op-list},
  1666. @value{op-extract}, @value{op-compare}, and @value{op-update}) will act
  1667. on the entire contents of the archive.
  1668. @cindex exit status
  1669. @cindex return status
  1670. Besides successful exits, @sc{gnu} @command{tar} may fail for many reasons.
  1671. Some reasons correspond to bad usage, that is, when the @command{tar}
  1672. command is improperly written.
  1673. Errors may be encountered later, while encountering an error
  1674. processing the archive or the files. Some errors are recoverable,
  1675. in which case the failure is delayed until @command{tar} has completed
  1676. all its work. Some errors are such that it would not meaningful,
  1677. or at least risky, to continue processing: @command{tar} then aborts
  1678. processing immediately. All abnormal exits, whether immediate or
  1679. delayed, should always be clearly diagnosed on @code{stderr}, after
  1680. a line stating the nature of the error.
  1681. @sc{gnu} @command{tar} returns only a few exit statuses. I'm really
  1682. aiming simplicity in that area, for now. If you are not using the
  1683. @value{op-compare} option, zero means that everything went well, besides
  1684. maybe innocuous warnings. Nonzero means that something went wrong.
  1685. Right now, as of today, ``nonzero'' is almost always 2, except for
  1686. remote operations, where it may be 128.
  1687. @node using tar options
  1688. @section Using @command{tar} Options
  1689. @sc{gnu} @command{tar} has a total of eight operating modes which allow you to
  1690. perform a variety of tasks. You are required to choose one operating
  1691. mode each time you employ the @command{tar} program by specifying one, and
  1692. only one operation as an argument to the @command{tar} command (two lists
  1693. of four operations each may be found at @ref{frequent operations} and
  1694. @ref{Operations}). Depending on circumstances, you may also wish to
  1695. customize how the chosen operating mode behaves. For example, you may
  1696. wish to change the way the output looks, or the format of the files that
  1697. you wish to archive may require you to do something special in order to
  1698. make the archive look right.
  1699. You can customize and control @command{tar}'s performance by running
  1700. @command{tar} with one or more options (such as @value{op-verbose}, which
  1701. we used in the tutorial). As we said in the tutorial, @dfn{options} are
  1702. arguments to @command{tar} which are (as their name suggests) optional.
  1703. Depending on the operating mode, you may specify one or more options.
  1704. Different options will have different effects, but in general they all
  1705. change details of the operation, such as archive format, archive name,
  1706. or level of user interaction. Some options make sense with all
  1707. operating modes, while others are meaningful only with particular modes.
  1708. You will likely use some options frequently, while you will only use
  1709. others infrequently, or not at all. (A full list of options is
  1710. available in @pxref{All Options}.)
  1711. The @env{TAR_OPTIONS} environment variable specifies default options to
  1712. be placed in front of any explicit options. For example, if
  1713. @code{TAR_OPTIONS} is @samp{-v --unlink-first}, @command{tar} behaves as
  1714. if the two options @option{-v} and @option{--unlink-first} had been
  1715. specified before any explicit options. Option specifications are
  1716. separated by whitespace. A backslash escapes the next character, so it
  1717. can be used to specify an option containing whitespace or a backslash.
  1718. Note that @command{tar} options are case sensitive. For example, the
  1719. options @samp{-T} and @samp{-t} are different; the first requires an
  1720. argument for stating the name of a file providing a list of @var{name}s,
  1721. while the second does not require an argument and is another way to
  1722. write @value{op-list}.
  1723. In addition to the eight operations, there are many options to
  1724. @command{tar}, and three different styles for writing both: long (mnemonic)
  1725. form, short form, and old style. These styles are discussed below.
  1726. Both the options and the operations can be written in any of these three
  1727. styles.
  1728. @FIXME{menu at end of this node. need to think of an actual outline
  1729. for this chapter; probably do that after stuff from chap. 4 is
  1730. incorporated.}
  1731. @node Styles
  1732. @section The Three Option Styles
  1733. There are three styles for writing operations and options to the command
  1734. line invoking @command{tar}. The different styles were developed at
  1735. different times during the history of @command{tar}. These styles will be
  1736. presented below, from the most recent to the oldest.
  1737. Some options must take an argument. (For example, @value{op-file} takes
  1738. the name of an archive file as an argument. If you do not supply an
  1739. archive file name, @command{tar} will use a default, but this can be
  1740. confusing; thus, we recommend that you always supply a specific archive
  1741. file name.) Where you @emph{place} the arguments generally depends on
  1742. which style of options you choose. We will detail specific information
  1743. relevant to each option style in the sections on the different option
  1744. styles, below. The differences are subtle, yet can often be very
  1745. important; incorrect option placement can cause you to overwrite a
  1746. number of important files. We urge you to note these differences, and
  1747. only use the option style(s) which makes the most sense to you until you
  1748. feel comfortable with the others.
  1749. @FIXME{hag to write a brief paragraph on the option(s) which can
  1750. optionally take an argument}
  1751. @menu
  1752. * Mnemonic Options:: Mnemonic Option Style
  1753. * Short Options:: Short Option Style
  1754. * Old Options:: Old Option Style
  1755. * Mixing:: Mixing Option Styles
  1756. @end menu
  1757. @node Mnemonic Options
  1758. @subsection Mnemonic Option Style
  1759. @FIXME{have to decide whether or ot to replace other occurrences of
  1760. "mnemonic" with "long", or *ugh* vice versa.}
  1761. Each option has at least one long (or mnemonic) name starting with two
  1762. dashes in a row, e.g.@: @samp{--list}. The long names are more clear than
  1763. their corresponding short or old names. It sometimes happens that a
  1764. single mnemonic option has many different different names which are
  1765. synonymous, such as @samp{--compare} and @samp{--diff}. In addition,
  1766. long option names can be given unique abbreviations. For example,
  1767. @samp{--cre} can be used in place of @samp{--create} because there is no
  1768. other mnemonic option which begins with @samp{cre}. (One way to find
  1769. this out is by trying it and seeing what happens; if a particular
  1770. abbreviation could represent more than one option, @command{tar} will tell
  1771. you that that abbreviation is ambiguous and you'll know that that
  1772. abbreviation won't work. You may also choose to run @samp{tar --help}
  1773. to see a list of options. Be aware that if you run @command{tar} with a
  1774. unique abbreviation for the long name of an option you didn't want to
  1775. use, you are stuck; @command{tar} will perform the command as ordered.)
  1776. Mnemonic options are meant to be obvious and easy to remember, and their
  1777. meanings are generally easier to discern than those of their
  1778. corresponding short options (see below). For example:
  1779. @example
  1780. $ @kbd{tar --create --verbose --blocking-factor=20 --file=/dev/rmt0}
  1781. @end example
  1782. @noindent
  1783. gives a fairly good set of hints about what the command does, even
  1784. for those not fully acquainted with @command{tar}.
  1785. Mnemonic options which require arguments take those arguments
  1786. immediately following the option name; they are introduced by an equal
  1787. sign. For example, the @samp{--file} option (which tells the name
  1788. of the @command{tar} archive) is given a file such as @file{archive.tar}
  1789. as argument by using the notation @samp{--file=archive.tar} for the
  1790. mnemonic option.
  1791. @node Short Options
  1792. @subsection Short Option Style
  1793. Most options also have a short option name. Short options start with
  1794. a single dash, and are followed by a single character, e.g.@: @samp{-t}
  1795. (which is equivalent to @samp{--list}). The forms are absolutely
  1796. identical in function; they are interchangeable.
  1797. The short option names are faster to type than long option names.
  1798. Short options which require arguments take their arguments immediately
  1799. following the option, usually separated by white space. It is also
  1800. possible to stick the argument right after the short option name, using
  1801. no intervening space. For example, you might write @w{@samp{-f
  1802. archive.tar}} or @samp{-farchive.tar} instead of using
  1803. @samp{--file=archive.tar}. Both @samp{--file=@var{archive-name}} and
  1804. @w{@samp{-f @var{archive-name}}} denote the option which indicates a
  1805. specific archive, here named @file{archive.tar}.
  1806. Short options' letters may be clumped together, but you are not
  1807. required to do this (as compared to old options; see below). When short
  1808. options are clumped as a set, use one (single) dash for them all, e.g.@:
  1809. @w{@samp{@command{tar} -cvf}}. Only the last option in such a set is allowed
  1810. to have an argument@footnote{Clustering many options, the last of which
  1811. has an argument, is a rather opaque way to write options. Some wonder if
  1812. @sc{gnu} @code{getopt} should not even be made helpful enough for considering
  1813. such usages as invalid.}.
  1814. When the options are separated, the argument for each option which requires
  1815. an argument directly follows that option, as is usual for Unix programs.
  1816. For example:
  1817. @example
  1818. $ @kbd{tar -c -v -b 20 -f /dev/rmt0}
  1819. @end example
  1820. If you reorder short options' locations, be sure to move any arguments
  1821. that belong to them. If you do not move the arguments properly, you may
  1822. end up overwriting files.
  1823. @node Old Options
  1824. @subsection Old Option Style
  1825. @UNREVISED
  1826. Like short options, old options are single letters. However, old options
  1827. must be written together as a single clumped set, without spaces separating
  1828. them or dashes preceding them@footnote{Beware that if you precede options
  1829. with a dash, you are announcing the short option style instead of the
  1830. old option style; short options are decoded differently.}. This set
  1831. of letters must be the first to appear on the command line, after the
  1832. @command{tar} program name and some white space; old options cannot appear
  1833. anywhere else. The letter of an old option is exactly the same letter as
  1834. the corresponding short option. For example, the old option @samp{t} is
  1835. the same as the short option @samp{-t}, and consequently, the same as the
  1836. mnemonic option @samp{--list}. So for example, the command @w{@samp{tar
  1837. cv}} specifies the option @samp{-v} in addition to the operation @samp{-c}.
  1838. @FIXME{bob suggests having an uglier example. :-) }
  1839. When options that need arguments are given together with the command,
  1840. all the associated arguments follow, in the same order as the options.
  1841. Thus, the example given previously could also be written in the old
  1842. style as follows:
  1843. @example
  1844. $ @kbd{tar cvbf 20 /dev/rmt0}
  1845. @end example
  1846. @noindent
  1847. Here, @samp{20} is the argument of @samp{-b} and @samp{/dev/rmt0} is
  1848. the argument of @samp{-f}.
  1849. On the other hand, this old style syntax makes it difficult to match
  1850. option letters with their corresponding arguments, and is often
  1851. confusing. In the command @w{@samp{tar cvbf 20 /dev/rmt0}}, for example,
  1852. @samp{20} is the argument for @samp{-b}, @samp{/dev/rmt0} is the
  1853. argument for @samp{-f}, and @samp{-v} does not have a corresponding
  1854. argument. Even using short options like in @w{@samp{tar -c -v -b 20 -f
  1855. /dev/rmt0}} is clearer, putting all arguments next to the option they
  1856. pertain to.
  1857. If you want to reorder the letters in the old option argument, be
  1858. sure to reorder any corresponding argument appropriately.
  1859. This old way of writing @command{tar} options can surprise even experienced
  1860. users. For example, the two commands:
  1861. @example
  1862. @kbd{tar cfz archive.tar.gz file}
  1863. @kbd{tar -cfz archive.tar.gz file}
  1864. @end example
  1865. @noindent
  1866. are quite different. The first example uses @file{archive.tar.gz} as
  1867. the value for option @samp{f} and recognizes the option @samp{z}. The
  1868. second example, however, uses @file{z} as the value for option
  1869. @samp{f}---probably not what was intended.
  1870. Old options are kept for compatibility with old versions of @command{tar}.
  1871. This second example could be corrected in many ways, among which the
  1872. following are equivalent:
  1873. @example
  1874. @kbd{tar -czf archive.tar.gz file}
  1875. @kbd{tar -cf archive.tar.gz -z file}
  1876. @kbd{tar cf archive.tar.gz -z file}
  1877. @end example
  1878. @FIXME{still could explain this better; it's redundant:}
  1879. @cindex option syntax, traditional
  1880. As far as we know, all @command{tar} programs, @sc{gnu} and non-@sc{gnu}, support
  1881. old options. @sc{gnu} @command{tar} supports them not only for historical
  1882. reasons, but also because many people are used to them. For
  1883. compatibility with Unix @command{tar}, the first argument is always
  1884. treated as containing command and option letters even if it doesn't
  1885. start with @samp{-}. Thus, @samp{tar c} is equivalent to @w{@samp{tar
  1886. -c}:} both of them specify the @value{op-create} command to create an
  1887. archive.
  1888. @node Mixing
  1889. @subsection Mixing Option Styles
  1890. All three styles may be intermixed in a single @command{tar} command, so
  1891. long as the rules for each style are fully respected@footnote{Before @sc{gnu}
  1892. @command{tar} version 1.11.6, a bug prevented intermixing old style options
  1893. with mnemonic options in some cases.}. Old style options and either of the
  1894. modern styles of options may be mixed within a single @command{tar} command.
  1895. However, old style options must be introduced as the first arguments only,
  1896. following the rule for old options (old options must appear directly
  1897. after the @command{tar} command and some white space). Modern options may
  1898. be given only after all arguments to the old options have been collected.
  1899. If this rule is not respected, a modern option might be falsely interpreted
  1900. as the value of the argument to one of the old style options.
  1901. For example, all the following commands are wholly equivalent, and
  1902. illustrate the many combinations and orderings of option styles.
  1903. @example
  1904. @kbd{tar --create --file=archive.tar}
  1905. @kbd{tar --create -f archive.tar}
  1906. @kbd{tar --create -farchive.tar}
  1907. @kbd{tar --file=archive.tar --create}
  1908. @kbd{tar --file=archive.tar -c}
  1909. @kbd{tar -c --file=archive.tar}
  1910. @kbd{tar -c -f archive.tar}
  1911. @kbd{tar -c -farchive.tar}
  1912. @kbd{tar -cf archive.tar}
  1913. @kbd{tar -cfarchive.tar}
  1914. @kbd{tar -f archive.tar --create}
  1915. @kbd{tar -f archive.tar -c}
  1916. @kbd{tar -farchive.tar --create}
  1917. @kbd{tar -farchive.tar -c}
  1918. @kbd{tar c --file=archive.tar}
  1919. @kbd{tar c -f archive.tar}
  1920. @kbd{tar c -farchive.tar}
  1921. @kbd{tar cf archive.tar}
  1922. @kbd{tar f archive.tar --create}
  1923. @kbd{tar f archive.tar -c}
  1924. @kbd{tar fc archive.tar}
  1925. @end example
  1926. On the other hand, the following commands are @emph{not} equivalent to
  1927. the previous set:
  1928. @example
  1929. @kbd{tar -f -c archive.tar}
  1930. @kbd{tar -fc archive.tar}
  1931. @kbd{tar -fcarchive.tar}
  1932. @kbd{tar -farchive.tarc}
  1933. @kbd{tar cfarchive.tar}
  1934. @end example
  1935. @noindent
  1936. These last examples mean something completely different from what the
  1937. user intended (judging based on the example in the previous set which
  1938. uses long options, whose intent is therefore very clear). The first
  1939. four specify that the @command{tar} archive would be a file named
  1940. @samp{-c}, @samp{c}, @samp{carchive.tar} or @samp{archive.tarc},
  1941. respectively. The first two examples also specify a single non-option,
  1942. @var{name} argument having the value @samp{archive.tar}. The last
  1943. example contains only old style option letters (repeating option
  1944. @samp{c} twice), not all of which are meaningful (eg., @samp{.},
  1945. @samp{h}, or @samp{i}), with no argument value. @FIXME{not sure i liked
  1946. the first sentence of this paragraph..}
  1947. @node All Options
  1948. @section All @command{tar} Options
  1949. The coming manual sections contain an alphabetical listing of all
  1950. @command{tar} operations and options, with brief descriptions and cross
  1951. references to more in-depth explanations in the body of the manual.
  1952. They also contain an alphabetically arranged table of the short option
  1953. forms with their corresponding long option. You can use this table as
  1954. a reference for deciphering @command{tar} commands in scripts.
  1955. @menu
  1956. * Operation Summary::
  1957. * Option Summary::
  1958. * Short Option Summary::
  1959. @end menu
  1960. @node Operation Summary
  1961. @subsection Operations
  1962. @table @kbd
  1963. @item --append
  1964. @itemx -r
  1965. Appends files to the end of the archive. @xref{append}.
  1966. @item --catenate
  1967. @itemx -A
  1968. Same as @samp{--concatenate}. @xref{concatenate}.
  1969. @item --compare
  1970. @itemx -d
  1971. Compares archive members with their counterparts in the file
  1972. system, and reports differences in file size, mode, owner,
  1973. modification date and contents. @xref{compare}.
  1974. @item --concatenate
  1975. @itemx -A
  1976. Appends other @command{tar} archives to the end of the archive.
  1977. @xref{concatenate}.
  1978. @item --create
  1979. @itemx -c
  1980. Creates a new @command{tar} archive. @xref{create}.
  1981. @item --delete
  1982. Deletes members from the archive. Don't try this on a archive on a
  1983. tape! @xref{delete}.
  1984. @item --diff
  1985. @itemx -d
  1986. Same @samp{--compare}. @xref{compare}.
  1987. @item --extract
  1988. @itemx -x
  1989. Extracts members from the archive into the file system. @xref{extract}.
  1990. @item --get
  1991. @itemx -x
  1992. Same as @samp{--extract}. @xref{extract}.
  1993. @item --list
  1994. @itemx -t
  1995. Lists the members in an archive. @xref{list}.
  1996. @item --update
  1997. @itemx -u
  1998. @FIXME{It was: A combination of the @samp{--compare} and @samp{--append} operations.
  1999. This is not true and rather misleading, as @value{op-compare}
  2000. does a lot more than @value{op-update} for ensuring files are identical.}
  2001. Adds files to the end of the archive, but only if they are newer than
  2002. their counterparts already in the archive, or if they do not already
  2003. exist in the archive.
  2004. @xref{update}.
  2005. @end table
  2006. @node Option Summary
  2007. @subsection @command{tar} Options
  2008. @table @kbd
  2009. @item --absolute-names
  2010. @itemx -P
  2011. Normally when creating an archive, @command{tar} strips an initial @samp{/} from
  2012. member names. This option disables that behavior. @FIXME-xref{}
  2013. @item --after-date
  2014. (See @samp{--newer}.) @FIXME-pxref{}
  2015. @item --anchored
  2016. An exclude pattern must match an initial subsequence of the name's components.
  2017. @FIXME-xref{}
  2018. @item --atime-preserve
  2019. Tells @command{tar} to preserve the access time field in a file's inode when
  2020. reading it. Due to limitations in the @code{utimes} system call, the
  2021. modification time field is also preserved, which may cause problems if
  2022. the file is simultaneously being modified by another program.
  2023. This option is incompatible with incremental backups, because
  2024. preserving the access time involves updating the last-changed time.
  2025. Also, this option does not work on files that you do not own,
  2026. unless you're root.
  2027. @FIXME-xref{}
  2028. @item --backup=@var{backup-type}
  2029. Rather than deleting files from the file system, @command{tar} will back them up
  2030. using simple or numbered backups, depending upon @var{backup-type}.
  2031. @FIXME-xref{}
  2032. @item --block-number
  2033. @itemx -R
  2034. With this option present, @command{tar} prints error messages for read errors
  2035. with the block number in the archive file. @FIXME-xref{}
  2036. @item --blocking-factor=@var{blocking}
  2037. @itemx -b @var{blocking}
  2038. Sets the blocking factor @command{tar} uses to @var{blocking} x 512 bytes per
  2039. record. @FIXME-xref{}
  2040. @item --bzip2
  2041. @itemx -j
  2042. This option tells @command{tar} to read or write archives through @code{bzip2}.
  2043. @FIXME-xref{}
  2044. @item --checkpoint
  2045. This option directs @command{tar} to print periodic checkpoint messages as it
  2046. reads through the archive. Its intended for when you want a visual
  2047. indication that @command{tar} is still running, but don't want to see
  2048. @samp{--verbose} output. @FIXME-xref{}
  2049. @item --compress
  2050. @itemx --uncompress
  2051. @itemx -Z
  2052. @command{tar} will use the @command{compress} program when reading or writing the
  2053. archive. This allows you to directly act on archives while saving
  2054. space. @FIXME-xref{}
  2055. @item --confirmation
  2056. (See @samp{--interactive}.) @FIXME-pxref{}
  2057. @item --dereference
  2058. @itemx -h
  2059. When creating a @command{tar} archive, @command{tar} will archive the file that a symbolic
  2060. link points to, rather than archiving the symlink. @FIXME-xref{}
  2061. @item --directory=@var{dir}
  2062. @itemx -C @var{dir}
  2063. When this option is specified, @command{tar} will change its current directory
  2064. to @var{dir} before performing any operations. When this option is used
  2065. during archive creation, it is order sensitive. @FIXME-xref{}
  2066. @item --exclude=@var{pattern}
  2067. When performing operations, @command{tar} will skip files that match
  2068. @var{pattern}. @FIXME-xref{}
  2069. @item --exclude-from=@var{file}
  2070. @itemx -X @var{file}
  2071. Similar to @samp{--exclude}, except @command{tar} will use the list of patterns
  2072. in the file @var{file}. @FIXME-xref{}
  2073. @item --file=@var{archive}
  2074. @itemx -f @var{archive}
  2075. @command{tar} will use the file @var{archive} as the @command{tar} archive it
  2076. performs operations on, rather than @command{tar}'s compilation dependent
  2077. default. @FIXME-xref{}
  2078. @item --files-from=@var{file}
  2079. @itemx -T @var{file}
  2080. @command{tar} will use the contents of @var{file} as a list of archive members
  2081. or files to operate on, in addition to those specified on the
  2082. command-line. @FIXME-xref{}
  2083. @item --force-local
  2084. Forces @command{tar} to interpret the filename given to @samp{--file} as a local
  2085. file, even if it looks like a remote tape drive name. @FIXME-xref{}
  2086. @item --group=@var{group}
  2087. Files added to the @command{tar} archive will have a group id of @var{group},
  2088. rather than the group from the source file. @var{group} is first decoded
  2089. as a group symbolic name, but if this interpretation fails, it has to be
  2090. a decimal numeric group ID. @FIXME-xref{}
  2091. Also see the comments for the @value{op-owner} option.
  2092. @item --gunzip
  2093. (See @samp{--gzip}.) @FIXME-pxref{}
  2094. @item --gzip
  2095. @itemx --gunzip
  2096. @itemx --ungzip
  2097. @itemx -z
  2098. This option tells @command{tar} to read or write archives through @command{gzip},
  2099. allowing @command{tar} to directly operate on several kinds of compressed
  2100. archives transparently. @FIXME-xref{}
  2101. @item --help
  2102. @command{tar} will print out a short message summarizing the operations and
  2103. options to @command{tar} and exit. @FIXME-xref{}
  2104. @item --ignore-case
  2105. Ignore case when excluding files.
  2106. @FIXME-xref{}
  2107. @item --ignore-failed-read
  2108. Do not exit unsuccessfully merely because an unreadable file was encountered.
  2109. @xref{Reading}.
  2110. @item --ignore-zeros
  2111. @itemx -i
  2112. With this option, @command{tar} will ignore zeroed blocks in the archive, which
  2113. normally signals EOF. @xref{Reading}.
  2114. @item --incremental
  2115. @itemx -G
  2116. Used to inform @command{tar} that it is working with an old @sc{gnu}-format
  2117. incremental backup archive. It is intended primarily for backwards
  2118. compatibility only. @FIXME-xref{}
  2119. @item --info-script=@var{script-file}
  2120. @itemx --new-volume-script=@var{script-file}
  2121. @itemx -F @var{script-file}
  2122. When @command{tar} is performing multi-tape backups, @var{script-file} is run
  2123. at the end of each tape. If @var{script-file} exits with nonzero status,
  2124. @command{tar} fails immediately. @FIXME-xref{}
  2125. @item --interactive
  2126. @itemx --confirmation
  2127. @itemx -w
  2128. Specifies that @command{tar} should ask the user for confirmation before
  2129. performing potentially destructive options, such as overwriting files.
  2130. @FIXME-xref{}
  2131. @item --keep-old-files
  2132. @itemx -k
  2133. Do not overwrite existing files when extracting files from an archive.
  2134. @xref{Writing}.
  2135. @item --label=@var{name}
  2136. @itemx -V @var{name}
  2137. When creating an archive, instructs @command{tar} to write @var{name} as a name
  2138. record in the archive. When extracting or listing archives, @command{tar} will
  2139. only operate on archives that have a label matching the pattern
  2140. specified in @var{name}. @FIXME-xref{}
  2141. @item --listed-incremental=@var{snapshot-file}
  2142. @itemx -g @var{snapshot-file}
  2143. During a @samp{--create} operation, specifies that the archive that
  2144. @command{tar} creates is a new @sc{gnu}-format incremental backup, using
  2145. @var{snapshot-file} to determine which files to backup.
  2146. With other operations, informs @command{tar} that the archive is in incremental
  2147. format. @FIXME-xref{}
  2148. @item --mode=@var{permissions}
  2149. When adding files to an archive, @command{tar} will use @var{permissions}
  2150. for the archive members, rather than the permissions from the files.
  2151. The program @command{chmod} and this @command{tar} option share the same syntax
  2152. for what @var{permissions} might be. @xref{File permissions, Permissions,
  2153. File permissions, fileutils, @sc{gnu} file utilities}. This reference also
  2154. has useful information for those not being overly familiar with the Unix
  2155. permission system.
  2156. Of course, @var{permissions} might be plainly specified as an octal number.
  2157. However, by using generic symbolic modifications to mode bits, this allows
  2158. more flexibility. For example, the value @samp{a+rw} adds read and write
  2159. permissions for everybody, while retaining executable bits on directories
  2160. or on any other file already marked as executable.
  2161. @item --multi-volume
  2162. @itemx -M
  2163. Informs @command{tar} that it should create or otherwise operate on a
  2164. multi-volume @command{tar} archive. @FIXME-xref{}
  2165. @item --new-volume-script
  2166. (see --info-script)
  2167. @item --newer=@var{date}
  2168. @itemx --after-date=@var{date}
  2169. @itemx -N
  2170. When creating an archive, @command{tar} will only add files that have changed
  2171. since @var{date}. If @var{date} begins with @samp{/} or @samp{.}, it
  2172. is taken to be the name of a file whose last-modified time specifies
  2173. the date. @FIXME-xref{}
  2174. @item --newer-mtime=@var{date}
  2175. Like @samp{--newer}, but add only files whose
  2176. contents have changed (as opposed to just @samp{--newer}, which will
  2177. also back up files for which any status information has changed).
  2178. @item --no-anchored
  2179. An exclude pattern can match any subsequence of the name's components.
  2180. @FIXME-xref{}
  2181. @item --no-ignore-case
  2182. Use case-sensitive matching when excluding files.
  2183. @FIXME-xref{}
  2184. @item --no-recursion
  2185. With this option, @command{tar} will not recurse into directories.
  2186. @FIXME-xref{}
  2187. @item --no-same-owner
  2188. When extracting an archive, do not attempt to preserve the owner
  2189. specified in the @command{tar} archive. This the default behavior
  2190. for ordinary users; this option has an effect only for the superuser.
  2191. @item --no-same-permissions
  2192. When extracting an archive, subtract the user's umask from files from
  2193. the permissions specified in the archive. This is the default behavior
  2194. for ordinary users; this option has an effect only for the superuser.
  2195. @item --no-wildcards
  2196. Do not use wildcards when excluding files.
  2197. @FIXME-xref{}
  2198. @item --no-wildcards-match-slash
  2199. Wildcards do not match @samp{/} when excluding files.
  2200. @FIXME-xref{}
  2201. @item --null
  2202. When @command{tar} is using the @samp{--files-from} option, this option
  2203. instructs @command{tar} to expect filenames terminated with @kbd{NUL}, so
  2204. @command{tar} can correctly work with file names that contain newlines.
  2205. @FIXME-xref{}
  2206. @item --numeric-owner
  2207. This option will notify @command{tar} that it should use numeric user and group
  2208. IDs when creating a @command{tar} file, rather than names. @FIXME-xref{}
  2209. @item --old-archive
  2210. (See @samp{--portability}.) @FIXME-pxref{}
  2211. @item --one-file-system
  2212. @itemx -l
  2213. Used when creating an archive. Prevents @command{tar} from recursing into
  2214. directories that are on different file systems from the current
  2215. directory. @FIXME-xref{}
  2216. @item --overwrite
  2217. Overwrite existing files and directory metadata when extracting files
  2218. from an archive. @xref{Overwrite Old Files}.
  2219. @item --owner=@var{user}
  2220. Specifies that @command{tar} should use @var{user} as the owner of members
  2221. when creating archives, instead of the user associated with the source
  2222. file. @var{user} is first decoded as a user symbolic name, but if
  2223. this interpretation fails, it has to be a decimal numeric user ID.
  2224. @FIXME-xref{}
  2225. There is no value indicating a missing number, and @samp{0} usually means
  2226. @code{root}. Some people like to force @samp{0} as the value to offer in
  2227. their distributions for the owner of files, because the @code{root} user is
  2228. anonymous anyway, so that might as well be the owner of anonymous archives.
  2229. This option does not affect extraction from archives.
  2230. @item --portability
  2231. @itemx --old-archive
  2232. @itemx -o
  2233. Tells @command{tar} to create an archive that is compatible with Unix V7
  2234. @command{tar}. @FIXME-xref{}
  2235. @item --posix
  2236. Instructs @command{tar} to create a @sc{posix} compliant @command{tar} archive. @FIXME-xref{}
  2237. @item --preserve
  2238. Synonymous with specifying both @samp{--preserve-permissions} and
  2239. @samp{--same-order}. @FIXME-xref{}
  2240. @item --preserve-order
  2241. (See @samp{--same-order}; @pxref{Reading}.)
  2242. @item --preserve-permissions
  2243. @itemx --same-permissions
  2244. @itemx -p
  2245. When @command{tar} is extracting an archive, it normally subtracts the users'
  2246. umask from the permissions specified in the archive and uses that
  2247. number as the permissions to create the destination file. Specifying
  2248. this option instructs @command{tar} that it should use the permissions directly
  2249. from the archive. @xref{Writing}.
  2250. @item --read-full-records
  2251. @itemx -B
  2252. Specifies that @command{tar} should reblock its input, for reading from pipes on
  2253. systems with buggy implementations. @xref{Reading}.
  2254. @item --record-size=@var{size}
  2255. Instructs @command{tar} to use @var{size} bytes per record when accessing the
  2256. archive. @FIXME-xref{}
  2257. @item --recursion
  2258. With this option, @command{tar} recurses into directories.
  2259. @FIXME-xref{}
  2260. @item --recursive-unlink
  2261. Remove existing
  2262. directory hierarchies before extracting directories of the same name
  2263. from the archive. @xref{Writing}.
  2264. @item --remove-files
  2265. Directs @command{tar} to remove the source file from the file system after
  2266. appending it to an archive. @FIXME-xref{}
  2267. @item --rsh-command=@var{cmd}
  2268. Notifies @command{tar} that is should use @var{cmd} to communicate with remote
  2269. devices. @FIXME-xref{}
  2270. @item --same-order
  2271. @itemx --preserve-order
  2272. @itemx -s
  2273. This option is an optimization for @command{tar} when running on machines with
  2274. small amounts of memory. It informs @command{tar} that the list of file
  2275. arguments has already been sorted to match the order of files in the
  2276. archive. @xref{Reading}.
  2277. @item --same-owner
  2278. When extracting an archive, @command{tar} will attempt to preserve the owner
  2279. specified in the @command{tar} archive with this option present.
  2280. This is the default behavior for the superuser; this option has an
  2281. effect only for ordinary users. @FIXME-xref{}
  2282. @item --same-permissions
  2283. (See @samp{--preserve-permissions}; @pxref{Writing}.)
  2284. @item --show-omitted-dirs
  2285. Instructs @command{tar} to mention directories its skipping over when operating
  2286. on a @command{tar} archive. @FIXME-xref{}
  2287. @item --sparse
  2288. @itemx -S
  2289. Invokes a @sc{gnu} extension when adding files to an archive that handles
  2290. sparse files efficiently. @FIXME-xref{}
  2291. @item --starting-file=@var{name}
  2292. @itemx -K @var{name}
  2293. This option affects extraction only; @command{tar} will skip extracting
  2294. files in the archive until it finds one that matches @var{name}.
  2295. @xref{Scarce}.
  2296. @item --suffix=@var{suffix}
  2297. Alters the suffix @command{tar} uses when backing up files from the default
  2298. @samp{~}. @FIXME-xref{}
  2299. @item --tape-length=@var{num}
  2300. @itemx -L @var{num}
  2301. Specifies the length of tapes that @command{tar} is writing as being
  2302. @w{@var{num} x 1024} bytes long. @FIXME-xref{}
  2303. @item --to-stdout
  2304. @itemx -O
  2305. During extraction, @command{tar} will extract files to stdout rather than to the
  2306. file system. @xref{Writing}.
  2307. @item --totals
  2308. Displays the total number of bytes written after creating an archive.
  2309. @FIXME-xref{}
  2310. @item --touch
  2311. @itemx -m
  2312. Sets the modification time of extracted files to the extraction time,
  2313. rather than the modification time stored in the archive.
  2314. @xref{Writing}.
  2315. @item --uncompress
  2316. (See @samp{--compress}.) @FIXME-pxref{}
  2317. @item --ungzip
  2318. (See @samp{--gzip}.) @FIXME-pxref{}
  2319. @item --unlink-first
  2320. @itemx -U
  2321. Directs @command{tar} to remove the corresponding file from the file
  2322. system before extracting it from the archive. @xref{Writing}.
  2323. @item --use-compress-program=@var{prog}
  2324. Instructs @command{tar} to access the archive through @var{prog}, which is
  2325. presumed to be a compression program of some sort. @FIXME-xref{}
  2326. @item --verbose
  2327. @itemx -v
  2328. Specifies that @command{tar} should be more verbose about the operations its
  2329. performing. This option can be specified multiple times for some
  2330. operations to increase the amount of information displayed. @FIXME-xref{}
  2331. @item --verify
  2332. @itemx -W
  2333. Verifies that the archive was correctly written when creating an
  2334. archive. @FIXME-xref{}
  2335. @item --version
  2336. @command{tar} will print an informational message about what version it is and a
  2337. copyright message, some credits, and then exit. @FIXME-xref{}
  2338. @item --volno-file=@var{file}
  2339. Used in conjunction with @samp{--multi-volume}. @command{tar} will keep track
  2340. of which volume of a multi-volume archive its working in @var{file}.
  2341. @FIXME-xref{}
  2342. @item --wildcards
  2343. Use wildcards when excluding files.
  2344. @FIXME-xref{}
  2345. @item --wildcards-match-slash
  2346. Wildcards match @samp{/} when excluding files.
  2347. @FIXME-xref{}
  2348. @end table
  2349. @node Short Option Summary
  2350. @subsection Short Options Cross Reference
  2351. Here is an alphabetized list of all of the short option forms, matching
  2352. them with the equivalent long option.
  2353. @table @kbd
  2354. @item -A
  2355. @samp{--concatenate}
  2356. @item -B
  2357. @samp{--read-full-records}
  2358. @item -C
  2359. @samp{--directory}
  2360. @item -F
  2361. @samp{--info-script}
  2362. @item -G
  2363. @samp{--incremental}
  2364. @item -K
  2365. @samp{--starting-file}
  2366. @item -L
  2367. @samp{--tape-length}
  2368. @item -M
  2369. @samp{--multi-volume}
  2370. @item -N
  2371. @samp{--newer}
  2372. @item -O
  2373. @samp{--to-stdout}
  2374. @item -P
  2375. @samp{--absolute-names}
  2376. @item -R
  2377. @samp{--block-number}
  2378. @item -S
  2379. @samp{--sparse}
  2380. @item -T
  2381. @samp{--files-from}
  2382. @item -U
  2383. @samp{--unlink-first}
  2384. @item -V
  2385. @samp{--label}
  2386. @item -W
  2387. @samp{--verify}
  2388. @item -X
  2389. @samp{--exclude-from}
  2390. @item -Z
  2391. @samp{--compress}
  2392. @item -b
  2393. @samp{--blocking-factor}
  2394. @item -c
  2395. @samp{--create}
  2396. @item -d
  2397. @samp{--compare}
  2398. @item -f
  2399. @samp{--file}
  2400. @item -g
  2401. @samp{--listed-incremental}
  2402. @item -h
  2403. @samp{--dereference}
  2404. @item -i
  2405. @samp{--ignore-zeros}
  2406. @item -k
  2407. @samp{--keep-old-files}
  2408. @item -l
  2409. @samp{--one-file-system}
  2410. @item -m
  2411. @samp{--touch}
  2412. @item -o
  2413. @samp{--portability}
  2414. @item -p
  2415. @samp{--preserve-permissions}
  2416. @item -r
  2417. @samp{--append}
  2418. @item -s
  2419. @samp{--same-order}
  2420. @item -t
  2421. @samp{--list}
  2422. @item -u
  2423. @samp{--update}
  2424. @item -v
  2425. @samp{--verbose}
  2426. @item -w
  2427. @samp{--interactive}
  2428. @item -x
  2429. @samp{--extract}
  2430. @item -z
  2431. @samp{--gzip}
  2432. @end table
  2433. @node help
  2434. @section @sc{gnu} @command{tar} documentation
  2435. Being careful, the first thing is really checking that you are using @sc{gnu}
  2436. @command{tar}, indeed. The @value{op-version} option will generate a message
  2437. giving confirmation that you are using @sc{gnu} @command{tar}, with the precise
  2438. version of @sc{gnu} @command{tar} you are using. @command{tar} identifies itself
  2439. and prints the version number to the standard output, then immediately
  2440. exits successfully, without doing anything else, ignoring all other
  2441. options. For example, @w{@samp{tar --version}} might return:
  2442. @example
  2443. tar (@sc{gnu} tar) @value{VERSION}
  2444. @end example
  2445. @noindent
  2446. The first occurrence of @samp{tar} in the result above is the program
  2447. name in the package (for example, @command{rmt} is another program), while
  2448. the second occurrence of @samp{tar} is the name of the package itself,
  2449. containing possibly many programs. The package is currently named
  2450. @samp{tar}, after the name of the main program it contains@footnote{There
  2451. are plans to merge the @command{cpio} and @command{tar} packages into a single one
  2452. which would be called @code{paxutils}. So, who knows if, one of this days,
  2453. the @value{op-version} would not yield @w{@samp{tar (@sc{gnu} paxutils) 3.2}}}.
  2454. Another thing you might want to do is checking the spelling or meaning
  2455. of some particular @command{tar} option, without resorting to this manual,
  2456. for once you have carefully read it. @sc{gnu} @command{tar} has a short help
  2457. feature, triggerable through the @value{op-help} option. By using this
  2458. option, @command{tar} will print a usage message listing all available
  2459. options on standard output, then exit successfully, without doing
  2460. anything else and ignoring all other options. Even if this is only a
  2461. brief summary, it may be several screens long. So, if you are not
  2462. using some kind of scrollable window, you might prefer to use something
  2463. like:
  2464. @example
  2465. $ @kbd{tar --help | less}
  2466. @end example
  2467. @noindent
  2468. presuming, here, that you like using @command{less} for a pager. Other
  2469. popular pagers are @command{more} and @command{pg}. If you know about some
  2470. @var{keyword} which interests you and do not want to read all the
  2471. @value{op-help} output, another common idiom is doing:
  2472. @example
  2473. tar --help | grep @var{keyword}
  2474. @end example
  2475. @noindent
  2476. for getting only the pertinent lines.
  2477. The perceptive reader would have noticed some contradiction in the
  2478. previous paragraphs. It is written that both @value{op-version} and
  2479. @value{op-help} print something, and have all other options ignored. In
  2480. fact, they cannot ignore each other, and one of them has to win. We do
  2481. not specify which is stronger, here; experiment if you really wonder!
  2482. The short help output is quite succinct, and you might have to get back
  2483. to the full documentation for precise points. If you are reading this
  2484. paragraph, you already have the @command{tar} manual in some form. This
  2485. manual is available in printed form, as a kind of small book. It may
  2486. printed out of the @sc{gnu} @command{tar} distribution, provided you have @TeX{}
  2487. already installed somewhere, and a laser printer around. Just configure
  2488. the distribution, execute the command @w{@samp{make dvi}}, then print
  2489. @file{doc/tar.dvi} the usual way (contact your local guru to know how).
  2490. If @sc{gnu} @command{tar} has been conveniently installed at your place, this
  2491. manual is also available in interactive, hypertextual form as an Info
  2492. file. Just call @w{@samp{info tar}} or, if you do not have the
  2493. @command{info} program handy, use the Info reader provided within @sc{gnu}
  2494. Emacs, calling @samp{tar} from the main Info menu.
  2495. There is currently no @code{man} page for @sc{gnu} @command{tar}. If you observe
  2496. such a @code{man} page on the system you are running, either it does not
  2497. long to @sc{gnu} @command{tar}, or it has not been produced by @sc{gnu}. Currently,
  2498. @sc{gnu} @command{tar} documentation is provided in Texinfo format only, if we
  2499. except, of course, the short result of @kbd{tar --help}.
  2500. @node verbose
  2501. @section Checking @command{tar} progress
  2502. @cindex Progress information
  2503. @cindex Status information
  2504. @cindex Information on progress and status of operations
  2505. @cindex Verbose operation
  2506. @cindex Block number where error occurred
  2507. @cindex Error message, block number of
  2508. @cindex Version of the @command{tar} program
  2509. @cindex Getting more information during the operation
  2510. @cindex Information during operation
  2511. @cindex Feedback from @command{tar}
  2512. Typically, @command{tar} performs most operations without reporting any
  2513. information to the user except error messages. When using @command{tar}
  2514. with many options, particularly ones with complicated or
  2515. difficult-to-predict behavior, it is possible to make serious mistakes.
  2516. @command{tar} provides several options that make observing @command{tar}
  2517. easier. These options cause @command{tar} to print information as it
  2518. progresses in its job, and you might want to use them just for being
  2519. more careful about what is going on, or merely for entertaining
  2520. yourself. If you have encountered a problem when operating on an
  2521. archive, however, you may need more information than just an error
  2522. message in order to solve the problem. The following options can be
  2523. helpful diagnostic tools.
  2524. Normally, the @value{op-list} command to list an archive prints just
  2525. the file names (one per line) and the other commands are silent.
  2526. When used with most operations, the @value{op-verbose} option causes
  2527. @command{tar} to print the name of each file or archive member as it
  2528. is processed. This and the other options which make @command{tar} print
  2529. status information can be useful in monitoring @command{tar}.
  2530. With @value{op-create} or @value{op-extract}, @value{op-verbose} used once
  2531. just prints the names of the files or members as they are processed.
  2532. Using it twice causes @command{tar} to print a longer listing (reminiscent
  2533. of @samp{ls -l}) for each member. Since @value{op-list} already prints
  2534. the names of the members, @value{op-verbose} used once with @value{op-list}
  2535. causes @command{tar} to print an @samp{ls -l} type listing of the files
  2536. in the archive. The following examples both extract members with
  2537. long list output:
  2538. @example
  2539. $ @kbd{tar --extract --file=archive.tar --verbose --verbose}
  2540. $ @kbd{tar xvv archive.tar}
  2541. @end example
  2542. Verbose output appears on the standard output except when an archive is
  2543. being written to the standard output, as with @samp{tar --create
  2544. --file=- --verbose} (@samp{tar cfv -}, or even @samp{tar cv}---if the
  2545. installer let standard output be the default archive). In that case
  2546. @command{tar} writes verbose output to the standard error stream.
  2547. The @value{op-totals} option---which is only meaningful when used with
  2548. @value{op-create}---causes @command{tar} to print the total
  2549. amount written to the archive, after it has been fully created.
  2550. The @value{op-checkpoint} option prints an occasional message
  2551. as @command{tar} reads or writes the archive. In fact, it print
  2552. directory names while reading the archive. It is designed for
  2553. those who don't need the more detailed (and voluminous) output of
  2554. @value{op-block-number}, but do want visual confirmation that @command{tar}
  2555. is actually making forward progress.
  2556. @FIXME{There is some confusion here. It seems that -R once wrote a
  2557. message at @samp{every} record read or written.}
  2558. The @value{op-show-omitted-dirs} option, when reading an archive---with
  2559. @value{op-list} or @value{op-extract}, for example---causes a message
  2560. to be printed for each directory in the archive which is skipped.
  2561. This happens regardless of the reason for skipping: the directory might
  2562. not have been named on the command line (implicitly or explicitly),
  2563. it might be excluded by the use of the @value{op-exclude} option, or
  2564. some other reason.
  2565. If @value{op-block-number} is used, @command{tar} prints, along with every
  2566. message it would normally produce, the block number within the archive
  2567. where the message was triggered. Also, supplementary messages are
  2568. triggered when reading blocks full of NULs, or when hitting end of file on
  2569. the archive. As of now, if the archive if properly terminated with a NUL
  2570. block, the reading of the file may stop before end of file is met, so the
  2571. position of end of file will not usually show when @value{op-block-number}
  2572. is used. Note that @sc{gnu} @command{tar} drains the archive before exiting when
  2573. reading the archive from a pipe.
  2574. This option is especially useful when reading damaged archives, since
  2575. it helps pinpoint the damaged sections. It can also be used with
  2576. @value{op-list} when listing a file-system backup tape, allowing you to
  2577. choose among several backup tapes when retrieving a file later, in
  2578. favor of the tape where the file appears earliest (closest to the
  2579. front of the tape). @FIXME-xref{when the node name is set and the
  2580. backup section written.}
  2581. @node interactive
  2582. @section Asking for Confirmation During Operations
  2583. @cindex Interactive operation
  2584. Typically, @command{tar} carries out a command without stopping for
  2585. further instructions. In some situations however, you may want to
  2586. exclude some files and archive members from the operation (for instance
  2587. if disk or storage space is tight). You can do this by excluding
  2588. certain files automatically (@pxref{Choosing}), or by performing
  2589. an operation interactively, using the @value{op-interactive} option.
  2590. @command{tar} also accepts @samp{--confirmation} for this option.
  2591. When the @value{op-interactive} option is specified, before
  2592. reading, writing, or deleting files, @command{tar} first prints a message
  2593. for each such file, telling what operation it intends to take, then asks
  2594. for confirmation on the terminal. The actions which require
  2595. confirmation include adding a file to the archive, extracting a file
  2596. from the archive, deleting a file from the archive, and deleting a file
  2597. from disk. To confirm the action, you must type a line of input
  2598. beginning with @samp{y}. If your input line begins with anything other
  2599. than @samp{y}, @command{tar} skips that file.
  2600. If @command{tar} is reading the archive from the standard input,
  2601. @command{tar} opens the file @file{/dev/tty} to support the interactive
  2602. communications.
  2603. Verbose output is normally sent to standard output, separate from
  2604. other error messages. However, if the archive is produced directly
  2605. on standard output, then verbose output is mixed with errors on
  2606. @code{stderr}. Producing the archive on standard output may be used
  2607. as a way to avoid using disk space, when the archive is soon to be
  2608. consumed by another process reading it, say. Some people felt the need
  2609. of producing an archive on stdout, still willing to segregate between
  2610. verbose output and error output. A possible approach would be using a
  2611. named pipe to receive the archive, and having the consumer process to
  2612. read from that named pipe. This has the advantage of letting standard
  2613. output free to receive verbose output, all separate from errors.
  2614. @node operations
  2615. @chapter @sc{gnu} @command{tar} Operations
  2616. @menu
  2617. * Basic tar::
  2618. * Advanced tar::
  2619. * create options::
  2620. * extract options::
  2621. * backup::
  2622. * Applications::
  2623. * looking ahead::
  2624. @end menu
  2625. @node Basic tar
  2626. @section Basic @sc{gnu} @command{tar} Operations
  2627. The basic @command{tar} operations, @value{op-create}, @value{op-list} and
  2628. @value{op-extract}, are currently presented and described in the tutorial
  2629. chapter of this manual. This section provides some complementary notes
  2630. for these operations.
  2631. @table @asis
  2632. @item @value{op-create}
  2633. Creating an empty archive would have some kind of elegance. One can
  2634. initialize an empty archive and later use @value{op-append} for adding
  2635. all members. Some applications would not welcome making an exception
  2636. in the way of adding the first archive member. On the other hand,
  2637. many people reported that it is dangerously too easy for @command{tar}
  2638. to destroy a magnetic tape with an empty archive@footnote{This is well
  2639. described in @cite{Unix-haters Handbook}, by Simson Garfinkel, Daniel
  2640. Weise & Steven Strassmann, IDG Books, ISBN 1-56884-203-1.}. The two most
  2641. common errors are:
  2642. @enumerate
  2643. @item
  2644. Mistakingly using @code{create} instead of @code{extract}, when the
  2645. intent was to extract the full contents of an archive. This error
  2646. is likely: keys @kbd{c} and @kbd{x} are right next ot each other on
  2647. the QWERTY keyboard. Instead of being unpacked, the archive then
  2648. gets wholly destroyed. When users speak about @dfn{exploding} an
  2649. archive, they usually mean something else :-).
  2650. @item
  2651. Forgetting the argument to @code{file}, when the intent was to create
  2652. an archive with a single file in it. This error is likely because a
  2653. tired user can easily add the @kbd{f} key to the cluster of option
  2654. letters, by the mere force of habit, without realizing the full
  2655. consequence of doing so. The usual consequence is that the single
  2656. file, which was meant to be saved, is rather destroyed.
  2657. @end enumerate
  2658. So, recognizing the likelihood and the catastrophical nature of these
  2659. errors, @sc{gnu} @command{tar} now takes some distance from elegance, and
  2660. cowardly refuses to create an archive when @value{op-create} option is
  2661. given, there are no arguments besides options, and @value{op-files-from}
  2662. option is @emph{not} used. To get around the cautiousness of @sc{gnu}
  2663. @command{tar} and nevertheless create an archive with nothing in it,
  2664. one may still use, as the value for the @value{op-files-from} option,
  2665. a file with no names in it, as shown in the following commands:
  2666. @example
  2667. @kbd{tar --create --file=empty-archive.tar --files-from=/dev/null}
  2668. @kbd{tar cfT empty-archive.tar /dev/null}
  2669. @end example
  2670. @item @value{op-extract}
  2671. A socket is stored, within a @sc{gnu} @command{tar} archive, as a pipe.
  2672. @item @value{op-list}
  2673. @sc{gnu} @command{tar} now shows dates as @samp{1996-08-30}, while it used to
  2674. show them as @samp{Aug 30 1996}. (One can revert to the old behavior by
  2675. defining @code{USE_OLD_CTIME} in @file{src/list.c} before reinstalling.)
  2676. But preferably, people should get used to ISO 8601 dates. Local
  2677. American dates should be made available again with full date localization
  2678. support, once ready. In the meantime, programs not being localizable
  2679. for dates should prefer international dates, that's really the way to go.
  2680. Look up @url{http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html} if you
  2681. are curious, it contains a detailed explanation of the ISO 8601 standard.
  2682. @end table
  2683. @node Advanced tar
  2684. @section Advanced @sc{gnu} @command{tar} Operations
  2685. Now that you have learned the basics of using @sc{gnu} @command{tar}, you may
  2686. want to learn about further ways in which @command{tar} can help you.
  2687. This chapter presents five, more advanced operations which you probably
  2688. won't use on a daily basis, but which serve more specialized functions.
  2689. We also explain the different styles of options and why you might want
  2690. to use one or another, or a combination of them in your @command{tar}
  2691. commands. Additionally, this chapter includes options which allow you to
  2692. define the output from @command{tar} more carefully, and provide help and
  2693. error correction in special circumstances.
  2694. @FIXME{check this after the chapter is actually revised to make sure
  2695. it still introduces the info in the chapter correctly : ).}
  2696. @menu
  2697. * Operations::
  2698. * current state::
  2699. * append::
  2700. * update::
  2701. * concatenate::
  2702. * delete::
  2703. * compare::
  2704. @end menu
  2705. @node Operations
  2706. @subsection The Five Advanced @command{tar} Operations
  2707. @UNREVISED
  2708. In the last chapter, you learned about the first three operations to
  2709. @command{tar}. This chapter presents the remaining five operations to
  2710. @command{tar}: @samp{--append}, @samp{--update}, @samp{--concatenate},
  2711. @samp{--delete}, and @samp{--compare}.
  2712. You are not likely to use these operations as frequently as those
  2713. covered in the last chapter; however, since they perform specialized
  2714. functions, they are quite useful when you do need to use them. We
  2715. will give examples using the same directory and files that you created
  2716. in the last chapter. As you may recall, the directory is called
  2717. @file{practice}, the files are @samp{jazz}, @samp{blues}, @samp{folk},
  2718. @samp{rock}, and the two archive files you created are
  2719. @samp{collection.tar} and @samp{music.tar}.
  2720. We will also use the archive files @samp{afiles.tar} and
  2721. @samp{bfiles.tar}. @samp{afiles.tar} contains the members @samp{apple},
  2722. @samp{angst}, and @samp{aspic}. @samp{bfiles.tar} contains the members
  2723. @samp{./birds}, @samp{baboon}, and @samp{./box}.
  2724. Unless we state otherwise, all practicing you do and examples you follow
  2725. in this chapter will take place in the @file{practice} directory that
  2726. you created in the previous chapter; see @ref{prepare for examples}.
  2727. (Below in this section, we will remind you of the state of the examples
  2728. where the last chapter left them.)
  2729. The five operations that we will cover in this chapter are:
  2730. @table @kbd
  2731. @item --append
  2732. @itemx -r
  2733. Add new entries to an archive that already exists.
  2734. @item --update
  2735. @itemx -r
  2736. Add more recent copies of archive members to the end of an archive, if
  2737. they exist.
  2738. @item --concatenate
  2739. @itemx --catenate
  2740. @itemx -A
  2741. Add one or more pre-existing archives to the end of another archive.
  2742. @item --delete
  2743. Delete items from an archive (does not work on tapes).
  2744. @item --compare
  2745. @itemx --diff
  2746. @itemx -d
  2747. Compare archive members to their counterparts in the file system.
  2748. @end table
  2749. @node current state
  2750. @subsection The Current State of the Practice Files
  2751. Currently, the listing of the directory using @command{ls} is as follows:
  2752. @example
  2753. @end example
  2754. @noindent
  2755. The archive file @samp{collection.tar} looks like this:
  2756. @example
  2757. $ @kbd{tar -tvf collection.tar}
  2758. @end example
  2759. @noindent
  2760. The archive file @samp{music.tar} looks like this:
  2761. @example
  2762. $ @kbd{tar -tvf music.tar}
  2763. @end example
  2764. @FIXME{need to fill in the above!!!}
  2765. @node append
  2766. @subsection How to Add Files to Existing Archives: @code{--append}
  2767. @UNREVISED
  2768. If you want to add files to an existing archive, you don't need to
  2769. create a new archive; you can use @value{op-append}. The archive must
  2770. already exist in order to use @samp{--append}. (A related operation
  2771. is the @samp{--update} operation; you can use this to add newer
  2772. versions of archive members to an existing archive. To learn how to
  2773. do this with @samp{--update}, @pxref{update}.)
  2774. @FIXME{Explain in second paragraph whether you can get to the previous
  2775. version -- explain whole situation somewhat more clearly.}
  2776. If you use @value{op-append} to add a file that has the same name as an
  2777. archive member to an archive containing that archive member, then the
  2778. old member is not deleted. What does happen, however, is somewhat
  2779. complex. @command{tar} @emph{allows} you to have infinite numbers of files
  2780. with the same name. Some operations treat these same-named members no
  2781. differently than any other set of archive members: for example, if you
  2782. view an archive with @value{op-list}, you will see all of those members
  2783. listed, with their modification times, owners, etc.
  2784. Other operations don't deal with these members as perfectly as you might
  2785. prefer; if you were to use @value{op-extract} to extract the archive,
  2786. only the most recently added copy of a member with the same name as four
  2787. other members would end up in the working directory. This is because
  2788. @samp{--extract} extracts an archive in the order the members appeared
  2789. in the archive; the most recently archived members will be extracted
  2790. last. Additionally, an extracted member will @emph{replace} a file of
  2791. the same name which existed in the directory already, and @command{tar}
  2792. will not prompt you about this. Thus, only the most recently archived
  2793. member will end up being extracted, as it will replace the one
  2794. extracted before it, and so on.
  2795. @FIXME{ hag -- you might want to incorporate some of the above into the
  2796. MMwtSN node; not sure. i didn't know how to make it simpler...}
  2797. There are a few ways to get around this. @FIXME-xref{Multiple Members
  2798. with the Same Name.}
  2799. @cindex Members, replacing with other members
  2800. @cindex Replacing members with other members
  2801. If you want to replace an archive member, use @value{op-delete} to
  2802. delete the member you want to remove from the archive, , and then use
  2803. @samp{--append} to add the member you want to be in the archive. Note
  2804. that you can not change the order of the archive; the most recently
  2805. added member will still appear last. In this sense, you cannot truly
  2806. ``replace'' one member with another. (Replacing one member with another
  2807. will not work on certain types of media, such as tapes; see @ref{delete}
  2808. and @ref{Media}, for more information.)
  2809. @menu
  2810. * appending files:: Appending Files to an Archive
  2811. * multiple::
  2812. @end menu
  2813. @node appending files
  2814. @subsubsection Appending Files to an Archive
  2815. @UNREVISED
  2816. @cindex Adding files to an Archive
  2817. @cindex Appending files to an Archive
  2818. @cindex Archives, Appending files to
  2819. The simplest way to add a file to an already existing archive is the
  2820. @value{op-append} operation, which writes specified files into the
  2821. archive whether or not they are already among the archived files.
  2822. When you use @samp{--append}, you @emph{must} specify file name
  2823. arguments, as there is no default. If you specify a file that already
  2824. exists in the archive, another copy of the file will be added to the
  2825. end of the archive. As with other operations, the member names of the
  2826. newly added files will be exactly the same as their names given on the
  2827. command line. The @value{op-verbose} option will print out the names
  2828. of the files as they are written into the archive.
  2829. @samp{--append} cannot be performed on some tape drives, unfortunately,
  2830. due to deficiencies in the formats those tape drives use. The archive
  2831. must be a valid @command{tar} archive, or else the results of using this
  2832. operation will be unpredictable. @xref{Media}.
  2833. To demonstrate using @samp{--append} to add a file to an archive,
  2834. create a file called @file{rock} in the @file{practice} directory.
  2835. Make sure you are in the @file{practice} directory. Then, run the
  2836. following @command{tar} command to add @file{rock} to
  2837. @file{collection.tar}:
  2838. @example
  2839. $ @kbd{tar --append --file=collection.tar rock}
  2840. @end example
  2841. @noindent
  2842. If you now use the @value{op-list} operation, you will see that
  2843. @file{rock} has been added to the archive:
  2844. @example
  2845. $ @kbd{tar --list --file=collection.tar}
  2846. -rw-rw-rw- me user 28 1996-10-18 16:31 jazz
  2847. -rw-rw-rw- me user 21 1996-09-23 16:44 blues
  2848. -rw-rw-rw- me user 20 1996-09-23 16:44 folk
  2849. -rw-rw-rw- me user 20 1996-09-23 16:44 rock
  2850. @end example
  2851. @FIXME{in theory, dan will (soon) try to turn this node into what it's
  2852. title claims it will become...}
  2853. @node multiple
  2854. @subsubsection Multiple Files with the Same Name
  2855. You can use @value{op-append} to add copies of files which have been
  2856. updated since the archive was created. (However, we do not recommend
  2857. doing this since there is another @command{tar} option called
  2858. @samp{--update}; @pxref{update} for more information. We describe this
  2859. use of @samp{--append} here for the sake of completeness.) @FIXME{is
  2860. this really a good idea, to give this whole description for something
  2861. which i believe is basically a Stupid way of doing something? certain
  2862. aspects of it show ways in which tar is more broken than i'd personally
  2863. like to admit to, specifically the last sentence. On the other hand, i
  2864. don't think it's a good idea to be saying that re explicitly don't
  2865. recommend using something, but i can't see any better way to deal with
  2866. the situation.}When you extract the archive, the older version will be
  2867. effectively lost. This works because files are extracted from an
  2868. archive in the order in which they were archived. Thus, when the
  2869. archive is extracted, a file archived later in time will replace a
  2870. file of the same name which was archived earlier, even though the older
  2871. version of the file will remain in the archive unless you delete all
  2872. versions of the file.
  2873. Supposing you change the file @file{blues} and then append the changed
  2874. version to @file{collection.tar}. As you saw above, the original
  2875. @file{blues} is in the archive @file{collection.tar}. If you change the
  2876. file and append the new version of the file to the archive, there will
  2877. be two copies in the archive. When you extract the archive, the older
  2878. version of the file will be extracted first, and then replaced by the
  2879. newer version when it is extracted.
  2880. You can append the new, changed copy of the file @file{blues} to the
  2881. archive in this way:
  2882. @example
  2883. $ @kbd{tar --append --verbose --file=collection.tar blues}
  2884. blues
  2885. @end example
  2886. @noindent
  2887. Because you specified the @samp{--verbose} option, @command{tar} has
  2888. printed the name of the file being appended as it was acted on. Now
  2889. list the contents of the archive:
  2890. @example
  2891. $ @kbd{tar --list --verbose --file=collection.tar}
  2892. -rw-rw-rw- me user 28 1996-10-18 16:31 jazz
  2893. -rw-rw-rw- me user 21 1996-09-23 16:44 blues
  2894. -rw-rw-rw- me user 20 1996-09-23 16:44 folk
  2895. -rw-rw-rw- me user 20 1996-09-23 16:44 rock
  2896. -rw-rw-rw- me user 58 1996-10-24 18:30 blues
  2897. @end example
  2898. @noindent
  2899. The newest version of @file{blues} is now at the end of the archive
  2900. (note the different creation dates and file sizes). If you extract
  2901. the archive, the older version of the file @file{blues} will be
  2902. replaced by the newer version. You can confirm this by extracting
  2903. the archive and running @samp{ls} on the directory. @xref{Writing},
  2904. for more information. (@emph{Please note:} This is the case unless
  2905. you employ the @value{op-backup} option. @FIXME-ref{Multiple Members
  2906. with the Same Name}.)
  2907. @node update
  2908. @subsection Updating an Archive
  2909. @UNREVISED
  2910. @cindex Updating an archive
  2911. In the previous section, you learned how to use @value{op-append} to add
  2912. a file to an existing archive. A related operation is
  2913. @value{op-update}. The @samp{--update} operation updates a @command{tar}
  2914. archive by comparing the date of the specified archive members against
  2915. the date of the file with the same name. If the file has been modified
  2916. more recently than the archive member, then the newer version of the
  2917. file is added to the archive (as with @value{op-append}).
  2918. Unfortunately, you cannot use @samp{--update} with magnetic tape drives.
  2919. The operation will fail.
  2920. @FIXME{other examples of media on which --update will fail? need to ask
  2921. charles and/or mib/thomas/dave shevett..}
  2922. Both @samp{--update} and @samp{--append} work by adding to the end
  2923. of the archive. When you extract a file from the archive, only the
  2924. version stored last will wind up in the file system, unless you use
  2925. the @value{op-backup} option. @FIXME-ref{Multiple Members with the
  2926. Same Name}
  2927. @menu
  2928. * how to update::
  2929. @end menu
  2930. @node how to update
  2931. @subsubsection How to Update an Archive Using @code{--update}
  2932. You must use file name arguments with the @value{op-update} operation.
  2933. If you don't specify any files, @command{tar} won't act on any files and
  2934. won't tell you that it didn't do anything (which may end up confusing
  2935. you).
  2936. @FIXME{note: the above parenthetical added because in fact, this
  2937. behavior just confused the author. :-) }
  2938. To see the @samp{--update} option at work, create a new file,
  2939. @file{classical}, in your practice directory, and some extra text to the
  2940. file @file{blues}, using any text editor. Then invoke @command{tar} with
  2941. the @samp{update} operation and the @value{op-verbose} option specified,
  2942. using the names of all the files in the practice directory as file name
  2943. arguments:
  2944. @example
  2945. $ @kbd{tar --update -v -f collection.tar blues folk rock classical}
  2946. blues
  2947. classical
  2948. $
  2949. @end example
  2950. @noindent
  2951. Because we have specified verbose mode, @command{tar} prints out the names
  2952. of the files it is working on, which in this case are the names of the
  2953. files that needed to be updated. If you run @samp{tar --list} and look
  2954. at the archive, you will see @file{blues} and @file{classical} at its
  2955. end. There will be a total of two versions of the member @samp{blues};
  2956. the one at the end will be newer and larger, since you added text before
  2957. updating it.
  2958. (The reason @command{tar} does not overwrite the older file when updating
  2959. it is because writing to the middle of a section of tape is a difficult
  2960. process. Tapes are not designed to go backward. @xref{Media}, for more
  2961. information about tapes.
  2962. @value{op-update} is not suitable for performing backups for two
  2963. reasons: it does not change directory content entries, and it lengthens
  2964. the archive every time it is used. The @sc{gnu} @command{tar} options intended
  2965. specifically for backups are more efficient. If you need to run
  2966. backups, please consult @ref{Backups}.
  2967. @node concatenate
  2968. @subsection Combining Archives with @code{--concatenate}
  2969. @cindex Adding archives to an archive
  2970. @cindex Concatenating Archives
  2971. Sometimes it may be convenient to add a second archive onto the end of
  2972. an archive rather than adding individual files to the archive. To add
  2973. one or more archives to the end of another archive, you should use the
  2974. @value{op-concatenate} operation.
  2975. To use @samp{--concatenate}, name the archives to be concatenated on the
  2976. command line. (Nothing happens if you don't list any.) The members,
  2977. and their member names, will be copied verbatim from those archives. If
  2978. this causes multiple members to have the same name, it does not delete
  2979. any members; all the members with the same name coexist. @FIXME-ref{For
  2980. information on how this affects reading the archive, Multiple
  2981. Members with the Same Name.}
  2982. To demonstrate how @samp{--concatenate} works, create two small archives
  2983. called @file{bluesrock.tar} and @file{folkjazz.tar}, using the relevant
  2984. files from @file{practice}:
  2985. @example
  2986. $ @kbd{tar -cvf bluesrock.tar blues rock}
  2987. blues
  2988. classical
  2989. $ @kbd{tar -cvf folkjazz.tar folk jazz}
  2990. folk
  2991. jazz
  2992. @end example
  2993. @noindent
  2994. If you like, You can run @samp{tar --list} to make sure the archives
  2995. contain what they are supposed to:
  2996. @example
  2997. $ @kbd{tar -tvf bluesrock.tar}
  2998. -rw-rw-rw- melissa user 105 1997-01-21 19:42 blues
  2999. -rw-rw-rw- melissa user 33 1997-01-20 15:34 rock
  3000. $ @kbd{tar -tvf folkjazz.tar}
  3001. -rw-rw-rw- melissa user 20 1996-09-23 16:44 folk
  3002. -rw-rw-rw- melissa user 65 1997-01-30 14:15 jazz
  3003. @end example
  3004. We can concatenate these two archives with @command{tar}:
  3005. @example
  3006. $ @kbd{cd ..}
  3007. $ @kbd{tar --concatenate --file=bluesrock.tar jazzfolk.tar}
  3008. @end example
  3009. If you now list the contents of the @file{bluesclass.tar}, you will see
  3010. that now it also contains the archive members of @file{jazzfolk.tar}:
  3011. @example
  3012. $ @kbd{tar --list --file=bluesrock.tar}
  3013. blues
  3014. rock
  3015. jazz
  3016. folk
  3017. @end example
  3018. When you use @samp{--concatenate}, the source and target archives must
  3019. already exist and must have been created using compatible format
  3020. parameters. @FIXME-pxref{Matching Format Parameters}The new,
  3021. concatenated archive will be called by the same name as the first
  3022. archive listed on the command line. @FIXME{is there a way to specify a
  3023. new name?}
  3024. Like @value{op-append}, this operation cannot be performed on some
  3025. tape drives, due to deficiencies in the formats those tape drives use.
  3026. @cindex @code{concatenate} vs @command{cat}
  3027. @cindex @command{cat} vs @code{concatenate}
  3028. It may seem more intuitive to you to want or try to use @command{cat} to
  3029. concatenate two archives instead of using the @samp{--concatenate}
  3030. operation; after all, @command{cat} is the utility for combining files.
  3031. However, @command{tar} archives incorporate an end-of-file marker which
  3032. must be removed if the concatenated archives are to be read properly as
  3033. one archive. @samp{--concatenate} removes the end-of-archive marker
  3034. from the target archive before each new archive is appended. If you use
  3035. @command{cat} to combine the archives, the result will not be a valid
  3036. @command{tar} format archive. If you need to retrieve files from an
  3037. archive that was added to using the @command{cat} utility, use the
  3038. @value{op-ignore-zeros} option. @xref{Ignore Zeros}, for further
  3039. information on dealing with archives improperly combined using the
  3040. @command{cat} shell utility.
  3041. @FIXME{this shouldn't go here. where should it go?} You must specify
  3042. the source archives using @value{op-file} (@value{pxref-file}). If you
  3043. do not specify the target archive, @command{tar} uses the value of the
  3044. environment variable @env{TAPE}, or, if this has not been set, the
  3045. default archive name.
  3046. @node delete
  3047. @subsection Removing Archive Members Using @samp{--delete}
  3048. @UNREVISED
  3049. @cindex Deleting files from an archive
  3050. @cindex Removing files from an archive
  3051. You can remove members from an archive by using the @value{op-delete}
  3052. option. Specify the name of the archive with @value{op-file} and then
  3053. specify the names of the members to be deleted; if you list no member
  3054. names, nothing will be deleted. The @value{op-verbose} option will
  3055. cause @command{tar} to print the names of the members as they are deleted.
  3056. As with @value{op-extract}, you must give the exact member names when
  3057. using @samp{tar --delete}. @samp{--delete} will remove all versions of
  3058. the named file from the archive. The @samp{--delete} operation can run
  3059. very slowly.
  3060. Unlike other operations, @samp{--delete} has no short form.
  3061. @cindex Tapes, using @code{--delete} and
  3062. @cindex Deleting from tape archives
  3063. This operation will rewrite the archive. You can only use
  3064. @samp{--delete} on an archive if the archive device allows you to
  3065. write to any point on the media, such as a disk; because of this, it
  3066. does not work on magnetic tapes. Do not try to delete an archive member
  3067. from a magnetic tape; the action will not succeed, and you will be
  3068. likely to scramble the archive and damage your tape. There is no safe
  3069. way (except by completely re-writing the archive) to delete files from
  3070. most kinds of magnetic tape. @xref{Media}.
  3071. To delete all versions of the file @file{blues} from the archive
  3072. @file{collection.tar} in the @file{practice} directory, make sure you
  3073. are in that directory, and then,
  3074. @example
  3075. $ @kbd{tar --list --file=collection.tar}
  3076. blues
  3077. folk
  3078. jazz
  3079. rock
  3080. practice/blues
  3081. practice/folk
  3082. practice/jazz
  3083. practice/rock
  3084. practice/blues
  3085. $ @kbd{tar --delete --file=collection.tar blues}
  3086. $ @kbd{tar --list --file=collection.tar}
  3087. folk
  3088. jazz
  3089. rock
  3090. $
  3091. @end example
  3092. @FIXME{I changed the order of these nodes around and haven't had a chance
  3093. to fix the above example's results, yet. I have to play with this and
  3094. follow it and see what it actually does!}
  3095. The @value{op-delete} option has been reported to work properly when
  3096. @command{tar} acts as a filter from @code{stdin} to @code{stdout}.
  3097. @node compare
  3098. @subsection Comparing Archive Members with the File System
  3099. @cindex Verifying the currency of an archive
  3100. @UNREVISED
  3101. The @samp{--compare} (@samp{-d}), or @samp{--diff} operation compares
  3102. specified archive members against files with the same names, and then
  3103. reports differences in file size, mode, owner, modification date and
  3104. contents. You should @emph{only} specify archive member names, not file
  3105. names. If you do not name any members, then @command{tar} will compare the
  3106. entire archive. If a file is represented in the archive but does not
  3107. exist in the file system, @command{tar} reports a difference.
  3108. You have to specify the record size of the archive when modifying an
  3109. archive with a non-default record size.
  3110. @command{tar} ignores files in the file system that do not have
  3111. corresponding members in the archive.
  3112. The following example compares the archive members @file{rock},
  3113. @file{blues} and @file{funk} in the archive @file{bluesrock.tar} with
  3114. files of the same name in the file system. (Note that there is no file,
  3115. @file{funk}; @command{tar} will report an error message.)
  3116. @example
  3117. $ @kbd{tar --compare --file=bluesrock.tar rock blues funk}
  3118. rock
  3119. blues
  3120. tar: funk not found in archive
  3121. @end example
  3122. @noindent
  3123. @FIXME{what does this actually depend on? i'm making a guess,
  3124. here.}Depending on the system where you are running @command{tar} and the
  3125. version you are running, @command{tar} may have a different error message,
  3126. such as:
  3127. @example
  3128. funk: does not exist
  3129. @end example
  3130. @FIXME-xref{somewhere, for more information about format parameters.
  3131. Melissa says: such as "format variations"? But why? Clearly I don't
  3132. get it yet; I'll deal when I get to that section.}
  3133. The spirit behind the @value{op-compare} option is to check whether the
  3134. archive represents the current state of files on disk, more than validating
  3135. the integrity of the archive media. For this later goal, @xref{verify}.
  3136. @node create options
  3137. @section Options Used by @code{--create}
  3138. The previous chapter described the basics of how to use
  3139. @value{op-create} to create an archive from a set of files.
  3140. @xref{create}. This section described advanced options to be used with
  3141. @samp{--create}.
  3142. @menu
  3143. * Ignore Failed Read::
  3144. @end menu
  3145. @node Ignore Failed Read
  3146. @subsection Ignore Fail Read
  3147. @table @kbd
  3148. @item --ignore-failed-read
  3149. Do not exit with nonzero on unreadable files or directories.
  3150. @end table
  3151. @node extract options
  3152. @section Options Used by @code{--extract}
  3153. @UNREVISED
  3154. @FIXME{i need to get dan to go over these options with me and see if
  3155. there's a better way of organizing them.}
  3156. The previous chapter showed how to use @value{op-extract} to extract
  3157. an archive into the filesystem. Various options cause @command{tar} to
  3158. extract more information than just file contents, such as the owner,
  3159. the permissions, the modification date, and so forth. This section
  3160. presents options to be used with @samp{--extract} when certain special
  3161. considerations arise. You may review the information presented in
  3162. @ref{extract} for more basic information about the
  3163. @samp{--extract} operation.
  3164. @menu
  3165. * Reading:: Options to Help Read Archives
  3166. * Writing:: Changing How @command{tar} Writes Files
  3167. * Scarce:: Coping with Scarce Resources
  3168. @end menu
  3169. @node Reading
  3170. @subsection Options to Help Read Archives
  3171. @cindex Options when reading archives
  3172. @cindex Reading incomplete records
  3173. @cindex Records, incomplete
  3174. @cindex End-of-archive entries, ignoring
  3175. @cindex Ignoring end-of-archive entries
  3176. @cindex Large lists of file names on small machines
  3177. @cindex Small memory
  3178. @cindex Running out of space
  3179. @UNREVISED
  3180. Normally, @command{tar} will request data in full record increments from
  3181. an archive storage device. If the device cannot return a full record,
  3182. @command{tar} will report an error. However, some devices do not always
  3183. return full records, or do not require the last record of an archive to
  3184. be padded out to the next record boundary. To keep reading until you
  3185. obtain a full record, or to accept an incomplete record if it contains
  3186. an end-of-archive marker, specify the @value{op-read-full-records} option
  3187. in conjunction with the @value{op-extract} or @value{op-list} operations.
  3188. @value{xref-read-full-records}.
  3189. The @value{op-read-full-records} option is turned on by default when
  3190. @command{tar} reads an archive from standard input, or from a remote
  3191. machine. This is because on BSD Unix systems, attempting to read a
  3192. pipe returns however much happens to be in the pipe, even if it is
  3193. less than was requested. If this option were not enabled, @command{tar}
  3194. would fail as soon as it read an incomplete record from the pipe.
  3195. If you're not sure of the blocking factor of an archive, you can
  3196. read the archive by specifying @value{op-read-full-records} and
  3197. @value{op-blocking-factor}, using a blocking factor larger than what the
  3198. archive uses. This lets you avoid having to determine the blocking factor
  3199. of an archive. @value{xref-blocking-factor}.
  3200. @menu
  3201. * read full records::
  3202. * Ignore Zeros::
  3203. @end menu
  3204. @node read full records
  3205. @unnumberedsubsubsec Reading Full Records
  3206. @FIXME{need sentence or so of intro here}
  3207. @table @kbd
  3208. @item --read-full-records
  3209. @item -B
  3210. Use in conjunction with @value{op-extract} to read an archive which
  3211. contains incomplete records, or one which has a blocking factor less
  3212. than the one specified.
  3213. @end table
  3214. @node Ignore Zeros
  3215. @unnumberedsubsubsec Ignoring Blocks of Zeros
  3216. Normally, @command{tar} stops reading when it encounters a block of zeros
  3217. between file entries (which usually indicates the end of the archive).
  3218. @value{op-ignore-zeros} allows @command{tar} to completely read an archive
  3219. which contains a block of zeros before the end (i.e.@: a damaged
  3220. archive, or one which was created by concatenating several archives
  3221. together).
  3222. The @value{op-ignore-zeros} option is turned off by default because many
  3223. versions of @command{tar} write garbage after the end-of-archive entry,
  3224. since that part of the media is never supposed to be read. @sc{gnu}
  3225. @command{tar} does not write after the end of an archive, but seeks to
  3226. maintain compatiblity among archiving utilities.
  3227. @table @kbd
  3228. @item --ignore-zeros
  3229. @itemx -i
  3230. To ignore blocks of zeros (ie.@: end-of-archive entries) which may be
  3231. encountered while reading an archive. Use in conjunction with
  3232. @value{op-extract} or @value{op-list}.
  3233. @end table
  3234. @node Writing
  3235. @subsection Changing How @command{tar} Writes Files
  3236. @cindex Overwriting old files, prevention
  3237. @cindex Protecting old files
  3238. @cindex Modification times of extracted files
  3239. @cindex Permissions of extracted files
  3240. @cindex Modes of extracted files
  3241. @cindex Writing extracted files to standard output
  3242. @cindex Standard output, writing extracted files to
  3243. @UNREVISED
  3244. @FIXME{need to mention the brand new option, --backup}
  3245. @menu
  3246. * Dealing with Old Files::
  3247. * Overwrite Old Files::
  3248. * Keep Old Files::
  3249. * Unlink First::
  3250. * Recursive Unlink::
  3251. * Modification Times::
  3252. * Setting Access Permissions::
  3253. * Writing to Standard Output::
  3254. * remove files::
  3255. @end menu
  3256. @node Dealing with Old Files
  3257. @unnumberedsubsubsec Options Controlling the Overwriting of Existing Files
  3258. When extracting files, if @command{tar} discovers that the extracted
  3259. file already exists, it normally replaces the file by removing it before
  3260. extracting it, to prevent confusion in the presence of hard or symbolic
  3261. links. (If the existing file is a symbolic link, it is removed, not
  3262. followed.) However, if a directory cannot be removed because it is
  3263. nonempty, @command{tar} neither removes it nor modifies its ownership,
  3264. permissions, or time stamps.
  3265. To be more cautious and prevent existing files from being replaced, use
  3266. the @value{op-keep-old-files} option. It causes @command{tar} to refuse
  3267. to replace or update a file that already exists, i.e., a file with the
  3268. same name as an archive member prevents extraction of that archive
  3269. member. Instead, it reports an error.
  3270. To be more aggressive about altering existing files, use the
  3271. @value{op-overwrite} option. It causes @command{tar} to overwrite
  3272. existing files and to follow existing symbolic links when extracting.
  3273. Some people argue that @sc{gnu} @command{tar} should not hesitate to overwrite
  3274. files with other files when extracting. When extracting a @command{tar}
  3275. archive, they expect to see a faithful copy of the state of the filesystem
  3276. when the archive was created. It is debatable that this would always
  3277. be a proper behavior. For example, suppose one has an archive in
  3278. which @file{usr/local} is a link to @file{usr/local2}. Since then,
  3279. maybe the site removed the link and renamed the whole hierarchy from
  3280. @file{/usr/local2} to @file{/usr/local}. Such things happen all the time.
  3281. I guess it would not be welcome at all that @sc{gnu} @command{tar} removes the
  3282. whole hierarchy just to make room for the link to be reinstated (unless it
  3283. @emph{also} simultaneously restores the full @file{/usr/local2}, of course!
  3284. @sc{gnu} @command{tar} is indeed able to remove a whole hierarchy to reestablish a
  3285. symbolic link, for example, but @emph{only if} @value{op-recursive-unlink}
  3286. is specified to allow this behavior. In any case, single files are
  3287. silently removed.
  3288. Finally, the @value{op-unlink-first} option can improve performance in
  3289. some cases by causing @command{tar} to remove files unconditionally
  3290. before extracting them.
  3291. @node Overwrite Old Files
  3292. @unnumberedsubsubsec Overwrite Old Files
  3293. @table @kbd
  3294. @item --overwrite
  3295. Overwrite existing files and directory metadata when extracting files
  3296. from an archive.
  3297. This
  3298. causes @command{tar} to write extracted files into the file system without
  3299. regard to the files already on the system; i.e., files with the same
  3300. names as archive members are overwritten when the archive is extracted.
  3301. It also causes @command{tar} to extract the ownership, permissions,
  3302. and time stamps onto any preexisting files or directories.
  3303. If the name of a corresponding file name is a symbolic link, the file
  3304. pointed to by the symbolic link will be overwritten instead of the
  3305. symbolic link itself (if this is possible). Moreover, special devices,
  3306. empty directories and even symbolic links are automatically removed if
  3307. they are in the way of extraction.
  3308. Be careful when using the @value{op-overwrite} option, particularly when
  3309. combined with the @value{op-absolute-names} option, as this combination
  3310. can change the contents, ownership or permissions of any file on your
  3311. system. Also, many systems do not take kindly to overwriting files that
  3312. are currently being executed.
  3313. @end table
  3314. @node Keep Old Files
  3315. @unnumberedsubsubsec Keep Old Files
  3316. @table @kbd
  3317. @item --keep-old-files
  3318. @itemx -k
  3319. Do not replace existing files from archive. The
  3320. @value{op-keep-old-files} option prevents @command{tar} from replacing
  3321. existing files with files with the same name from the archive.
  3322. The @value{op-keep-old-files} option is meaningless with @value{op-list}.
  3323. Prevents @command{tar} from replacing files in the file system during
  3324. extraction.
  3325. @end table
  3326. @node Unlink First
  3327. @unnumberedsubsubsec Unlink First
  3328. @table @kbd
  3329. @item --unlink-first
  3330. @itemx -U
  3331. Remove files before extracting over them.
  3332. This can make @command{tar} run a bit faster if you know in advance
  3333. that the extracted files all need to be removed. Normally this option
  3334. slows @command{tar} down slightly, so it is disabled by default.
  3335. @end table
  3336. @node Recursive Unlink
  3337. @unnumberedsubsubsec Recursive Unlink
  3338. @table @kbd
  3339. @item --recursive-unlink
  3340. When this option is specified, try removing files and directory hierarchies
  3341. before extracting over them. @emph{This is a dangerous option!}
  3342. @end table
  3343. If you specify the @value{op-recursive-unlink} option,
  3344. @command{tar} removes @emph{anything} that keeps you from extracting a file
  3345. as far as current permissions will allow it. This could include removal
  3346. of the contents of a full directory hierarchy.
  3347. @node Modification Times
  3348. @unnumberedsubsubsec Setting Modification Times
  3349. Normally, @command{tar} sets the modification times of extracted files to
  3350. the modification times recorded for the files in the archive, but
  3351. limits the permissions of extracted files by the current @code{umask}
  3352. setting.
  3353. To set the modification times of extracted files to the time when
  3354. the files were extracted, use the @value{op-touch} option in
  3355. conjunction with @value{op-extract}.
  3356. @table @kbd
  3357. @item --touch
  3358. @itemx -m
  3359. Sets the modification time of extracted archive members to the time
  3360. they were extracted, not the time recorded for them in the archive.
  3361. Use in conjunction with @value{op-extract}.
  3362. @end table
  3363. @node Setting Access Permissions
  3364. @unnumberedsubsubsec Setting Access Permissions
  3365. To set the modes (access permissions) of extracted files to those
  3366. recorded for those files in the archive, use @samp{--same-permissions}
  3367. in conjunction with the @value{op-extract} operation. @FIXME{Should be
  3368. aliased to ignore-umask.}
  3369. @table @kbd
  3370. @item --preserve-permission
  3371. @itemx --same-permission
  3372. @itemx --ignore-umask
  3373. @itemx -p
  3374. Set modes of extracted archive members to those recorded in the
  3375. archive, instead of current umask settings. Use in conjunction with
  3376. @value{op-extract}.
  3377. @end table
  3378. @FIXME{Following paragraph needs to be rewritten: why doesn't this cat
  3379. files together, why is this useful. is it really useful with
  3380. more than one file?}
  3381. @node Writing to Standard Output
  3382. @unnumberedsubsubsec Writing to Standard Output
  3383. To write the extracted files to the standard output, instead of
  3384. creating the files on the file system, use @value{op-to-stdout} in
  3385. conjunction with @value{op-extract}. This option is useful if you are
  3386. extracting files to send them through a pipe, and do not need to
  3387. preserve them in the file system. If you extract multiple members,
  3388. they appear on standard output concatenated, in the order they are
  3389. found in the archive.
  3390. @table @kbd
  3391. @item --to-stdout
  3392. @itemx -O
  3393. Writes files to the standard output. Used in conjunction with
  3394. @value{op-extract}. Extract files to standard output. When this option
  3395. is used, instead of creating the files specified, @command{tar} writes
  3396. the contents of the files extracted to its standard output. This may
  3397. be useful if you are only extracting the files in order to send them
  3398. through a pipe. This option is meaningless with @value{op-list}.
  3399. @end table
  3400. @FIXME{Why would you want to do such a thing, how are files separated on
  3401. the standard output? is this useful with more that one file? Are
  3402. pipes the real reason?}
  3403. @node remove files
  3404. @unnumberedsubsubsec Removing Files
  3405. @FIXME{the various macros in the front of the manual think that this
  3406. option goes in this section. i have no idea; i only know it's nowhere
  3407. else in the book...}
  3408. @table @kbd
  3409. @item --remove-files
  3410. Remove files after adding them to the archive.
  3411. @end table
  3412. @node Scarce
  3413. @subsection Coping with Scarce Resources
  3414. @cindex Middle of the archive, starting in the
  3415. @cindex Running out of space during extraction
  3416. @cindex Disk space, running out of
  3417. @cindex Space on the disk, recovering from lack of
  3418. @UNREVISED
  3419. @menu
  3420. * Starting File::
  3421. * Same Order::
  3422. @end menu
  3423. @node Starting File
  3424. @unnumberedsubsubsec Starting File
  3425. @table @kbd
  3426. @item --starting-file=@var{name}
  3427. @itemx -K @var{name}
  3428. Starts an operation in the middle of an archive. Use in conjunction
  3429. with @value{op-extract} or @value{op-list}.
  3430. @end table
  3431. If a previous attempt to extract files failed due to lack of disk
  3432. space, you can use @value{op-starting-file} to start extracting only
  3433. after member @var{name} of the archive. This assumes, of course, that
  3434. there is now free space, or that you are now extracting into a
  3435. different file system. (You could also choose to suspend @command{tar},
  3436. remove unnecessary files from the file system, and then restart the
  3437. same @command{tar} operation. In this case, @value{op-starting-file} is
  3438. not necessary. @value{xref-incremental}, @value{xref-interactive},
  3439. and @value{ref-exclude}.)
  3440. @node Same Order
  3441. @unnumberedsubsubsec Same Order
  3442. @table @kbd
  3443. @item --same-order
  3444. @itemx --preserve-order
  3445. @itemx -s
  3446. To process large lists of file names on machines with small amounts of
  3447. memory. Use in conjunction with @value{op-compare},
  3448. @value{op-list}
  3449. or @value{op-extract}.
  3450. @end table
  3451. @FIXME{we don't need/want --preserve to exist any more (from melissa:
  3452. ie, don't want that *version* of the option to exist, or don't want
  3453. the option to exist in either version?}
  3454. @FIXME{i think this explanation is lacking.}
  3455. The @value{op-same-order} option tells @command{tar} that the list of file
  3456. names to be listed or extracted is sorted in the same order as the
  3457. files in the archive. This allows a large list of names to be used,
  3458. even on a small machine that would not otherwise be able to hold all
  3459. the names in memory at the same time. Such a sorted list can easily be
  3460. created by running @samp{tar -t} on the archive and editing its output.
  3461. This option is probably never needed on modern computer systems.
  3462. @node backup
  3463. @section Backup options
  3464. @cindex backup options
  3465. @sc{gnu} @command{tar} offers options for making backups of files before writing
  3466. new versions. These options control the details of these backups.
  3467. They may apply to the archive itself before it is created or rewritten,
  3468. as well as individual extracted members. Other @sc{gnu} programs (@command{cp},
  3469. @command{install}, @command{ln}, and @command{mv}, for example) offer similar
  3470. options.
  3471. Backup options may prove unexpectedly useful when extracting archives
  3472. containing many members having identical name, or when extracting archives
  3473. on systems having file name limitations, making different members appear
  3474. has having similar names through the side-effect of name truncation.
  3475. (This is true only if we have a good scheme for truncated backup names,
  3476. which I'm not sure at all: I suspect work is needed in this area.)
  3477. When any existing file is backed up before being overwritten by extraction,
  3478. then clashing files are automatically be renamed to be unique, and the
  3479. true name is kept for only the last file of a series of clashing files.
  3480. By using verbose mode, users may track exactly what happens.
  3481. At the detail level, some decisions are still experimental, and may
  3482. change in the future, we are waiting comments from our users. So, please
  3483. do not learn to depend blindly on the details of the backup features.
  3484. For example, currently, directories themselves are never renamed through
  3485. using these options, so, extracting a file over a directory still has
  3486. good chances to fail. Also, backup options apply to created archives,
  3487. not only to extracted members. For created archives, backups will not
  3488. be attempted when the archive is a block or character device, or when it
  3489. refers to a remote file.
  3490. For the sake of simplicity and efficiency, backups are made by renaming old
  3491. files prior to creation or extraction, and not by copying. The original
  3492. name is restored if the file creation fails. If a failure occurs after a
  3493. partial extraction of a file, both the backup and the partially extracted
  3494. file are kept.
  3495. @table @samp
  3496. @item --backup[=@var{method}]
  3497. @opindex --backup
  3498. @vindex VERSION_CONTROL
  3499. @cindex backups
  3500. Back up files that are about to be overwritten or removed.
  3501. Without this option, the original versions are destroyed.
  3502. Use @var{method} to determine the type of backups made.
  3503. If @var{method} is not specified, use the value of the @env{VERSION_CONTROL}
  3504. environment variable. And if @env{VERSION_CONTROL} is not set,
  3505. use the @samp{existing} method.
  3506. @vindex version-control @r{Emacs variable}
  3507. This option corresponds to the Emacs variable @samp{version-control};
  3508. the same values for @var{method} are accepted as in Emacs. This option
  3509. also allows more descriptive names. The valid @var{method}s are:
  3510. @table @samp
  3511. @item t
  3512. @itemx numbered
  3513. @opindex numbered @r{backup method}
  3514. Always make numbered backups.
  3515. @item nil
  3516. @itemx existing
  3517. @opindex existing @r{backup method}
  3518. Make numbered backups of files that already have them, simple backups
  3519. of the others.
  3520. @item never
  3521. @itemx simple
  3522. @opindex simple @r{backup method}
  3523. Always make simple backups.
  3524. @end table
  3525. @item --suffix=@var{suffix}
  3526. @opindex --suffix
  3527. @cindex backup suffix
  3528. @vindex SIMPLE_BACKUP_SUFFIX
  3529. Append @var{suffix} to each backup file made with @samp{--backup}. If this
  3530. option is not specified, the value of the @env{SIMPLE_BACKUP_SUFFIX}
  3531. environment variable is used. And if @env{SIMPLE_BACKUP_SUFFIX} is not
  3532. set, the default is @samp{~}, just as in Emacs.
  3533. @end table
  3534. Some people express the desire to @emph{always} use the @value{op-backup}
  3535. option, by defining some kind of alias or script. This is not as easy
  3536. as one may think, due to the fact that old style options should appear first
  3537. and consume arguments a bit unpredictably for an alias or script. But,
  3538. if you are ready to give up using old style options, you may resort to
  3539. using something like (a Bourne shell function here):
  3540. @example
  3541. tar () @{ /usr/local/bin/tar --backup $*; @}
  3542. @end example
  3543. @node Applications
  3544. @section Notable @command{tar} Usages
  3545. @UNREVISED
  3546. @FIXME{Using Unix file linking capability to recreate directory
  3547. structures---linking files into one subdirectory and then
  3548. @command{tar}ring that directory.}
  3549. @FIXME{Nice hairy example using absolute-names, newer, etc.}
  3550. @findex uuencode
  3551. You can easily use archive files to transport a group of files from
  3552. one system to another: put all relevant files into an archive on one
  3553. computer system, transfer the archive to another system, and extract
  3554. the contents there. The basic transfer medium might be magnetic tape,
  3555. Internet FTP, or even electronic mail (though you must encode the
  3556. archive with @command{uuencode} in order to transport it properly by
  3557. mail). Both machines do not have to use the same operating system, as
  3558. long as they both support the @command{tar} program.
  3559. For example, here is how you might copy a directory's contents from
  3560. one disk to another, while preserving the dates, modes, owners and
  3561. link-structure of all the files therein. In this case, the transfer
  3562. medium is a @dfn{pipe}, which is one a Unix redirection mechanism:
  3563. @smallexample
  3564. $ @kbd{cd sourcedir; tar -cf - . | (cd targetdir; tar -xf -)}
  3565. @end smallexample
  3566. @noindent
  3567. The command also works using short option forms:
  3568. @FIXME{The following using standard input/output correct??}
  3569. @smallexample
  3570. $ @w{@kbd{cd sourcedir; tar --create --file=- . | (cd targetdir; tar --extract --file=-)}}
  3571. @end smallexample
  3572. @noindent
  3573. This is one of the easiest methods to transfer a @command{tar} archive.
  3574. @node looking ahead
  3575. @section Looking Ahead: The Rest of this Manual
  3576. You have now seen how to use all eight of the operations available to
  3577. @command{tar}, and a number of the possible options. The next chapter
  3578. explains how to choose and change file and archive names, how to use
  3579. files to store names of other files which you can then call as
  3580. arguments to @command{tar} (this can help you save time if you expect to
  3581. archive the same list of files a number of times), and so forth.
  3582. @FIXME{in case it's not obvious, i'm making this up in some sense
  3583. based on my imited memory of what the next chapter *really* does. i
  3584. just wanted to flesh out this final section a little bit so i'd
  3585. remember to sitck it in here. :-)}
  3586. If there are too many files to conveniently list on the command line,
  3587. you can list the names in a file, and @command{tar} will read that file.
  3588. @value{xref-files-from}.
  3589. There are various ways of causing @command{tar} to skip over some files,
  3590. and not archive them. @xref{Choosing}.
  3591. @node Backups
  3592. @chapter Performing Backups and Restoring Files
  3593. @UNREVISED
  3594. @sc{gnu} @command{tar} is distributed along with the scripts which the Free
  3595. Software Foundation uses for performing backups. There is no corresponding
  3596. scripts available yet for doing restoration of files. Even if there is
  3597. a good chance those scripts may be satisfying to you, they are not the
  3598. only scripts or methods available for doing backups and restore. You may
  3599. well create your own, or use more sophisticated packages dedicated to
  3600. that purpose.
  3601. Some users are enthusiastic about @code{Amanda} (The Advanced Maryland
  3602. Automatic Network Disk Archiver), a backup system developed by James
  3603. da Silva @file{jds@@cs.umd.edu} and available on many Unix systems.
  3604. This is free software, and it is available at these places:
  3605. @example
  3606. http://www.cs.umd.edu/projects/amanda/amanda.html
  3607. ftp://ftp.cs.umd.edu/pub/amanda
  3608. @end example
  3609. @ifclear PUBLISH
  3610. Here is a possible plan for a future documentation about the backuping
  3611. scripts which are provided within the @sc{gnu} @command{tar} distribution.
  3612. @example
  3613. .* dumps
  3614. . + what are dumps
  3615. . + different levels of dumps
  3616. . - full dump = dump everything
  3617. . - level 1, level 2 dumps etc, -
  3618. A level n dump dumps everything changed since the last level
  3619. n-1 dump (?)
  3620. . + how to use scripts for dumps (ie, the concept)
  3621. . - scripts to run after editing backup specs (details)
  3622. . + Backup Specs, what is it.
  3623. . - how to customize
  3624. . - actual text of script [/sp/dump/backup-specs]
  3625. . + Problems
  3626. . - rsh doesn't work
  3627. . - rtape isn't installed
  3628. . - (others?)
  3629. . + the --incremental option of tar
  3630. . + tapes
  3631. . - write protection
  3632. . - types of media
  3633. . : different sizes and types, useful for different things
  3634. . - files and tape marks
  3635. one tape mark between files, two at end.
  3636. . - positioning the tape
  3637. MT writes two at end of write,
  3638. backspaces over one when writing again.
  3639. @end example
  3640. @end ifclear
  3641. This chapter documents both the provided FSF scripts and @command{tar}
  3642. options which are more specific to usage as a backup tool.
  3643. To @dfn{back up} a file system means to create archives that contain
  3644. all the files in that file system. Those archives can then be used to
  3645. restore any or all of those files (for instance if a disk crashes or a
  3646. file is accidentally deleted). File system @dfn{backups} are also
  3647. called @dfn{dumps}.
  3648. @menu
  3649. * Full Dumps:: Using @command{tar} to Perform Full Dumps
  3650. * Inc Dumps:: Using @command{tar} to Perform Incremental Dumps
  3651. * incremental and listed-incremental:: The Incremental Options
  3652. * Backup Levels:: Levels of Backups
  3653. * Backup Parameters:: Setting Parameters for Backups and Restoration
  3654. * Scripted Backups:: Using the Backup Scripts
  3655. * Scripted Restoration:: Using the Restore Script
  3656. @end menu
  3657. @node Full Dumps
  3658. @section Using @command{tar} to Perform Full Dumps
  3659. @UNREVISED
  3660. @cindex full dumps
  3661. @cindex dumps, full
  3662. @cindex corrupted archives
  3663. Full dumps should only be made when no other people or programs
  3664. are modifying files in the filesystem. If files are modified while
  3665. @command{tar} is making the backup, they may not be stored properly in
  3666. the archive, in which case you won't be able to restore them if you
  3667. have to. (Files not being modified are written with no trouble, and do
  3668. not corrupt the entire archive.)
  3669. You will want to use the @value{op-label} option to give the archive a
  3670. volume label, so you can tell what this archive is even if the label
  3671. falls off the tape, or anything like that.
  3672. Unless the filesystem you are dumping is guaranteed to fit on
  3673. one volume, you will need to use the @value{op-multi-volume} option.
  3674. Make sure you have enough tapes on hand to complete the backup.
  3675. If you want to dump each filesystem separately you will need to use
  3676. the @value{op-one-file-system} option to prevent @command{tar} from crossing
  3677. filesystem boundaries when storing (sub)directories.
  3678. The @value{op-incremental} option is not needed, since this is a complete
  3679. copy of everything in the filesystem, and a full restore from this
  3680. backup would only be done onto a completely empty disk.
  3681. Unless you are in a hurry, and trust the @command{tar} program (and your
  3682. tapes), it is a good idea to use the @value{op-verify} option, to make
  3683. sure your files really made it onto the dump properly. This will
  3684. also detect cases where the file was modified while (or just after)
  3685. it was being archived. Not all media (notably cartridge tapes) are
  3686. capable of being verified, unfortunately.
  3687. @value{op-listed-incremental} take a file name argument always. If the
  3688. file doesn't exist, run a level zero dump, creating the file. If the
  3689. file exists, uses that file to see what has changed.
  3690. @value{op-incremental} @FIXME{look it up}
  3691. @value{op-incremental} handle old @sc{gnu}-format incremental backup.
  3692. This option should only be used when creating an incremental backup of
  3693. a filesystem. When the @value{op-incremental} option is used, @command{tar}
  3694. writes, at the beginning of the archive, an entry for each of the
  3695. directories that will be operated on. The entry for a directory
  3696. includes a list of all the files in the directory at the time the
  3697. dump was done, and a flag for each file indicating whether the file
  3698. is going to be put in the archive. This information is used when
  3699. doing a complete incremental restore.
  3700. Note that this option causes @command{tar} to create a non-standard
  3701. archive that may not be readable by non-@sc{gnu} versions of the @command{tar}
  3702. program.
  3703. The @value{op-incremental} option means the archive is an incremental
  3704. backup. Its meaning depends on the command that it modifies.
  3705. If the @value{op-incremental} option is used with @value{op-list}, @command{tar}
  3706. will list, for each directory in the archive, the list of files in
  3707. that directory at the time the archive was created. This information
  3708. is put out in a format that is not easy for humans to read, but which
  3709. is unambiguous for a program: each file name is preceded by either a
  3710. @samp{Y} if the file is present in the archive, an @samp{N} if the
  3711. file is not included in the archive, or a @samp{D} if the file is
  3712. a directory (and is included in the archive). Each file name is
  3713. terminated by a null character. The last file is followed by an
  3714. additional null and a newline to indicate the end of the data.
  3715. If the @value{op-incremental} option is used with @value{op-extract}, then
  3716. when the entry for a directory is found, all files that currently
  3717. exist in that directory but are not listed in the archive @emph{are
  3718. deleted from the directory}.
  3719. This behavior is convenient when you are restoring a damaged file
  3720. system from a succession of incremental backups: it restores the
  3721. entire state of the file system to that which obtained when the backup
  3722. was made. If you don't use @value{op-incremental}, the file system will
  3723. probably fill up with files that shouldn't exist any more.
  3724. @value{op-listed-incremental} handle new @sc{gnu}-format incremental backup.
  3725. This option handles new @sc{gnu}-format incremental backup. It has much the
  3726. same effect as @value{op-incremental}, but also the time when the dump
  3727. is done and the list of directories dumped is written to the given
  3728. @var{file}. When restoring, only files newer than the saved time are
  3729. restored, and the directory list is used to speed up operations.
  3730. @value{op-listed-incremental} acts like @value{op-incremental}, but when
  3731. used in conjunction with @value{op-create} will also cause @command{tar} to
  3732. use the file @var{file}, which contains information about the state
  3733. of the filesystem at the time of the last backup, to decide which
  3734. files to include in the archive being created. That file will then
  3735. be updated by @command{tar}. If the file @var{file} does not exist when
  3736. this option is specified, @command{tar} will create it, and include all
  3737. appropriate files in the archive.
  3738. The file, which is archive independent, contains the date it was last
  3739. modified and a list of devices, inode numbers and directory names.
  3740. @command{tar} will archive files with newer mod dates or inode change
  3741. times, and directories with an unchanged inode number and device but
  3742. a changed directory name. The file is updated after the files to
  3743. be archived are determined, but before the new archive is actually
  3744. created.
  3745. @sc{gnu} @command{tar} actually writes the file twice: once before the data
  3746. and written, and once after.
  3747. @node Inc Dumps
  3748. @section Using @command{tar} to Perform Incremental Dumps
  3749. @UNREVISED
  3750. @cindex incremental dumps
  3751. @cindex dumps, incremental
  3752. Performing incremental dumps is similar to performing full dumps,
  3753. although a few more options will usually be needed.
  3754. A standard scheme is to do a @emph{monthly} (full) dump once a month,
  3755. a @emph{weekly} dump once a week of everything since the last monthly
  3756. and a @emph{daily} every day of everything since the last (weekly or
  3757. monthly) dump.
  3758. Here is a sample script to dump the directory hierarchies @samp{/usr}
  3759. and @samp{/var}.
  3760. @example
  3761. #! /bin/sh
  3762. tar --create \
  3763. --blocking-factor=126 \
  3764. --file=/dev/rmt/0 \
  3765. --label="`hostname` /usr /var `date +%Y-%m-%d`" \
  3766. --listed-incremental=/var/log/usr-var.snar \
  3767. --verbose \
  3768. /usr /var
  3769. @end example
  3770. This script uses the file @file{/var/log/usr-var.snar} as a snapshot to
  3771. store information about the previous tar dump.
  3772. The blocking factor 126 is an attempt to make the tape drive stream.
  3773. Some tape devices cannot handle 64 kB blocks or larger, and require the
  3774. block size to be a multiple of 1 kB; for these devices, 126 is the
  3775. largest blocking factor that can be used.
  3776. @node incremental and listed-incremental
  3777. @section The Incremental Options
  3778. @UNREVISED
  3779. @value{op-incremental} is used in conjunction with @value{op-create},
  3780. @value{op-extract} or @value{op-list} when backing up and restoring file
  3781. systems. An archive cannot be extracted or listed with the
  3782. @value{op-incremental} option specified unless it was created with the
  3783. option specified. This option should only be used by a script, not by
  3784. the user, and is usually disregarded in favor of
  3785. @value{op-listed-incremental}, which is described below.
  3786. @value{op-incremental} in conjunction with @value{op-create} causes
  3787. @command{tar} to write, at the beginning of the archive, an entry for
  3788. each of the directories that will be archived. The entry for a
  3789. directory includes a list of all the files in the directory at the
  3790. time the archive was created and a flag for each file indicating
  3791. whether or not the file is going to be put in the archive.
  3792. Note that this option causes @command{tar} to create a non-standard
  3793. archive that may not be readable by non-@sc{gnu} versions of the @command{tar}
  3794. program.
  3795. @value{op-incremental} in conjunction with @value{op-extract} causes
  3796. @command{tar} to read the lists of directory contents previously stored
  3797. in the archive, @emph{delete} files in the file system that did not
  3798. exist in their directories when the archive was created, and then
  3799. extract the files in the archive.
  3800. This behavior is convenient when restoring a damaged file system from
  3801. a succession of incremental backups: it restores the entire state of
  3802. the file system to that which obtained when the backup was made. If
  3803. @value{op-incremental} isn't specified, the file system will probably
  3804. fill up with files that shouldn't exist any more.
  3805. @value{op-incremental} in conjunction with @value{op-list} causes
  3806. @command{tar} to print, for each directory in the archive, the list of
  3807. files in that directory at the time the archive was created. This
  3808. information is put out in a format that is not easy for humans to
  3809. read, but which is unambiguous for a program: each file name is
  3810. preceded by either a @samp{Y} if the file is present in the archive,
  3811. an @samp{N} if the file is not included in the archive, or a @samp{D}
  3812. if the file is a directory (and is included in the archive). Each
  3813. file name is terminated by a null character. The last file is followed
  3814. by an additional null and a newline to indicate the end of the data.
  3815. @value{op-listed-incremental} acts like @value{op-incremental}, but when
  3816. used in conjunction with @value{op-create} will also cause @command{tar}
  3817. to use the file @var{snapshot-file}, which contains information about
  3818. the state of the file system at the time of the last backup, to decide
  3819. which files to include in the archive being created. That file will
  3820. then be updated by @command{tar}. If the file @var{file} does not exist
  3821. when this option is specified, @command{tar} will create it, and include
  3822. all appropriate files in the archive.
  3823. The file @var{file}, which is archive independent, contains the date
  3824. it was last modified and a list of devices, inode numbers and
  3825. directory names. @command{tar} will archive files with newer mod dates
  3826. or inode change times, and directories with an unchanged inode number
  3827. and device but a changed directory name. The file is updated after
  3828. the files to be archived are determined, but before the new archive is
  3829. actually created.
  3830. Incremental dumps depend crucially on time stamps, so the results are
  3831. unreliable if you modify a file's time stamps during dumping (e.g.@:
  3832. with the @samp{--atime-preserve} option), or if you set the clock
  3833. backwards.
  3834. Despite it should be obvious that a device has a non-volatile value, NFS
  3835. devices have non-dependable values when an automounter gets in the picture.
  3836. This led to a great deal of spurious redumping in incremental dumps,
  3837. so it is somewhat useless to compare two NFS devices numbers over time.
  3838. So @command{tar} now considers all NFS devices as being equal when it comes
  3839. to comparing directories; this is fairly gross, but there does not seem
  3840. to be a better way to go.
  3841. @FIXME{this section needs to be written}
  3842. @node Backup Levels
  3843. @section Levels of Backups
  3844. @UNREVISED
  3845. An archive containing all the files in the file system is called a
  3846. @dfn{full backup} or @dfn{full dump}. You could insure your data by
  3847. creating a full dump every day. This strategy, however, would waste a
  3848. substantial amount of archive media and user time, as unchanged files
  3849. are daily re-archived.
  3850. It is more efficient to do a full dump only occasionally. To back up
  3851. files between full dumps, you can a incremental dump. A @dfn{level
  3852. one} dump archives all the files that have changed since the last full
  3853. dump.
  3854. A typical dump strategy would be to perform a full dump once a week,
  3855. and a level one dump once a day. This means some versions of files
  3856. will in fact be archived more than once, but this dump strategy makes
  3857. it possible to restore a file system to within one day of accuracy by
  3858. only extracting two archives---the last weekly (full) dump and the
  3859. last daily (level one) dump. The only information lost would be in
  3860. files changed or created since the last daily backup. (Doing dumps
  3861. more than once a day is usually not worth the trouble).
  3862. @sc{gnu} @command{tar} comes with scripts you can use to do full and level-one
  3863. dumps. Using scripts (shell programs) to perform backups and
  3864. restoration is a convenient and reliable alternative to typing out
  3865. file name lists and @command{tar} commands by hand.
  3866. Before you use these scripts, you need to edit the file
  3867. @file{backup-specs}, which specifies parameters used by the backup
  3868. scripts and by the restore script. @FIXME{There is no such restore
  3869. script!}@FIXME-xref{Script Syntax}Once the backup parameters
  3870. are set, you can perform backups or restoration by running the
  3871. appropriate script.
  3872. The name of the restore script is @code{restore}. @FIXME{There is
  3873. no such restore script!}The names of the level one and full backup
  3874. scripts are, respectively, @code{level-1} and @code{level-0}.
  3875. The @code{level-0} script also exists under the name @code{weekly}, and
  3876. the @code{level-1} under the name @code{daily}---these additional names
  3877. can be changed according to your backup schedule. @FIXME-xref{Scripted
  3878. Restoration, for more information on running the restoration script.}
  3879. @FIXME-xref{Scripted Backups, for more information on running the
  3880. backup scripts.}
  3881. @emph{Please Note:} The backup scripts and the restoration scripts are
  3882. designed to be used together. While it is possible to restore files by
  3883. hand from an archive which was created using a backup script, and to create
  3884. an archive by hand which could then be extracted using the restore script,
  3885. it is easier to use the scripts.@FIXME{There is no such restore script!}
  3886. @value{xref-incremental}, and @value{xref-listed-incremental},
  3887. before making such an attempt.
  3888. @FIXME{shorten node names}
  3889. @node Backup Parameters
  3890. @section Setting Parameters for Backups and Restoration
  3891. @UNREVISED
  3892. The file @file{backup-specs} specifies backup parameters for the
  3893. backup and restoration scripts provided with @command{tar}. You must
  3894. edit @file{backup-specs} to fit your system configuration and schedule
  3895. before using these scripts.
  3896. @FIXME{This about backup scripts needs to be written: BS is a shell
  3897. script .... thus ... @file{backup-specs} is in shell script syntax.}
  3898. @FIXME-xref{Script Syntax, for an explanation of this syntax.}
  3899. @FIXME{Whats a parameter .... looked at by the backup scripts
  3900. ... which will be expecting to find ... now syntax ... value is linked
  3901. to lame ... @file{backup-specs} specifies the following parameters:}
  3902. @table @samp
  3903. @item ADMINISTRATOR
  3904. The user name of the backup administrator.
  3905. @item BACKUP_HOUR
  3906. The hour at which the backups are done. This can be a number from 0
  3907. to 23, or the string @samp{now}.
  3908. @item TAPE_FILE
  3909. The device @command{tar} writes the archive to. This device should be
  3910. attached to the host on which the dump scripts are run.
  3911. @FIXME{examples for all ...}
  3912. @item TAPE_STATUS
  3913. The command to use to obtain the status of the archive device,
  3914. including error count. On some tape drives there may not be such a
  3915. command; in that case, simply use @samp{TAPE_STATUS=false}.
  3916. @item BLOCKING
  3917. The blocking factor @command{tar} will use when writing the dump archive.
  3918. @value{xref-blocking-factor}.
  3919. @item BACKUP_DIRS
  3920. A list of file systems to be dumped. You can include any directory
  3921. name in the list---subdirectories on that file system will be
  3922. included, regardless of how they may look to other networked machines.
  3923. Subdirectories on other file systems will be ignored.
  3924. The host name specifies which host to run @command{tar} on, and should
  3925. normally be the host that actually contains the file system. However,
  3926. the host machine must have @sc{gnu} @command{tar} installed, and must be able
  3927. to access the directory containing the backup scripts and their
  3928. support files using the same file name that is used on the machine
  3929. where the scripts are run (ie. what @command{pwd} will print when in that
  3930. directory on that machine). If the host that contains the file system
  3931. does not have this capability, you can specify another host as long as
  3932. it can access the file system through NFS.
  3933. @item BACKUP_FILES
  3934. A list of individual files to be dumped. These should be accessible
  3935. from the machine on which the backup script is run.
  3936. @FIXME{Same file name, be specific. Through NFS ...}
  3937. @end table
  3938. @menu
  3939. * backup-specs example:: An Example Text of @file{Backup-specs}
  3940. * Script Syntax:: Syntax for @file{Backup-specs}
  3941. @end menu
  3942. @node backup-specs example
  3943. @subsection An Example Text of @file{Backup-specs}
  3944. @UNREVISED
  3945. The following is the text of @file{backup-specs} as it appears at FSF:
  3946. @example
  3947. # site-specific parameters for file system backup.
  3948. ADMINISTRATOR=friedman
  3949. BACKUP_HOUR=1
  3950. TAPE_FILE=/dev/nrsmt0
  3951. TAPE_STATUS="mts -t $TAPE_FILE"
  3952. BLOCKING=124
  3953. BACKUP_DIRS="
  3954. albert:/fs/fsf
  3955. apple-gunkies:/gd
  3956. albert:/fs/gd2
  3957. albert:/fs/gp
  3958. geech:/usr/jla
  3959. churchy:/usr/roland
  3960. albert:/
  3961. albert:/usr
  3962. apple-gunkies:/
  3963. apple-gunkies:/usr
  3964. gnu:/hack
  3965. gnu:/u
  3966. apple-gunkies:/com/mailer/gnu
  3967. apple-gunkies:/com/archive/gnu"
  3968. BACKUP_FILES="/com/mailer/aliases /com/mailer/league*[a-z]"
  3969. @end example
  3970. @node Script Syntax
  3971. @subsection Syntax for @file{Backup-specs}
  3972. @UNREVISED
  3973. @file{backup-specs} is in shell script syntax. The following
  3974. conventions should be considered when editing the script:
  3975. @FIXME{"conventions?"}
  3976. A quoted string is considered to be contiguous, even if it is on more
  3977. than one line. Therefore, you cannot include commented-out lines
  3978. within a multi-line quoted string. BACKUP_FILES and BACKUP_DIRS are
  3979. the two most likely parameters to be multi-line.
  3980. A quoted string typically cannot contain wildcards. In
  3981. @file{backup-specs}, however, the parameters BACKUP_DIRS and
  3982. BACKUP_FILES can contain wildcards.
  3983. @node Scripted Backups
  3984. @section Using the Backup Scripts
  3985. @UNREVISED
  3986. The syntax for running a backup script is:
  3987. @example
  3988. @file{script-name} [@var{time-to-be-run}]
  3989. @end example
  3990. where @var{time-to-be-run} can be a specific system time, or can be
  3991. @kbd{now}. If you do not specify a time, the script runs at the time
  3992. specified in @file{backup-specs}. @FIXME-pxref{Script Syntax}
  3993. You should start a script with a tape or disk mounted. Once you
  3994. start a script, it prompts you for new tapes or disks as it
  3995. needs them. Media volumes don't have to correspond to archive
  3996. files---a multi-volume archive can be started in the middle of a
  3997. tape that already contains the end of another multi-volume archive.
  3998. The @code{restore} script prompts for media by its archive volume,
  3999. so to avoid an error message you should keep track of which tape
  4000. (or disk) contains which volume of the archive. @FIXME{There is
  4001. no such restore script!} @FIXME-xref{Scripted Restoration}
  4002. @FIXME{Have file names changed?}
  4003. The backup scripts write two files on the file system. The first is a
  4004. record file in @file{/etc/tar-backup/}, which is used by the scripts
  4005. to store and retrieve information about which files were dumped. This
  4006. file is not meant to be read by humans, and should not be deleted by
  4007. them. @FIXME-xref{incremental and listed-incremental, for a more
  4008. detailed explanation of this file.}
  4009. The second file is a log file containing the names of the file systems
  4010. and files dumped, what time the backup was made, and any error
  4011. messages that were generated, as well as how much space was left in
  4012. the media volume after the last volume of the archive was written.
  4013. You should check this log file after every backup. The file name is
  4014. @file{log-@var{mmm-ddd-yyyy}-level-1} or
  4015. @file{log-@var{mmm-ddd-yyyy}-full}.
  4016. The script also prints the name of each system being dumped to the
  4017. standard output.
  4018. @node Scripted Restoration
  4019. @section Using the Restore Script
  4020. @UNREVISED
  4021. @ifset PUBLISH
  4022. The @command{tar} distribution does not provide restoring scripts.
  4023. @end ifset
  4024. @ifclear PUBLISH
  4025. @quotation
  4026. @strong{Warning:} The @sc{gnu} @command{tar} distribution does @emph{not}
  4027. provide any such @code{restore} script yet. This section is only
  4028. listed here for documentation maintenance purposes. In any case,
  4029. all contents is subject to change as things develop.
  4030. @end quotation
  4031. @FIXME{A section on non-scripted restore may be a good idea.}
  4032. To restore files that were archived using a scripted backup, use the
  4033. @code{restore} script. The syntax for the script is:
  4034. where ***** are the file systems to restore from, and
  4035. ***** is a regular expression which specifies which files to
  4036. restore. If you specify --all, the script restores all the files
  4037. in the file system.
  4038. You should start the restore script with the media containing the
  4039. first volume of the archive mounted. The script will prompt for other
  4040. volumes as they are needed. If the archive is on tape, you don't need
  4041. to rewind the tape to to its beginning---if the tape head is
  4042. positioned past the beginning of the archive, the script will rewind
  4043. the tape as needed. @FIXME-xref{Media, for a discussion of tape
  4044. positioning.}
  4045. If you specify @samp{--all} as the @var{files} argument, the
  4046. @code{restore} script extracts all the files in the archived file
  4047. system into the active file system.
  4048. @quotation
  4049. @strong{Warning:} The script will delete files from the active file
  4050. system if they were not in the file system when the archive was made.
  4051. @end quotation
  4052. @value{xref-incremental}, and @value{ref-listed-incremental},
  4053. for an explanation of how the script makes that determination.
  4054. @FIXME{this may be an option, not a given}
  4055. @end ifclear
  4056. @node Choosing
  4057. @chapter Choosing Files and Names for @command{tar}
  4058. @UNREVISED
  4059. @FIXME{Melissa (still) Doesn't Really Like This ``Intro'' Paragraph!!!}
  4060. Certain options to @command{tar} enable you to specify a name for your
  4061. archive. Other options let you decide which files to include or exclude
  4062. from the archive, based on when or whether files were modified, whether
  4063. the file names do or don't match specified patterns, or whether files
  4064. are in specified directories.
  4065. @menu
  4066. * file:: Choosing the Archive's Name
  4067. * Selecting Archive Members::
  4068. * files:: Reading Names from a File
  4069. * exclude:: Excluding Some Files
  4070. * Wildcards::
  4071. * after:: Operating Only on New Files
  4072. * recurse:: Descending into Directories
  4073. * one:: Crossing Filesystem Boundaries
  4074. @end menu
  4075. @node file
  4076. @section Choosing and Naming Archive Files
  4077. @cindex Naming an archive
  4078. @cindex Archive Name
  4079. @cindex Directing output
  4080. @cindex Choosing an archive file
  4081. @cindex Where is the archive?
  4082. @UNREVISED
  4083. @FIXME{should the title of this section actually be, "naming an
  4084. archive"?}
  4085. By default, @command{tar} uses an archive file name that was compiled when
  4086. it was built on the system; usually this name refers to some physical
  4087. tape drive on the machine. However, the person who installed @command{tar}
  4088. on the system may not set the default to a meaningful value as far as
  4089. most users are concerned. As a result, you will usually want to tell
  4090. @command{tar} where to find (or create) the archive. The @value{op-file}
  4091. option allows you to either specify or name a file to use as the archive
  4092. instead of the default archive file location.
  4093. @table @kbd
  4094. @item --file=@var{archive-name}
  4095. @itemx -f @var{archive-name}
  4096. Name the archive to create or operate on. Use in conjunction with
  4097. any operation.
  4098. @end table
  4099. For example, in this @command{tar} command,
  4100. @example
  4101. $ @kbd{tar -cvf collection.tar blues folk jazz}
  4102. @end example
  4103. @noindent
  4104. @file{collection.tar} is the name of the archive. It must directly
  4105. follow the @samp{-f} option, since whatever directly follows @samp{-f}
  4106. @emph{will} end up naming the archive. If you neglect to specify an
  4107. archive name, you may end up overwriting a file in the working directory
  4108. with the archive you create since @command{tar} will use this file's name
  4109. for the archive name.
  4110. An archive can be saved as a file in the file system, sent through a
  4111. pipe or over a network, or written to an I/O device such as a tape,
  4112. floppy disk, or CD write drive.
  4113. @cindex Writing new archives
  4114. @cindex Archive creation
  4115. If you do not name the archive, @command{tar} uses the value of the
  4116. environment variable @env{TAPE} as the file name for the archive. If
  4117. that is not available, @command{tar} uses a default, compiled-in archive
  4118. name, usually that for tape unit zero (ie. @file{/dev/tu00}).
  4119. @command{tar} always needs an archive name.
  4120. If you use @file{-} as an @var{archive-name}, @command{tar} reads the
  4121. archive from standard input (when listing or extracting files), or
  4122. writes it to standard output (when creating an archive). If you use
  4123. @file{-} as an @var{archive-name} when modifying an archive,
  4124. @command{tar} reads the original archive from its standard input and
  4125. writes the entire new archive to its standard output.
  4126. @FIXME{might want a different example here; this is already used in
  4127. "notable tar usages".}
  4128. @example
  4129. $ @kbd{cd sourcedir; tar -cf - . | (cd targetdir; tar -xf -)}
  4130. @end example
  4131. @FIXME{help!}
  4132. @cindex Standard input and output
  4133. @cindex tar to standard input and output
  4134. To specify an archive file on a device attached to a remote machine,
  4135. use the following:
  4136. @example
  4137. @kbd{--file=@var{hostname}:/@var{dev}/@var{file name}}
  4138. @end example
  4139. @noindent
  4140. @command{tar} will complete the remote connection, if possible, and
  4141. prompt you for a username and password. If you use
  4142. @samp{--file=@@@var{hostname}:/@var{dev}/@var{file name}}, @command{tar}
  4143. will complete the remote connection, if possible, using your username
  4144. as the username on the remote machine.
  4145. If the archive file name includes a colon (@samp{:}), then it is assumed
  4146. to be a file on another machine. If the archive file is
  4147. @samp{@var{user}@@@var{host}:@var{file}}, then @var{file} is used on the
  4148. host @var{host}. The remote host is accessed using the @command{rsh}
  4149. program, with a username of @var{user}. If the username is omitted
  4150. (along with the @samp{@@} sign), then your user name will be used.
  4151. (This is the normal @command{rsh} behavior.) It is necessary for the
  4152. remote machine, in addition to permitting your @command{rsh} access, to
  4153. have the @file{/usr/ucb/rmt} program installed. If you need to use a
  4154. file whose name includes a colon, then the remote tape drive behavior
  4155. can be inhibited by using the @value{op-force-local} option.
  4156. @FIXME{i know we went over this yesterday, but bob (and now i do again,
  4157. too) thinks it's out of the middle of nowhere. it doesn't seem to tie
  4158. into what came before it well enough <<i moved it now, is it better
  4159. here?>>. bob also comments that if Amanda isn't free software, we
  4160. shouldn't mention it..}
  4161. When the archive is being created to @file{/dev/null}, @sc{gnu} @command{tar}
  4162. tries to minimize input and output operations. The Amanda backup
  4163. system, when used with @sc{gnu} @command{tar}, has an initial sizing pass which
  4164. uses this feature.
  4165. @node Selecting Archive Members
  4166. @section Selecting Archive Members
  4167. @cindex Specifying files to act on
  4168. @cindex Specifying archive members
  4169. @dfn{File Name arguments} specify which files in the file system
  4170. @command{tar} operates on, when creating or adding to an archive, or which
  4171. archive members @command{tar} operates on, when reading or deleting from
  4172. an archive. @xref{Operations}.
  4173. To specify file names, you can include them as the last arguments on
  4174. the command line, as follows:
  4175. @smallexample
  4176. @kbd{tar} @var{operation} [@var{option1} @var{option2} @dots{}] [@var{file name-1} @var{file name-2} @dots{}]
  4177. @end smallexample
  4178. If you specify a directory name as a file name argument, all the files
  4179. in that directory are operated on by @command{tar}.
  4180. If you do not specify files when @command{tar} is invoked with
  4181. @value{op-create}, @command{tar} operates on all the non-directory files in
  4182. the working directory. If you specify either @value{op-list} or
  4183. @value{op-extract}, @command{tar} operates on all the archive members in the
  4184. archive. If you specify any operation other than one of these three,
  4185. @command{tar} does nothing.
  4186. By default, @command{tar} takes file names from the command line. However,
  4187. there are other ways to specify file or member names, or to modify the
  4188. manner in which @command{tar} selects the files or members upon which to
  4189. operate. @FIXME{add xref here}In general, these methods work both for
  4190. specifying the names of files and archive members.
  4191. @node files
  4192. @section Reading Names from a File
  4193. @UNREVISED
  4194. @cindex Reading file names from a file
  4195. @cindex Lists of file names
  4196. @cindex File Name arguments, alternatives
  4197. Instead of giving the names of files or archive members on the command
  4198. line, you can put the names into a file, and then use the
  4199. @value{op-files-from} option to @command{tar}. Give the name of the file
  4200. which contains the list of files to include as the argument to
  4201. @samp{--files-from}. In the list, the file names should be separated by
  4202. newlines. You will frequently use this option when you have generated
  4203. the list of files to archive with the @command{find} utility.
  4204. @table @kbd
  4205. @item --files-from=@var{file name}
  4206. @itemx -T @var{file name}
  4207. Get names to extract or create from file @var{file name}.
  4208. @end table
  4209. If you give a single dash as a file name for @samp{--files-from}, (i.e.,
  4210. you specify either @samp{--files-from=-} or @samp{-T -}), then the file
  4211. names are read from standard input.
  4212. Unless you are running @command{tar} with @samp{--create}, you can not use
  4213. both @samp{--files-from=-} and @samp{--file=-} (@samp{-f -}) in the same
  4214. command.
  4215. @FIXME{add bob's example, from his message on 2-10-97}
  4216. The following example shows how to use @command{find} to generate a list of
  4217. files smaller than 400K in length and put that list into a file
  4218. called @file{small-files}. You can then use the @samp{-T} option to
  4219. @command{tar} to specify the files from that file, @file{small-files}, to
  4220. create the archive @file{little.tgz}. (The @samp{-z} option to
  4221. @command{tar} compresses the archive with @command{gzip}; @pxref{gzip} for
  4222. more information.)
  4223. @example
  4224. $ @kbd{find . -size -400 -print > small-files}
  4225. $ @kbd{tar -c -v -z -T small-files -f little.tgz}
  4226. @end example
  4227. @noindent
  4228. @FIXME{say more here to conclude the example/section?}
  4229. @menu
  4230. * nul::
  4231. @end menu
  4232. @node nul
  4233. @subsection @kbd{NUL} Terminated File Names
  4234. @cindex File names, terminated by @kbd{NUL}
  4235. @cindex @kbd{NUL} terminated file names
  4236. The @value{op-null} option causes @value{op-files-from} to read file
  4237. names terminated by a @code{NUL} instead of a newline, so files whose
  4238. names contain newlines can be archived using @samp{--files-from}.
  4239. @table @kbd
  4240. @item --null
  4241. Only consider @kbd{NUL} terminated file names, instead of files that
  4242. terminate in a newline.
  4243. @end table
  4244. The @samp{--null} option is just like the one in @sc{gnu} @command{xargs} and
  4245. @command{cpio}, and is useful with the @samp{-print0} predicate of @sc{gnu}
  4246. @command{find}. In @command{tar}, @samp{--null} also causes
  4247. @value{op-directory} options to be treated as file names to archive, in
  4248. case there are any files out there called @file{-C}.
  4249. This example shows how to use @command{find} to generate a list of files
  4250. larger than 800K in length and put that list into a file called
  4251. @file{long-files}. The @samp{-print0} option to @command{find} just just
  4252. like @samp{-print}, except that it separates files with a @kbd{NUL}
  4253. rather than with a newline. You can then run @command{tar} with both the
  4254. @samp{--null} and @samp{-T} options to specify that @command{tar} get the
  4255. files from that file, @file{long-files}, to create the archive
  4256. @file{big.tgz}. The @samp{--null} option to @command{tar} will cause
  4257. @command{tar} to recognize the @kbd{NUL} separator between files.
  4258. @example
  4259. $ @kbd{find . -size +800 -print0 > long-files}
  4260. $ @kbd{tar -c -v --null --files-from=long-files --file=big.tar}
  4261. @end example
  4262. @FIXME{say anything else here to conclude the section?}
  4263. @node exclude
  4264. @section Excluding Some Files
  4265. @cindex File names, excluding files by
  4266. @cindex Excluding files by name and pattern
  4267. @cindex Excluding files by file system
  4268. @UNREVISED
  4269. To avoid operating on files whose names match a particular pattern,
  4270. use the @value{op-exclude} or @value{op-exclude-from} options.
  4271. @table @kbd
  4272. @item --exclude=@var{pattern}
  4273. Causes @command{tar} to ignore files that match the @var{pattern}.
  4274. @end table
  4275. @findex exclude
  4276. The @value{op-exclude} option prevents any file or member whose name
  4277. matches the shell wildcard (@var{pattern}) from being operated on.
  4278. For example, to create an archive with all the contents of the directory
  4279. @file{src} except for files whose names end in @file{.o}, use the
  4280. command @samp{tar -cf src.tar --exclude='*.o' src}.
  4281. You may give multiple @samp{--exclude} options.
  4282. @table @kbd
  4283. @item --exclude-from=@var{file}
  4284. @itemx -X @var{file}
  4285. Causes @command{tar} to ignore files that match the patterns listed in
  4286. @var{file}.
  4287. @end table
  4288. @findex exclude-from
  4289. Use the @samp{--exclude-from=@var{file-of-patterns}} option to read a
  4290. list of patterns, one per line, from @var{file}; @command{tar} will
  4291. ignore files matching those patterns. Thus if @command{tar} is
  4292. called as @w{@samp{tar -c -X foo .}} and the file @file{foo} contains a
  4293. single line @file{*.o}, no files whose names end in @file{.o} will be
  4294. added to the archive.
  4295. @FIXME{do the exclude options files need to have stuff separated by
  4296. newlines the same as the files-from option does?}
  4297. @menu
  4298. * controlling pattern-patching with exclude::
  4299. * problems with exclude::
  4300. @end menu
  4301. @node controlling pattern-patching with exclude
  4302. @unnumberedsubsec Controlling Pattern-Matching with the @code{exclude} Options
  4303. Normally, a pattern matches a name if an initial subsequence of the
  4304. name's components matches the pattern, where @samp{*}, @samp{?}, and
  4305. @samp{[...]} are the usual shell wildcards, @samp{\} escapes wildcards,
  4306. and wildcards can match @samp{/}.
  4307. Other than optionally stripping leading @samp{/} from names
  4308. (@pxref{absolute}), patterns and names are used as-is. For
  4309. example, trailing @samp{/} is not trimmed from a user-specified name
  4310. before deciding whether to exclude it.
  4311. However, this matching procedure can be altered by the options listed
  4312. below. These options accumulate. For example:
  4313. @example
  4314. --ignore-case --exclude='makefile' --no-ignore-case ---exclude='readme'
  4315. @end example
  4316. ignores case when excluding @samp{makefile}, but not when excluding
  4317. @samp{readme}.
  4318. @table @option
  4319. @item --anchored
  4320. @itemx --no-anchored
  4321. If anchored (the default), a pattern must match an initial subsequence
  4322. of the name's components. Otherwise, the pattern can match any subsequence.
  4323. @item --ignore-case
  4324. @itemx --no-ignore-case
  4325. When ignoring case, upper-case patterns match lower-case names and vice versa.
  4326. When not ignoring case (the default), matching is case-sensitive.
  4327. @item --wildcards
  4328. @itemx --no-wildcards
  4329. When using wildcards (the default), @samp{*}, @samp{?}, and @samp{[...]}
  4330. are the usual shell wildcards, and @samp{\} escapes wildcards.
  4331. Otherwise, none of these characters are special, and patterns must match
  4332. names literally.
  4333. @item --wildcards-match-slash
  4334. @itemx --no-wildcards-match-slash
  4335. When wildcards match slash (the default), a wildcard like @samp{*} in
  4336. the pattern can match a @samp{/} in the name. Otherwise, @samp{/} is
  4337. matched only by @samp{/}.
  4338. @end table
  4339. The @option{--recursion} and @option{--no-recursion} options
  4340. (@pxref{recurse}) also affect how exclude patterns are interpreted. If
  4341. recursion is in effect, a pattern excludes a name if it matches any of
  4342. the name's parent directories.
  4343. @node problems with exclude
  4344. @unnumberedsubsec Problems with Using the @code{exclude} Options
  4345. Some users find @samp{exclude} options confusing. Here are some common
  4346. pitfalls:
  4347. @itemize @bullet
  4348. @item
  4349. The main operating mode of @command{tar} does not act on a path name
  4350. explicitly listed on the command line if one of its file name
  4351. components is excluded. In the example above, if
  4352. you create an archive and exclude files that end with @samp{*.o}, but
  4353. explicitly name the file @samp{dir.o/foo} after all the options have been
  4354. listed, @samp{dir.o/foo} will be excluded from the archive.
  4355. @item
  4356. You can sometimes confuse the meanings of @value{op-exclude} and
  4357. @value{op-exclude-from}. Be careful: use @value{op-exclude} when files
  4358. to be excluded are given as a pattern on the command line. Use
  4359. @samp{--exclude-from=@var{file-of-patterns}} to introduce the name of a
  4360. file which contains a list of patterns, one per line; each of these
  4361. patterns can exclude zero, one, or many files.
  4362. @item
  4363. When you use @value{op-exclude}, be sure to quote the @var{pattern}
  4364. parameter, so @sc{gnu} @command{tar} sees wildcard characters like @samp{*}.
  4365. If you do not do this, the shell might expand the @samp{*} itself
  4366. using files at hand, so @command{tar} might receive a list of files
  4367. instead of one pattern, or none at all, making the command somewhat
  4368. illegal. This might not correspond to what you want.
  4369. For example, write:
  4370. @example
  4371. $ @kbd{tar -c -f @var{archive.tar} --exclude '*.o' @var{directory}}
  4372. @end example
  4373. @noindent
  4374. rather than:
  4375. @example
  4376. $ @kbd{tar -c -f @var{archive.tar} --exclude *.o @var{directory}}
  4377. @end example
  4378. @item
  4379. You must use use shell syntax, or globbing, rather than @code{regexp}
  4380. syntax, when using exclude options in @command{tar}. If you try to use
  4381. @code{regexp} syntax to describe files to be excluded, your command
  4382. might fail.
  4383. @item
  4384. In earlier versions of @command{tar}, what is now the
  4385. @samp{--exclude-from=@var{file-of-patterns}} option was called
  4386. @samp{--exclude=@var{pattern}} instead. Now,
  4387. @samp{--exclude=@var{pattern}} applies to patterns listed on the command
  4388. line and @samp{--exclude-from=@var{file-of-patterns}} applies to
  4389. patterns listed in a file.
  4390. @end itemize
  4391. @node Wildcards
  4392. @section Wildcards Patterns and Matching
  4393. @dfn{Globbing} is the operation by which @dfn{wildcard} characters,
  4394. @samp{*} or @samp{?} for example, are replaced and expanded into all
  4395. existing files matching the given pattern. However, @command{tar} often
  4396. uses wildcard patterns for matching (or globbing) archive members instead
  4397. of actual files in the filesystem. Wildcard patterns are also used for
  4398. verifying volume labels of @command{tar} archives. This section has the
  4399. purpose of explaining wildcard syntax for @command{tar}.
  4400. @FIXME{the next few paragraphs need work.}
  4401. A @var{pattern} should be written according to shell syntax, using wildcard
  4402. characters to effect globbing. Most characters in the pattern stand
  4403. for themselves in the matched string, and case is significant: @samp{a}
  4404. will match only @samp{a}, and not @samp{A}. The character @samp{?} in the
  4405. pattern matches any single character in the matched string. The character
  4406. @samp{*} in the pattern matches zero, one, or more single characters in
  4407. the matched string. The character @samp{\} says to take the following
  4408. character of the pattern @emph{literally}; it is useful when one needs to
  4409. match the @samp{?}, @samp{*}, @samp{[} or @samp{\} characters, themselves.
  4410. The character @samp{[}, up to the matching @samp{]}, introduces a character
  4411. class. A @dfn{character class} is a list of acceptable characters
  4412. for the next single character of the matched string. For example,
  4413. @samp{[abcde]} would match any of the first five letters of the alphabet.
  4414. Note that within a character class, all of the ``special characters''
  4415. listed above other than @samp{\} lose their special meaning; for example,
  4416. @samp{[-\\[*?]]} would match any of the characters, @samp{-}, @samp{\},
  4417. @samp{[}, @samp{*}, @samp{?}, or @samp{]}. (Due to parsing constraints,
  4418. the characters @samp{-} and @samp{]} must either come @emph{first} or
  4419. @emph{last} in a character class.)
  4420. @cindex Excluding characters from a character class
  4421. @cindex Character class, excluding characters from
  4422. If the first character of the class after the opening @samp{[}
  4423. is @samp{!} or @samp{^}, then the meaning of the class is reversed.
  4424. Rather than listing character to match, it lists those characters which
  4425. are @emph{forbidden} as the next single character of the matched string.
  4426. Other characters of the class stand for themselves. The special
  4427. construction @samp{[@var{a}-@var{e}]}, using an hyphen between two
  4428. letters, is meant to represent all characters between @var{a} and
  4429. @var{e}, inclusive.
  4430. @FIXME{need to add a sentence or so here to make this clear for those
  4431. who don't have dan around.}
  4432. Periods (@samp{.}) or forward slashes (@samp{/}) are not considered
  4433. special for wildcard matches. However, if a pattern completely matches
  4434. a directory prefix of a matched string, then it matches the full matched
  4435. string: excluding a directory also excludes all the files beneath it.
  4436. There are some discussions floating in the air and asking for modifications
  4437. in the way @sc{gnu} @command{tar} accomplishes wildcard matches. We perceive
  4438. any change of semantics in this area as a delicate thing to impose on
  4439. @sc{gnu} @command{tar} users. On the other hand, the @sc{gnu} project should be
  4440. progressive enough to correct any ill design: compatibility at all price
  4441. is not always a good attitude. In conclusion, it is @emph{possible}
  4442. that slight amendments be later brought to the previous description.
  4443. Your opinions on the matter are welcome.
  4444. @node after
  4445. @section Operating Only on New Files
  4446. @cindex Excluding file by age
  4447. @cindex Modification time, excluding files by
  4448. @cindex Age, excluding files by
  4449. @UNREVISED
  4450. The @value{op-after-date} option causes @command{tar} to only work on files
  4451. whose modification or inode-changed times are newer than the @var{date}
  4452. given. If @var{date} starts with @samp{/} or @samp{.}, it is taken to
  4453. be a file name; the last-modified time of that file is used as the date.
  4454. If you use this option when creating or appending to an archive,
  4455. the archive will only include new files. If you use @samp{--after-date}
  4456. when extracting an archive, @command{tar} will only extract files newer
  4457. than the @var{date} you specify.
  4458. If you only want @command{tar} to make the date comparison based on
  4459. modification of the actual contents of the file (rather than inode
  4460. changes), then use the @value{op-newer-mtime} option.
  4461. You may use these options with any operation. Note that these options
  4462. differ from the @value{op-update} operation in that they allow you to
  4463. specify a particular date against which @command{tar} can compare when
  4464. deciding whether or not to archive the files.
  4465. @table @kbd
  4466. @item --after-date=@var{date}
  4467. @itemx --newer=@var{date}
  4468. @itemx -N @var{date}
  4469. Only store files newer than @var{date}.
  4470. Acts on files only if their modification or inode-changed times are
  4471. later than @var{date}. Use in conjunction with any operation.
  4472. If @var{date} starts with @samp{/} or @samp{.}, it is taken to be a file
  4473. name; the last-modified time of that file is used as the date.
  4474. @item --newer-mtime=@var{date}
  4475. Acts like @value{op-after-date}, but only looks at modification times.
  4476. @end table
  4477. These options limit @command{tar} to only operating on files which have
  4478. been modified after the date specified. A file is considered to have
  4479. changed if the contents have been modified, or if the owner,
  4480. permissions, and so forth, have been changed. (For more information on
  4481. how to specify a date, see @ref{Date input formats}; remember that the
  4482. entire date argument must be quoted if it contains any spaces.)
  4483. Gurus would say that @value{op-after-date} tests both the @code{mtime}
  4484. (time the contents of the file were last modified) and @code{ctime}
  4485. (time the file's status was last changed: owner, permissions, etc)
  4486. fields, while @value{op-newer-mtime} tests only @code{mtime} field.
  4487. To be precise, @value{op-after-date} checks @emph{both} @code{mtime} and
  4488. @code{ctime} and processes the file if either one is more recent than
  4489. @var{date}, while @value{op-newer-mtime} only checks @code{mtime} and
  4490. disregards @code{ctime}. Neither uses @code{atime} (the last time the
  4491. contents of the file were looked at).
  4492. Date specifiers can have embedded spaces. Because of this, you may need
  4493. to quote date arguments to keep the shell from parsing them as separate
  4494. arguments.
  4495. @FIXME{Need example of --newer-mtime with quoted argument.}
  4496. @quotation
  4497. @strong{Please Note:} @value{op-after-date} and @value{op-newer-mtime}
  4498. should not be used for incremental backups. Some files (such as those
  4499. in renamed directories) are not selected properly by these options.
  4500. @xref{incremental and listed-incremental}.
  4501. @end quotation
  4502. @noindent
  4503. @FIXME{which tells -- need to fill this in!}
  4504. @node recurse
  4505. @section Descending into Directories
  4506. @cindex Avoiding recursion in directories
  4507. @cindex Descending directories, avoiding
  4508. @cindex Directories, avoiding recursion
  4509. @cindex Recursion in directories, avoiding
  4510. @UNREVISED
  4511. @FIXME{arrggh! this is still somewhat confusing to me. :-< }
  4512. @FIXME{show dan bob's comments, from 2-10-97}
  4513. Usually, @command{tar} will recursively explore all directories (either
  4514. those given on the command line or through the @value{op-files-from}
  4515. option) for the various files they contain. However, you may not always
  4516. want @command{tar} to act this way.
  4517. The @value{op-no-recursion} option inhibits @command{tar}'s recursive descent
  4518. into specified directories. If you specify @samp{--no-recursion}, you can
  4519. use the @command{find} utility for hunting through levels of directories to
  4520. construct a list of file names which you could then pass to @command{tar}.
  4521. @command{find} allows you to be more selective when choosing which files to
  4522. archive; see @ref{files} for more information on using @command{find} with
  4523. @command{tar}, or look.
  4524. @table @kbd
  4525. @item --no-recursion
  4526. Prevents @command{tar} from recursively descending directories.
  4527. @item --recursion
  4528. Requires @command{tar} to recursively descend directories.
  4529. This is the default.
  4530. @end table
  4531. When you use @samp{--no-recursion}, @sc{gnu} @command{tar} grabs directory entries
  4532. themselves, but does not descend on them recursively. Many people use
  4533. @command{find} for locating files they want to back up, and since
  4534. @command{tar} @emph{usually} recursively descends on directories, they have
  4535. to use the @samp{@w{! -d}} option to @command{find} @FIXME{needs more
  4536. explanation or a cite to another info file}as they usually do not want
  4537. all the files in a directory. They then use the @value{op-files-from}
  4538. option to archive the files located via @command{find}.
  4539. The problem when restoring files archived in this manner is that the
  4540. directories themselves are not in the archive; so the
  4541. @value{op-same-permissions} option does not affect them---while users
  4542. might really like it to. Specifying @value{op-no-recursion} is a way to
  4543. tell @command{tar} to grab only the directory entries given to it, adding
  4544. no new files on its own.
  4545. The @value{op-no-recursion} option also applies when extracting: it
  4546. causes @command{tar} to extract only the matched directory entries, not
  4547. the files under those directories.
  4548. The @value{op-no-recursion} option also affects how exclude patterns
  4549. are interpreted (@pxref{controlling pattern-patching with exclude}).
  4550. @FIXME{example here}
  4551. @node one
  4552. @section Crossing Filesystem Boundaries
  4553. @cindex File system boundaries, not crossing
  4554. @UNREVISED
  4555. @command{tar} will normally automatically cross file system boundaries in
  4556. order to archive files which are part of a directory tree. You can
  4557. change this behavior by running @command{tar} and specifying
  4558. @value{op-one-file-system}. This option only affects files that are
  4559. archived because they are in a directory that is being archived;
  4560. @command{tar} will still archive files explicitly named on the command line
  4561. or through @value{op-files-from}, regardless of where they reside.
  4562. @table @kbd
  4563. @item --one-file-system
  4564. @itemx -l
  4565. Prevents @command{tar} from crossing file system boundaries when
  4566. archiving. Use in conjunction with any write operation.
  4567. @end table
  4568. The @samp{--one-file-system} option causes @command{tar} to modify its
  4569. normal behavior in archiving the contents of directories. If a file in
  4570. a directory is not on the same filesystem as the directory itself, then
  4571. @command{tar} will not archive that file. If the file is a directory
  4572. itself, @command{tar} will not archive anything beneath it; in other words,
  4573. @command{tar} will not cross mount points.
  4574. It is reported that using this option, the mount point is is archived,
  4575. but nothing under it.
  4576. This option is useful for making full or incremental archival backups of
  4577. a file system. If this option is used in conjunction with
  4578. @value{op-verbose}, files that are excluded are mentioned by name on the
  4579. standard error.
  4580. @menu
  4581. * directory:: Changing Directory
  4582. * absolute:: Absolute File Names
  4583. @end menu
  4584. @node directory
  4585. @subsection Changing the Working Directory
  4586. @FIXME{need to read over this node now for continuity; i've switched
  4587. things around some.}
  4588. @cindex Changing directory mid-stream
  4589. @cindex Directory, changing mid-stream
  4590. @cindex Working directory, specifying
  4591. @UNREVISED
  4592. To change the working directory in the middle of a list of file names,
  4593. either on the command line or in a file specified using
  4594. @value{op-files-from}, use @value{op-directory}. This will change the
  4595. working directory to the directory @var{directory} after that point in
  4596. the list.
  4597. @table @kbd
  4598. @item --directory=@var{directory}
  4599. @itemx -C @var{directory}
  4600. Changes the working directory in the middle of a command line.
  4601. @end table
  4602. For example,
  4603. @example
  4604. $ @kbd{tar -c -f jams.tar grape prune -C food cherry}
  4605. @end example
  4606. @noindent
  4607. will place the files @file{grape} and @file{prune} from the current
  4608. directory into the archive @file{jams.tar}, followed by the file
  4609. @file{cherry} from the directory @file{food}. This option is especially
  4610. useful when you have several widely separated files that you want to
  4611. store in the same archive.
  4612. Note that the file @file{cherry} is recorded in the archive under the
  4613. precise name @file{cherry}, @emph{not} @file{food/cherry}. Thus, the
  4614. archive will contain three files that all appear to have come from the
  4615. same directory; if the archive is extracted with plain @samp{tar
  4616. --extract}, all three files will be written in the current directory.
  4617. Contrast this with the command,
  4618. @example
  4619. $ @kbd{tar -c -f jams.tar grape prune -C food red/cherry}
  4620. @end example
  4621. @noindent
  4622. which records the third file in the archive under the name
  4623. @file{red/cherry} so that, if the archive is extracted using
  4624. @samp{tar --extract}, the third file will be written in a subdirectory
  4625. named @file{orange-colored}.
  4626. You can use the @samp{--directory} option to make the archive
  4627. independent of the original name of the directory holding the files.
  4628. The following command places the files @file{/etc/passwd},
  4629. @file{/etc/hosts}, and @file{/lib/libc.a} into the archive
  4630. @file{foo.tar}:
  4631. @example
  4632. $ @kbd{tar -c -f foo.tar -C /etc passwd hosts -C /lib libc.a}
  4633. @end example
  4634. @noindent
  4635. However, the names of the archive members will be exactly what they were
  4636. on the command line: @file{passwd}, @file{hosts}, and @file{libc.a}.
  4637. They will not appear to be related by file name to the original
  4638. directories where those files were located.
  4639. Note that @samp{--directory} options are interpreted consecutively. If
  4640. @samp{--directory} specifies a relative file name, it is interpreted
  4641. relative to the then current directory, which might not be the same as
  4642. the original current working directory of @command{tar}, due to a previous
  4643. @samp{--directory} option.
  4644. @FIXME{dan: does this mean that you *can* use the short option form, but
  4645. you can *not* use the long option form with --files-from? or is this
  4646. totally screwed?}
  4647. When using @samp{--files-from} (@pxref{files}), you can put @samp{-C}
  4648. options in the file list. Unfortunately, you cannot put
  4649. @samp{--directory} options in the file list. (This interpretation can
  4650. be disabled by using the @value{op-null} option.)
  4651. @node absolute
  4652. @subsection Absolute File Names
  4653. @UNREVISED
  4654. @table @kbd
  4655. @item -P
  4656. @itemx --absolute-names
  4657. Do not strip leading slashes from file names, and permit file names
  4658. containing a @file{..} file name component.
  4659. @end table
  4660. By default, @sc{gnu} @command{tar} drops a leading @samp{/} on input or output,
  4661. and complains about file names containing a @file{..} component.
  4662. This option turns off this behavior.
  4663. When @command{tar} extracts archive members from an archive, it strips any
  4664. leading slashes (@samp{/}) from the member name. This causes absolute
  4665. member names in the archive to be treated as relative file names. This
  4666. allows you to have such members extracted wherever you want, instead of
  4667. being restricted to extracting the member in the exact directory named
  4668. in the archive. For example, if the archive member has the name
  4669. @file{/etc/passwd}, @command{tar} will extract it as if the name were
  4670. really @file{etc/passwd}.
  4671. File names containing @file{..} can cause problems when extracting, so
  4672. @command{tar} normally warns you about such files when creating an
  4673. archive, and rejects attempts to extracts such files.
  4674. Other @command{tar} programs do not do this. As a result, if you create an
  4675. archive whose member names start with a slash, they will be difficult
  4676. for other people with a non-@sc{gnu} @command{tar} program to use. Therefore,
  4677. @sc{gnu} @command{tar} also strips leading slashes from member names when
  4678. putting members into the archive. For example, if you ask @command{tar} to
  4679. add the file @file{/bin/ls} to an archive, it will do so, but the member
  4680. name will be @file{bin/ls}.
  4681. If you use the @value{op-absolute-names} option, @command{tar} will do
  4682. none of these transformations.
  4683. To archive or extract files relative to the root directory, specify
  4684. the @value{op-absolute-names} option.
  4685. Normally, @command{tar} acts on files relative to the working
  4686. directory---ignoring superior directory names when archiving, and
  4687. ignoring leading slashes when extracting.
  4688. When you specify @value{op-absolute-names}, @command{tar} stores file names
  4689. including all superior directory names, and preserves leading slashes.
  4690. If you only invoked @command{tar} from the root directory you would never
  4691. need the @value{op-absolute-names} option, but using this option may be
  4692. more convenient than switching to root.
  4693. @FIXME{Should be an example in the tutorial/wizardry section using this
  4694. to transfer files between systems.}
  4695. @FIXME{Is write access an issue?}
  4696. @table @kbd
  4697. @item --absolute-names
  4698. Preserves full file names (including superior directory names) when
  4699. archiving files. Preserves leading slash when extracting files.
  4700. @end table
  4701. @FIXME{this is still horrible; need to talk with dan on monday.}
  4702. @command{tar} prints out a message about removing the @samp{/} from file
  4703. names. This message appears once per @sc{gnu} @command{tar} invocation. It
  4704. represents something which ought to be told; ignoring what it means can
  4705. cause very serious surprises, later.
  4706. Some people, nevertheless, do not want to see this message. Wanting to
  4707. play really dangerously, one may of course redirect @command{tar} standard
  4708. error to the sink. For example, under @command{sh}:
  4709. @example
  4710. $ @kbd{tar -c -f archive.tar /home 2> /dev/null}
  4711. @end example
  4712. @noindent
  4713. Another solution, both nicer and simpler, would be to change to
  4714. the @file{/} directory first, and then avoid absolute notation.
  4715. For example:
  4716. @example
  4717. $ @kbd{(cd / && tar -c -f archive.tar home)}
  4718. $ @kbd{tar -c -f archive.tar -C / home}
  4719. @end example
  4720. @include getdate.texi
  4721. @node Formats
  4722. @chapter Controlling the Archive Format
  4723. @FIXME{need an intro here}
  4724. @menu
  4725. * Portability:: Making @command{tar} Archives More Portable
  4726. * Compression:: Using Less Space through Compression
  4727. * Attributes:: Handling File Attributes
  4728. * Standard:: The Standard Format
  4729. * Extensions:: @sc{gnu} Extensions to the Archive Format
  4730. * cpio:: Comparison of @command{tar} and @command{cpio}
  4731. @end menu
  4732. @node Portability
  4733. @section Making @command{tar} Archives More Portable
  4734. Creating a @command{tar} archive on a particular system that is meant to be
  4735. useful later on many other machines and with other versions of @command{tar}
  4736. is more challenging than you might think. @command{tar} archive formats
  4737. have been evolving since the first versions of Unix. Many such formats
  4738. are around, and are not always compatible with each other. This section
  4739. discusses a few problems, and gives some advice about making @command{tar}
  4740. archives more portable.
  4741. One golden rule is simplicity. For example, limit your @command{tar}
  4742. archives to contain only regular files and directories, avoiding
  4743. other kind of special files. Do not attempt to save sparse files or
  4744. contiguous files as such. Let's discuss a few more problems, in turn.
  4745. @menu
  4746. * Portable Names:: Portable Names
  4747. * dereference:: Symbolic Links
  4748. * old:: Old V7 Archives
  4749. * posix:: @sc{posix} archives
  4750. * Checksumming:: Checksumming Problems
  4751. * Large or Negative Values:: Large files, negative time stamps, etc.
  4752. @end menu
  4753. @node Portable Names
  4754. @subsection Portable Names
  4755. Use portable file and member names. A name is portable if it contains
  4756. only ASCII letters and digits, @samp{/}, @samp{.}, @samp{_}, and
  4757. @samp{-}; it cannot be empty, start with @samp{-} or @samp{//}, or
  4758. contain @samp{/-}. Avoid deep directory nesting. For portability to
  4759. old Unix hosts, limit your file name components to 14 characters or
  4760. less.
  4761. If you intend to have your @command{tar} archives to be read under MSDOS,
  4762. you should not rely on case distinction for file names, and you might
  4763. use the @sc{gnu} @command{doschk} program for helping you further diagnosing
  4764. illegal MSDOS names, which are even more limited than System V's.
  4765. @node dereference
  4766. @subsection Symbolic Links
  4767. @cindex File names, using symbolic links
  4768. @cindex Symbolic link as file name
  4769. Normally, when @command{tar} archives a symbolic link, it writes a
  4770. block to the archive naming the target of the link. In that way, the
  4771. @command{tar} archive is a faithful record of the filesystem contents.
  4772. @value{op-dereference} is used with @value{op-create}, and causes @command{tar}
  4773. to archive the files symbolic links point to, instead of the links
  4774. themselves. When this option is used, when @command{tar} encounters a
  4775. symbolic link, it will archive the linked-to file, instead of simply
  4776. recording the presence of a symbolic link.
  4777. The name under which the file is stored in the file system is not
  4778. recorded in the archive. To record both the symbolic link name and
  4779. the file name in the system, archive the file under both names. If
  4780. all links were recorded automatically by @command{tar}, an extracted file
  4781. might be linked to a file name that no longer exists in the file
  4782. system.
  4783. If a linked-to file is encountered again by @command{tar} while creating
  4784. the same archive, an entire second copy of it will be stored. (This
  4785. @emph{might} be considered a bug.)
  4786. So, for portable archives, do not archive symbolic links as such,
  4787. and use @value{op-dereference}: many systems do not support
  4788. symbolic links, and moreover, your distribution might be unusable if
  4789. it contains unresolved symbolic links.
  4790. @node old
  4791. @subsection Old V7 Archives
  4792. @cindex Format, old style
  4793. @cindex Old style format
  4794. @cindex Old style archives
  4795. Certain old versions of @command{tar} cannot handle additional
  4796. information recorded by newer @command{tar} programs. To create an
  4797. archive in V7 format (not ANSI), which can be read by these old
  4798. versions, specify the @value{op-old-archive} option in
  4799. conjunction with the @value{op-create}. @command{tar} also
  4800. accepts @samp{--portability} for this option. When you specify it,
  4801. @command{tar} leaves out information about directories, pipes, fifos,
  4802. contiguous files, and device files, and specifies file ownership by
  4803. group and user IDs instead of group and user names.
  4804. When updating an archive, do not use @value{op-old-archive}
  4805. unless the archive was created with using this option.
  4806. In most cases, a @emph{new} format archive can be read by an @emph{old}
  4807. @command{tar} program without serious trouble, so this option should
  4808. seldom be needed. On the other hand, most modern @command{tar}s are
  4809. able to read old format archives, so it might be safer for you to
  4810. always use @value{op-old-archive} for your distributions.
  4811. @node posix
  4812. @subsection @sc{gnu} @command{tar} and @sc{posix} @command{tar}
  4813. @sc{gnu} @command{tar} was based on an early draft of the @sc{posix} 1003.1
  4814. @code{ustar} standard. @sc{gnu} extensions to @command{tar}, such as the
  4815. support for file names longer than 100 characters, use portions of the
  4816. @command{tar} header record which were specified in that @sc{posix} draft as
  4817. unused. Subsequent changes in @sc{posix} have allocated the same parts of
  4818. the header record for other purposes. As a result, @sc{gnu} @command{tar} is
  4819. incompatible with the current @sc{posix} spec, and with @command{tar} programs
  4820. that follow it.
  4821. We plan to reimplement these @sc{gnu} extensions in a new way which is
  4822. upward compatible with the latest @sc{posix} @command{tar} format, but we
  4823. don't know when this will be done.
  4824. In the mean time, there is simply no telling what might happen if you
  4825. read a @sc{gnu} @command{tar} archive, which uses the @sc{gnu} extensions, using
  4826. some other @command{tar} program. So if you want to read the archive
  4827. with another @command{tar} program, be sure to write it using the
  4828. @samp{--old-archive} option (@samp{-o}).
  4829. @FIXME{is there a way to tell which flavor of tar was used to write a
  4830. particular archive before you try to read it?}
  4831. Traditionally, old @command{tar}s have a limit of 100 characters. @sc{gnu}
  4832. @command{tar} attempted two different approaches to overcome this limit,
  4833. using and extending a format specified by a draft of some P1003.1.
  4834. The first way was not that successful, and involved @file{@@MaNgLeD@@}
  4835. file names, or such; while a second approach used @file{././@@LongLink}
  4836. and other tricks, yielding better success. In theory, @sc{gnu} @command{tar}
  4837. should be able to handle file names of practically unlimited length.
  4838. So, if @sc{gnu} @command{tar} fails to dump and retrieve files having more
  4839. than 100 characters, then there is a bug in @sc{gnu} @command{tar}, indeed.
  4840. But, being strictly @sc{posix}, the limit was still 100 characters.
  4841. For various other purposes, @sc{gnu} @command{tar} used areas left unassigned
  4842. in the @sc{posix} draft. @sc{posix} later revised P1003.1 @code{ustar} format by
  4843. assigning previously unused header fields, in such a way that the upper
  4844. limit for file name length was raised to 256 characters. However, the
  4845. actual @sc{posix} limit oscillates between 100 and 256, depending on the
  4846. precise location of slashes in full file name (this is rather ugly).
  4847. Since @sc{gnu} @command{tar} use the same fields for quite other purposes,
  4848. it became incompatible with the latest @sc{posix} standards.
  4849. For longer or non-fitting file names, we plan to use yet another set
  4850. of @sc{gnu} extensions, but this time, complying with the provisions @sc{posix}
  4851. offers for extending the format, rather than conflicting with it.
  4852. Whenever an archive uses old @sc{gnu} @command{tar} extension format or @sc{posix}
  4853. extensions, would it be for very long file names or other specialities,
  4854. this archive becomes non-portable to other @command{tar} implementations.
  4855. In fact, anything can happen. The most forgiving @command{tar}s will
  4856. merely unpack the file using a wrong name, and maybe create another
  4857. file named something like @file{@@LongName}, with the true file name
  4858. in it. @command{tar}s not protecting themselves may segment violate!
  4859. Compatibility concerns make all this thing more difficult, as we
  4860. will have to support @emph{all} these things together, for a while.
  4861. @sc{gnu} @command{tar} should be able to produce and read true @sc{posix} format
  4862. files, while being able to detect old @sc{gnu} @command{tar} formats, besides
  4863. old V7 format, and process them conveniently. It would take years
  4864. before this whole area stabilizes@dots{}
  4865. There are plans to raise this 100 limit to 256, and yet produce @sc{posix}
  4866. conforming archives. Past 256, I do not know yet if @sc{gnu} @command{tar}
  4867. will go non-@sc{posix} again, or merely refuse to archive the file.
  4868. There are plans so @sc{gnu} @command{tar} support more fully the latest @sc{posix}
  4869. format, while being able to read old V7 format, @sc{gnu} (semi-@sc{posix} plus
  4870. extension), as well as full @sc{posix}. One may ask if there is part of
  4871. the @sc{posix} format that we still cannot support. This simple question
  4872. has a complex answer. Maybe that, on intimate look, some strong
  4873. limitations will pop up, but until now, nothing sounds too difficult
  4874. (but see below). I only have these few pages of @sc{posix} telling about
  4875. ``Extended tar Format'' (P1003.1-1990 -- section 10.1.1), and there are
  4876. references to other parts of the standard I do not have, which should
  4877. normally enforce limitations on stored file names (I suspect things
  4878. like fixing what @kbd{/} and @kbd{@key{NUL}} means). There are also
  4879. some points which the standard does not make clear, Existing practice
  4880. will then drive what I should do.
  4881. @sc{posix} mandates that, when a file name cannot fit within 100 to
  4882. 256 characters (the variance comes from the fact a @kbd{/} is
  4883. ideally needed as the 156'th character), or a link name cannot
  4884. fit within 100 characters, a warning should be issued and the file
  4885. @emph{not} be stored. Unless some @value{op-posix} option is given
  4886. (or @env{POSIXLY_CORRECT} is set), I suspect that @sc{gnu} @command{tar}
  4887. should disobey this specification, and automatically switch to using
  4888. @sc{gnu} extensions to overcome file name or link name length limitations.
  4889. There is a problem, however, which I did not intimately studied yet.
  4890. Given a truly @sc{posix} archive with names having more than 100 characters,
  4891. I guess that @sc{gnu} @command{tar} up to 1.11.8 will process it as if it were an
  4892. old V7 archive, and be fooled by some fields which are coded differently.
  4893. So, the question is to decide if the next generation of @sc{gnu} @command{tar}
  4894. should produce @sc{posix} format by default, whenever possible, producing
  4895. archives older versions of @sc{gnu} @command{tar} might not be able to read
  4896. correctly. I fear that we will have to suffer such a choice one of these
  4897. days, if we want @sc{gnu} @command{tar} to go closer to @sc{posix}. We can rush it.
  4898. Another possibility is to produce the current @sc{gnu} @command{tar} format
  4899. by default for a few years, but have @sc{gnu} @command{tar} versions from some
  4900. 1.@var{POSIX} and up able to recognize all three formats, and let older
  4901. @sc{gnu} @command{tar} fade out slowly. Then, we could switch to producing @sc{posix}
  4902. format by default, with not much harm to those still having (very old at
  4903. that time) @sc{gnu} @command{tar} versions prior to 1.@var{POSIX}.
  4904. @sc{posix} format cannot represent very long names, volume headers,
  4905. splitting of files in multi-volumes, sparse files, and incremental
  4906. dumps; these would be all disallowed if @value{op-posix} or
  4907. @env{POSIXLY_CORRECT}. Otherwise, if @command{tar} is given long
  4908. names, or @samp{-[VMSgG]}, then it should automatically go non-@sc{posix}.
  4909. I think this is easily granted without much discussion.
  4910. Another point is that only @code{mtime} is stored in @sc{posix}
  4911. archives, while @sc{gnu} @command{tar} currently also store @code{atime}
  4912. and @code{ctime}. If we want @sc{gnu} @command{tar} to go closer to @sc{posix},
  4913. my choice would be to drop @code{atime} and @code{ctime} support on
  4914. average. On the other hand, I perceive that full dumps or incremental
  4915. dumps need @code{atime} and @code{ctime} support, so for those special
  4916. applications, @sc{posix} has to be avoided altogether.
  4917. A few users requested that @value{op-sparse} be always active by
  4918. default, I think that before replying to them, we have to decide
  4919. if we want @sc{gnu} @command{tar} to go closer to @sc{posix} on average, while
  4920. producing files. My choice would be to go closer to @sc{posix} in the
  4921. long run. Besides possible double reading, I do not see any point
  4922. of not trying to save files as sparse when creating archives which
  4923. are neither @sc{posix} nor old-V7, so the actual @value{op-sparse} would
  4924. become selected by default when producing such archives, whatever
  4925. the reason is. So, @value{op-sparse} alone might be redefined to force
  4926. @sc{gnu}-format archives, and recover its previous meaning from this fact.
  4927. @sc{gnu}-format as it exists now can easily fool other @sc{posix} @command{tar},
  4928. as it uses fields which @sc{posix} considers to be part of the file name
  4929. prefix. I wonder if it would not be a good idea, in the long run,
  4930. to try changing @sc{gnu}-format so any added field (like @code{ctime},
  4931. @code{atime}, file offset in subsequent volumes, or sparse file
  4932. descriptions) be wholly and always pushed into an extension block,
  4933. instead of using space in the @sc{posix} header block. I could manage
  4934. to do that portably between future @sc{gnu} @command{tar}s. So other @sc{posix}
  4935. @command{tar}s might be at least able to provide kind of correct listings
  4936. for the archives produced by @sc{gnu} @command{tar}, if not able to process
  4937. them otherwise.
  4938. Using these projected extensions might induce older @command{tar}s to fail.
  4939. We would use the same approach as for @sc{posix}. I'll put out a @command{tar}
  4940. capable of reading @sc{posix}ier, yet extended archives, but will not produce
  4941. this format by default, in @sc{gnu} mode. In a few years, when newer @sc{gnu}
  4942. @command{tar}s will have flooded out @command{tar} 1.11.X and previous, we
  4943. could switch to producing @sc{posix}ier extended archives, with no real harm
  4944. to users, as almost all existing @sc{gnu} @command{tar}s will be ready to read
  4945. @sc{posix}ier format. In fact, I'll do both changes at the same time, in a
  4946. few years, and just prepare @command{tar} for both changes, without effecting
  4947. them, from 1.@var{POSIX}. (Both changes: 1---using @sc{posix} convention for
  4948. getting over 100 characters; 2---avoiding mangling @sc{posix} headers for @sc{gnu}
  4949. extensions, using only @sc{posix} mandated extension techniques).
  4950. So, a future @command{tar} will have a @value{op-posix}
  4951. flag forcing the usage of truly @sc{posix} headers, and so, producing
  4952. archives previous @sc{gnu} @command{tar} will not be able to read.
  4953. So, @emph{once} pretest will announce that feature, it would be
  4954. particularly useful that users test how exchangeable will be archives
  4955. between @sc{gnu} @command{tar} with @value{op-posix} and other @sc{posix} @command{tar}.
  4956. In a few years, when @sc{gnu} @command{tar} will produce @sc{posix} headers by
  4957. default, @value{op-posix} will have a strong meaning and will disallow
  4958. @sc{gnu} extensions. But in the meantime, for a long while, @value{op-posix}
  4959. in @sc{gnu} tar will not disallow @sc{gnu} extensions like @value{op-label},
  4960. @value{op-multi-volume}, @value{op-sparse}, or very long file or link names.
  4961. However, @value{op-posix} with @sc{gnu} extensions will use @sc{posix}
  4962. headers with reserved-for-users extensions to headers, and I will be
  4963. curious to know how well or bad @sc{posix} @command{tar}s will react to these.
  4964. @sc{gnu} @command{tar} prior to 1.@var{POSIX}, and after 1.@var{POSIX} without
  4965. @value{op-posix}, generates and checks @samp{ustar@w{ }@w{ }}, with two
  4966. suffixed spaces. This is sufficient for older @sc{gnu} @command{tar} not to
  4967. recognize @sc{posix} archives, and consequently, wrongly decide those archives
  4968. are in old V7 format. It is a useful bug for me, because @sc{gnu} @command{tar}
  4969. has other @sc{posix} incompatibilities, and I need to segregate @sc{gnu} @command{tar}
  4970. semi-@sc{posix} archives from truly @sc{posix} archives, for @sc{gnu} @command{tar} should
  4971. be somewhat compatible with itself, while migrating closer to latest
  4972. @sc{posix} standards. So, I'll be very careful about how and when I will do
  4973. the correction.
  4974. @node Checksumming
  4975. @subsection Checksumming Problems
  4976. SunOS and HP-UX @command{tar} fail to accept archives created using @sc{gnu}
  4977. @command{tar} and containing non-ASCII file names, that is, file names
  4978. having characters with the eight bit set, because they use signed
  4979. checksums, while @sc{gnu} @command{tar} uses unsigned checksums while creating
  4980. archives, as per @sc{posix} standards. On reading, @sc{gnu} @command{tar} computes
  4981. both checksums and accept any. It is somewhat worrying that a lot of
  4982. people may go around doing backup of their files using faulty (or at
  4983. least non-standard) software, not learning about it until it's time
  4984. to restore their missing files with an incompatible file extractor,
  4985. or vice versa.
  4986. @sc{gnu} @command{tar} compute checksums both ways, and accept any on read,
  4987. so @sc{gnu} tar can read Sun tapes even with their wrong checksums.
  4988. @sc{gnu} @command{tar} produces the standard checksum, however, raising
  4989. incompatibilities with Sun. That is to say, @sc{gnu} @command{tar} has not
  4990. been modified to @emph{produce} incorrect archives to be read by buggy
  4991. @command{tar}'s. I've been told that more recent Sun @command{tar} now
  4992. read standard archives, so maybe Sun did a similar patch, after all?
  4993. The story seems to be that when Sun first imported @command{tar}
  4994. sources on their system, they recompiled it without realizing that
  4995. the checksums were computed differently, because of a change in
  4996. the default signing of @code{char}'s in their compiler. So they
  4997. started computing checksums wrongly. When they later realized their
  4998. mistake, they merely decided to stay compatible with it, and with
  4999. themselves afterwards. Presumably, but I do not really know, HP-UX
  5000. has chosen that their @command{tar} archives to be compatible with Sun's.
  5001. The current standards do not favor Sun @command{tar} format. In any
  5002. case, it now falls on the shoulders of SunOS and HP-UX users to get
  5003. a @command{tar} able to read the good archives they receive.
  5004. @node Large or Negative Values
  5005. @subsection Large or Negative Values
  5006. @cindex large values
  5007. @cindex future time stamps
  5008. @cindex negative time stamps
  5009. @sc{posix} @command{tar} format uses fixed-sized unsigned octal strings
  5010. to represent numeric values. User and group IDs and device major and
  5011. minor numbers have unsigned 21-bit representations, and file sizes and
  5012. times have unsigned 33-bit representations. @sc{gnu} @command{tar}
  5013. generates @sc{posix} representations when possible, but for values
  5014. outside the @sc{posix} range it generates two's-complement base-256
  5015. strings: uids, gids, and device numbers have signed 57-bit
  5016. representations, and file sizes and times have signed 89-bit
  5017. representations. These representations are an extension to @sc{posix}
  5018. @command{tar} format, so they are not universally portable.
  5019. The most common portability problems with out-of-range numeric values
  5020. are large files and future or negative time stamps.
  5021. Portable archives should avoid members of 8 GB or larger, as @sc{posix}
  5022. @command{tar} format cannot represent them.
  5023. Portable archives should avoid time stamps from the future. @sc{posix}
  5024. @command{tar} format can represent time stamps in the range 1970-01-01
  5025. 00:00:00 through 2242-03-16 12:56:31 @sc{utc}. However, many current
  5026. hosts use a signed 32-bit @code{time_t}, or internal time stamp format,
  5027. and cannot represent time stamps after 2038-01-19 03:14:07 @sc{utc}; so
  5028. portable archives must avoid these time stamps for many years to come.
  5029. Portable archives should also avoid time stamps before 1970. These time
  5030. stamps are a common @sc{posix} extension but their @code{time_t}
  5031. representations are negative. Many traditional @command{tar}
  5032. implementations generate a two's complement representation for negative
  5033. time stamps that assumes a signed 32-bit @code{time_t}; hence they
  5034. generate archives that are not portable to hosts with differing
  5035. @code{time_t} representations. @sc{gnu} @command{tar} recognizes this
  5036. situation when it is run on host with a signed 32-bit @code{time_t}, but
  5037. it issues a warning, as these time stamps are nonstandard and unportable.
  5038. @node Compression
  5039. @section Using Less Space through Compression
  5040. @menu
  5041. * gzip:: Creating and Reading Compressed Archives
  5042. * sparse:: Archiving Sparse Files
  5043. @end menu
  5044. @node gzip
  5045. @subsection Creating and Reading Compressed Archives
  5046. @cindex Compressed archives
  5047. @cindex Storing archives in compressed format
  5048. @UNREVISED
  5049. @table @kbd
  5050. @item -z
  5051. @itemx --gzip
  5052. @itemx --ungzip
  5053. Filter the archive through @command{gzip}.
  5054. @end table
  5055. @FIXME{ach; these two bits orig from "compare" (?). where to put?} Some
  5056. format parameters must be taken into consideration when modifying an
  5057. archive.@FIXME{???} Compressed archives cannot be modified.
  5058. You can use @samp{--gzip} and @samp{--gunzip} on physical devices
  5059. (tape drives, etc.) and remote files as well as on normal files; data
  5060. to or from such devices or remote files is reblocked by another copy
  5061. of the @command{tar} program to enforce the specified (or default) record
  5062. size. The default compression parameters are used; if you need to
  5063. override them, avoid the @value{op-gzip} option and run @command{gzip}
  5064. explicitly. (Or set the @env{GZIP} environment variable.)
  5065. The @value{op-gzip} option does not work with the @value{op-multi-volume}
  5066. option, or with the @value{op-update}, @value{op-append},
  5067. @value{op-concatenate}, or @value{op-delete} operations.
  5068. It is not exact to say that @sc{gnu} @command{tar} is to work in concert
  5069. with @command{gzip} in a way similar to @command{zip}, say. Surely, it is
  5070. possible that @command{tar} and @command{gzip} be done with a single call,
  5071. like in:
  5072. @example
  5073. $ @kbd{tar cfz archive.tar.gz subdir}
  5074. @end example
  5075. @noindent
  5076. to save all of @samp{subdir} into a @code{gzip}'ed archive. Later you
  5077. can do:
  5078. @example
  5079. $ @kbd{tar xfz archive.tar.gz}
  5080. @end example
  5081. @noindent
  5082. to explode and unpack.
  5083. The difference is that the whole archive is compressed. With
  5084. @command{zip}, archive members are archived individually. @command{tar}'s
  5085. method yields better compression. On the other hand, one can view the
  5086. contents of a @command{zip} archive without having to decompress it. As
  5087. for the @command{tar} and @command{gzip} tandem, you need to decompress the
  5088. archive to see its contents. However, this may be done without needing
  5089. disk space, by using pipes internally:
  5090. @example
  5091. $ @kbd{tar tfz archive.tar.gz}
  5092. @end example
  5093. @cindex corrupted archives
  5094. About corrupted compressed archives: @command{gzip}'ed files have no
  5095. redundancy, for maximum compression. The adaptive nature of the
  5096. compression scheme means that the compression tables are implicitly
  5097. spread all over the archive. If you lose a few blocks, the dynamic
  5098. construction of the compression tables becomes unsynchronized, and there
  5099. is little chance that you could recover later in the archive.
  5100. There are pending suggestions for having a per-volume or per-file
  5101. compression in @sc{gnu} @command{tar}. This would allow for viewing the
  5102. contents without decompression, and for resynchronizing decompression at
  5103. every volume or file, in case of corrupted archives. Doing so, we might
  5104. lose some compressibility. But this would have make recovering easier.
  5105. So, there are pros and cons. We'll see!
  5106. @table @kbd
  5107. @item -j
  5108. @itemx --bzip2
  5109. Filter the archive through @code{bzip2}. Otherwise like @value{op-gzip}.
  5110. @item -Z
  5111. @itemx --compress
  5112. @itemx --uncompress
  5113. Filter the archive through @command{compress}. Otherwise like @value{op-gzip}.
  5114. @item --use-compress-program=@var{prog}
  5115. Filter through @var{prog} (must accept @samp{-d}).
  5116. @end table
  5117. @value{op-compress} stores an archive in compressed format. This
  5118. option is useful in saving time over networks and space in pipes, and
  5119. when storage space is at a premium. @value{op-compress} causes
  5120. @command{tar} to compress when writing the archive, or to uncompress when
  5121. reading the archive.
  5122. To perform compression and uncompression on the archive, @command{tar}
  5123. runs the @command{compress} utility. @command{tar} uses the default
  5124. compression parameters; if you need to override them, avoid the
  5125. @value{op-compress} option and run the @command{compress} utility
  5126. explicitly. It is useful to be able to call the @command{compress}
  5127. utility from within @command{tar} because the @command{compress} utility by
  5128. itself cannot access remote tape drives.
  5129. The @value{op-compress} option will not work in conjunction with the
  5130. @value{op-multi-volume} option or the @value{op-append}, @value{op-update}
  5131. and @value{op-delete} operations. @xref{Operations}, for
  5132. more information on these operations.
  5133. If there is no compress utility available, @command{tar} will report an error.
  5134. @strong{Please note} that the @command{compress} program may be covered by
  5135. a patent, and therefore we recommend you stop using it.
  5136. @value{op-bzip2} acts like @value{op-compress}, except that it uses
  5137. the @code{bzip2} utility.
  5138. @table @kbd
  5139. @item --compress
  5140. @itemx --uncompress
  5141. @itemx -z
  5142. @itemx -Z
  5143. When this option is specified, @command{tar} will compress (when writing
  5144. an archive), or uncompress (when reading an archive). Used in
  5145. conjunction with the @value{op-create}, @value{op-extract}, @value{op-list} and
  5146. @value{op-compare} operations.
  5147. @end table
  5148. You can have archives be compressed by using the @value{op-gzip} option.
  5149. This will arrange for @command{tar} to use the @command{gzip} program to be
  5150. used to compress or uncompress the archive wren writing or reading it.
  5151. To use the older, obsolete, @command{compress} program, use the
  5152. @value{op-compress} option. The @sc{gnu} Project recommends you not use
  5153. @command{compress}, because there is a patent covering the algorithm it
  5154. uses. You could be sued for patent infringement merely by running
  5155. @command{compress}.
  5156. I have one question, or maybe it's a suggestion if there isn't a way
  5157. to do it now. I would like to use @value{op-gzip}, but I'd also like the
  5158. output to be fed through a program like @sc{gnu} @command{ecc} (actually, right
  5159. now that's @samp{exactly} what I'd like to use :-)), basically adding
  5160. ECC protection on top of compression. It seems as if this should be
  5161. quite easy to do, but I can't work out exactly how to go about it.
  5162. Of course, I can pipe the standard output of @command{tar} through
  5163. @command{ecc}, but then I lose (though I haven't started using it yet,
  5164. I confess) the ability to have @command{tar} use @command{rmt} for it's I/O
  5165. (I think).
  5166. I think the most straightforward thing would be to let me specify a
  5167. general set of filters outboard of compression (preferably ordered,
  5168. so the order can be automatically reversed on input operations, and
  5169. with the options they require specifiable), but beggars shouldn't be
  5170. choosers and anything you decide on would be fine with me.
  5171. By the way, I like @command{ecc} but if (as the comments say) it can't
  5172. deal with loss of block sync, I'm tempted to throw some time at adding
  5173. that capability. Supposing I were to actually do such a thing and
  5174. get it (apparently) working, do you accept contributed changes to
  5175. utilities like that? (Leigh Clayton @file{loc@@soliton.com}, May 1995).
  5176. Isn't that exactly the role of the @value{op-use-compress-prog} option?
  5177. I never tried it myself, but I suspect you may want to write a
  5178. @var{prog} script or program able to filter stdin to stdout to
  5179. way you want. It should recognize the @samp{-d} option, for when
  5180. extraction is needed rather than creation.
  5181. It has been reported that if one writes compressed data (through the
  5182. @value{op-gzip} or @value{op-compress} options) to a DLT and tries to use
  5183. the DLT compression mode, the data will actually get bigger and one will
  5184. end up with less space on the tape.
  5185. @node sparse
  5186. @subsection Archiving Sparse Files
  5187. @cindex Sparse Files
  5188. @UNREVISED
  5189. @table @kbd
  5190. @item -S
  5191. @itemx --sparse
  5192. Handle sparse files efficiently.
  5193. @end table
  5194. This option causes all files to be put in the archive to be tested for
  5195. sparseness, and handled specially if they are. The @value{op-sparse}
  5196. option is useful when many @code{dbm} files, for example, are being
  5197. backed up. Using this option dramatically decreases the amount of
  5198. space needed to store such a file.
  5199. In later versions, this option may be removed, and the testing and
  5200. treatment of sparse files may be done automatically with any special
  5201. @sc{gnu} options. For now, it is an option needing to be specified on
  5202. the command line with the creation or updating of an archive.
  5203. Files in the filesystem occasionally have ``holes.'' A hole in a file
  5204. is a section of the file's contents which was never written. The
  5205. contents of a hole read as all zeros. On many operating systems,
  5206. actual disk storage is not allocated for holes, but they are counted
  5207. in the length of the file. If you archive such a file, @command{tar}
  5208. could create an archive longer than the original. To have @command{tar}
  5209. attempt to recognize the holes in a file, use @value{op-sparse}. When
  5210. you use the @value{op-sparse} option, then, for any file using less
  5211. disk space than would be expected from its length, @command{tar} searches
  5212. the file for consecutive stretches of zeros. It then records in the
  5213. archive for the file where the consecutive stretches of zeros are, and
  5214. only archives the ``real contents'' of the file. On extraction (using
  5215. @value{op-sparse} is not needed on extraction) any such files have
  5216. hols created wherever the continuous stretches of zeros were found.
  5217. Thus, if you use @value{op-sparse}, @command{tar} archives won't take
  5218. more space than the original.
  5219. A file is sparse if it contains blocks of zeros whose existence is
  5220. recorded, but that have no space allocated on disk. When you specify
  5221. the @value{op-sparse} option in conjunction with the @value{op-create}
  5222. operation, @command{tar} tests all files for sparseness while archiving.
  5223. If @command{tar} finds a file to be sparse, it uses a sparse representation of
  5224. the file in the archive. @value{xref-create}, for more information
  5225. about creating archives.
  5226. @value{op-sparse} is useful when archiving files, such as dbm files,
  5227. likely to contain many nulls. This option dramatically
  5228. decreases the amount of space needed to store such an archive.
  5229. @quotation
  5230. @strong{Please Note:} Always use @value{op-sparse} when performing file
  5231. system backups, to avoid archiving the expanded forms of files stored
  5232. sparsely in the system.
  5233. Even if your system has no sparse files currently, some may be
  5234. created in the future. If you use @value{op-sparse} while making file
  5235. system backups as a matter of course, you can be assured the archive
  5236. will never take more space on the media than the files take on disk
  5237. (otherwise, archiving a disk filled with sparse files might take
  5238. hundreds of tapes). @FIXME-xref{incremental when node name is set.}
  5239. @end quotation
  5240. @command{tar} ignores the @value{op-sparse} option when reading an archive.
  5241. @table @kbd
  5242. @item --sparse
  5243. @itemx -S
  5244. Files stored sparsely in the file system are represented sparsely in
  5245. the archive. Use in conjunction with write operations.
  5246. @end table
  5247. However, users should be well aware that at archive creation time, @sc{gnu}
  5248. @command{tar} still has to read whole disk file to locate the @dfn{holes}, and
  5249. so, even if sparse files use little space on disk and in the archive, they
  5250. may sometimes require inordinate amount of time for reading and examining
  5251. all-zero blocks of a file. Although it works, it's painfully slow for a
  5252. large (sparse) file, even though the resulting tar archive may be small.
  5253. (One user reports that dumping a @file{core} file of over 400 megabytes,
  5254. but with only about 3 megabytes of actual data, took about 9 minutes on
  5255. a Sun Sparcstation ELC, with full CPU utilization.)
  5256. This reading is required in all cases and is not related to the fact
  5257. the @value{op-sparse} option is used or not, so by merely @emph{not}
  5258. using the option, you are not saving time@footnote{Well! We should say
  5259. the whole truth, here. When @value{op-sparse} is selected while creating
  5260. an archive, the current @command{tar} algorithm requires sparse files to be
  5261. read twice, not once. We hope to develop a new archive format for saving
  5262. sparse files in which one pass will be sufficient.}.
  5263. Programs like @command{dump} do not have to read the entire file; by examining
  5264. the file system directly, they can determine in advance exactly where the
  5265. holes are and thus avoid reading through them. The only data it need read
  5266. are the actual allocated data blocks. @sc{gnu} @command{tar} uses a more portable
  5267. and straightforward archiving approach, it would be fairly difficult that
  5268. it does otherwise. Elizabeth Zwicky writes to @file{comp.unix.internals},
  5269. on 1990-12-10:
  5270. @quotation
  5271. What I did say is that you cannot tell the difference between a hole and an
  5272. equivalent number of nulls without reading raw blocks. @code{st_blocks} at
  5273. best tells you how many holes there are; it doesn't tell you @emph{where}.
  5274. Just as programs may, conceivably, care what @code{st_blocks} is (care
  5275. to name one that does?), they may also care where the holes are (I have
  5276. no examples of this one either, but it's equally imaginable).
  5277. I conclude from this that good archivers are not portable. One can
  5278. arguably conclude that if you want a portable program, you can in good
  5279. conscience restore files with as many holes as possible, since you can't
  5280. get it right.
  5281. @end quotation
  5282. @node Attributes
  5283. @section Handling File Attributes
  5284. @UNREVISED
  5285. When @command{tar} reads files, this causes them to have the access
  5286. times updated. To have @command{tar} attempt to set the access times
  5287. back to what they were before they were read, use the
  5288. @value{op-atime-preserve} option.
  5289. Handling of file attributes
  5290. @table @kbd
  5291. @item --atime-preserve
  5292. Preserve access times on files that are read.
  5293. This doesn't work for files that
  5294. you don't own, unless you're root, and it doesn't interact with
  5295. incremental dumps nicely (@pxref{Backups}), and it can set access or
  5296. modification times incorrectly if other programs access the file while
  5297. @command{tar} is running; but it is good enough for some purposes.
  5298. @item -m
  5299. @itemx --touch
  5300. Do not extract file modified time.
  5301. When this option is used, @command{tar} leaves the modification times
  5302. of the files it extracts as the time when the files were extracted,
  5303. instead of setting it to the time recorded in the archive.
  5304. This option is meaningless with @value{op-list}.
  5305. @item --same-owner
  5306. Create extracted files with the same ownership they have in the
  5307. archive.
  5308. This is the default behavior for the superuser,
  5309. so this option is meaningful only for non-root users, when @command{tar}
  5310. is executed on those systems able to give files away. This is
  5311. considered as a security flaw by many people, at least because it
  5312. makes quite difficult to correctly account users for the disk space
  5313. they occupy. Also, the @code{suid} or @code{sgid} attributes of
  5314. files are easily and silently lost when files are given away.
  5315. When writing an archive, @command{tar} writes the user id and user name
  5316. separately. If it can't find a user name (because the user id is not
  5317. in @file{/etc/passwd}), then it does not write one. When restoring,
  5318. and doing a @code{chmod} like when you use @value{op-same-permissions},
  5319. @FIXME{same-owner?}it tries to look the name (if one was written)
  5320. up in @file{/etc/passwd}. If it fails, then it uses the user id
  5321. stored in the archive instead.
  5322. @item --no-same-owner
  5323. Do not attempt to restore ownership when extracting. This is the
  5324. default behavior for ordinary users, so this option has an effect
  5325. only for the superuser.
  5326. @item --numeric-owner
  5327. The @value{op-numeric-owner} option allows (ANSI) archives to be written
  5328. without user/group name information or such information to be ignored
  5329. when extracting. It effectively disables the generation and/or use
  5330. of user/group name information. This option forces extraction using
  5331. the numeric ids from the archive, ignoring the names.
  5332. This is useful in certain circumstances, when restoring a backup from
  5333. an emergency floppy with different passwd/group files for example.
  5334. It is otherwise impossible to extract files with the right ownerships
  5335. if the password file in use during the extraction does not match the
  5336. one belonging to the filesystem(s) being extracted. This occurs,
  5337. for example, if you are restoring your files after a major crash and
  5338. had booted from an emergency floppy with no password file or put your
  5339. disk into another machine to do the restore.
  5340. The numeric ids are @emph{always} saved into @command{tar} archives.
  5341. The identifying names are added at create time when provided by the
  5342. system, unless @value{op-old-archive} is used. Numeric ids could be
  5343. used when moving archives between a collection of machines using
  5344. a centralized management for attribution of numeric ids to users
  5345. and groups. This is often made through using the NIS capabilities.
  5346. When making a @command{tar} file for distribution to other sites, it
  5347. is sometimes cleaner to use a single owner for all files in the
  5348. distribution, and nicer to specify the write permission bits of the
  5349. files as stored in the archive independently of their actual value on
  5350. the file system. The way to prepare a clean distribution is usually
  5351. to have some Makefile rule creating a directory, copying all needed
  5352. files in that directory, then setting ownership and permissions as
  5353. wanted (there are a lot of possible schemes), and only then making a
  5354. @command{tar} archive out of this directory, before cleaning everything
  5355. out. Of course, we could add a lot of options to @sc{gnu} @command{tar} for
  5356. fine tuning permissions and ownership. This is not the good way,
  5357. I think. @sc{gnu} @command{tar} is already crowded with options and moreover,
  5358. the approach just explained gives you a great deal of control already.
  5359. @item -p
  5360. @itemx --same-permissions
  5361. @itemx --preserve-permissions
  5362. Extract all protection information.
  5363. This option causes @command{tar} to set the modes (access permissions) of
  5364. extracted files exactly as recorded in the archive. If this option
  5365. is not used, the current @code{umask} setting limits the permissions
  5366. on extracted files.
  5367. This option is meaningless with @value{op-list}.
  5368. @item --preserve
  5369. Same as both @value{op-same-permissions} and @value{op-same-order}.
  5370. The @value{op-preserve} option has no equivalent short option name.
  5371. It is equivalent to @value{op-same-permissions} plus @value{op-same-order}.
  5372. @FIXME{I do not see the purpose of such an option. (Neither I. FP.)}
  5373. @end table
  5374. @node Standard
  5375. @section The Standard Format
  5376. @UNREVISED
  5377. While an archive may contain many files, the archive itself is a
  5378. single ordinary file. Like any other file, an archive file can be
  5379. written to a storage device such as a tape or disk, sent through a
  5380. pipe or over a network, saved on the active file system, or even
  5381. stored in another archive. An archive file is not easy to read or
  5382. manipulate without using the @command{tar} utility or Tar mode in @sc{gnu}
  5383. Emacs.
  5384. Physically, an archive consists of a series of file entries terminated
  5385. by an end-of-archive entry, which consists of 512 zero bytes. A file
  5386. entry usually describes one of the files in the archive (an
  5387. @dfn{archive member}), and consists of a file header and the contents
  5388. of the file. File headers contain file names and statistics, checksum
  5389. information which @command{tar} uses to detect file corruption, and
  5390. information about file types.
  5391. Archives are permitted to have more than one member with the same
  5392. member name. One way this situation can occur is if more than one
  5393. version of a file has been stored in the archive. For information
  5394. about adding new versions of a file to an archive, see @ref{update}.
  5395. @FIXME-xref{To learn more about having more than one archive member with the
  5396. same name, see -backup node, when it's written.}
  5397. In addition to entries describing archive members, an archive may
  5398. contain entries which @command{tar} itself uses to store information.
  5399. @value{xref-label}, for an example of such an archive entry.
  5400. A @command{tar} archive file contains a series of blocks. Each block
  5401. contains @code{BLOCKSIZE} bytes. Although this format may be thought
  5402. of as being on magnetic tape, other media are often used.
  5403. Each file archived is represented by a header block which describes
  5404. the file, followed by zero or more blocks which give the contents
  5405. of the file. At the end of the archive file there may be a block
  5406. filled with binary zeros as an end-of-file marker. A reasonable system
  5407. should write a block of zeros at the end, but must not assume that
  5408. such a block exists when reading an archive.
  5409. The blocks may be @dfn{blocked} for physical I/O operations.
  5410. Each record of @var{n} blocks (where @var{n} is set by the
  5411. @value{op-blocking-factor} option to @command{tar}) is written with a single
  5412. @w{@samp{write ()}} operation. On magnetic tapes, the result of
  5413. such a write is a single record. When writing an archive,
  5414. the last record of blocks should be written at the full size, with
  5415. blocks after the zero block containing all zeros. When reading
  5416. an archive, a reasonable system should properly handle an archive
  5417. whose last record is shorter than the rest, or which contains garbage
  5418. records after a zero block.
  5419. The header block is defined in C as follows. In the @sc{gnu} @command{tar}
  5420. distribution, this is part of file @file{src/tar.h}:
  5421. @example
  5422. @include header.texi
  5423. @end example
  5424. All characters in header blocks are represented by using 8-bit
  5425. characters in the local variant of ASCII. Each field within the
  5426. structure is contiguous; that is, there is no padding used within
  5427. the structure. Each character on the archive medium is stored
  5428. contiguously.
  5429. Bytes representing the contents of files (after the header block
  5430. of each file) are not translated in any way and are not constrained
  5431. to represent characters in any character set. The @command{tar} format
  5432. does not distinguish text files from binary files, and no translation
  5433. of file contents is performed.
  5434. The @code{name}, @code{linkname}, @code{magic}, @code{uname}, and
  5435. @code{gname} are null-terminated character strings. All other fields
  5436. are zero-filled octal numbers in ASCII. Each numeric field of width
  5437. @var{w} contains @var{w} minus 2 digits, a space, and a null, except
  5438. @code{size}, and @code{mtime}, which do not contain the trailing null.
  5439. The @code{name} field is the file name of the file, with directory names
  5440. (if any) preceding the file name, separated by slashes.
  5441. @FIXME{how big a name before field overflows?}
  5442. The @code{mode} field provides nine bits specifying file permissions
  5443. and three bits to specify the Set UID, Set GID, and Save Text
  5444. (@dfn{sticky}) modes. Values for these bits are defined above.
  5445. When special permissions are required to create a file with a given
  5446. mode, and the user restoring files from the archive does not hold such
  5447. permissions, the mode bit(s) specifying those special permissions
  5448. are ignored. Modes which are not supported by the operating system
  5449. restoring files from the archive will be ignored. Unsupported modes
  5450. should be faked up when creating or updating an archive; e.g.@: the
  5451. group permission could be copied from the @emph{other} permission.
  5452. The @code{uid} and @code{gid} fields are the numeric user and group
  5453. ID of the file owners, respectively. If the operating system does
  5454. not support numeric user or group IDs, these fields should be ignored.
  5455. The @code{size} field is the size of the file in bytes; linked files
  5456. are archived with this field specified as zero. @FIXME-xref{Modifiers, in
  5457. particular the @value{op-incremental} option.}
  5458. The @code{mtime} field is the modification time of the file at the time
  5459. it was archived. It is the ASCII representation of the octal value of
  5460. the last time the file was modified, represented as an integer number of
  5461. seconds since January 1, 1970, 00:00 Coordinated Universal Time.
  5462. The @code{chksum} field is the ASCII representation of the octal value
  5463. of the simple sum of all bytes in the header block. Each 8-bit
  5464. byte in the header is added to an unsigned integer, initialized to
  5465. zero, the precision of which shall be no less than seventeen bits.
  5466. When calculating the checksum, the @code{chksum} field is treated as
  5467. if it were all blanks.
  5468. The @code{typeflag} field specifies the type of file archived. If a
  5469. particular implementation does not recognize or permit the specified
  5470. type, the file will be extracted as if it were a regular file. As this
  5471. action occurs, @command{tar} issues a warning to the standard error.
  5472. The @code{atime} and @code{ctime} fields are used in making incremental
  5473. backups; they store, respectively, the particular file's access time
  5474. and last inode-change time.
  5475. The @code{offset} is used by the @value{op-multi-volume} option, when
  5476. making a multi-volume archive. The offset is number of bytes into
  5477. the file that we need to restart at to continue the file on the next
  5478. tape, i.e., where we store the location that a continued file is
  5479. continued at.
  5480. The following fields were added to deal with sparse files. A file
  5481. is @dfn{sparse} if it takes in unallocated blocks which end up being
  5482. represented as zeros, i.e., no useful data. A test to see if a file
  5483. is sparse is to look at the number blocks allocated for it versus the
  5484. number of characters in the file; if there are fewer blocks allocated
  5485. for the file than would normally be allocated for a file of that
  5486. size, then the file is sparse. This is the method @command{tar} uses to
  5487. detect a sparse file, and once such a file is detected, it is treated
  5488. differently from non-sparse files.
  5489. Sparse files are often @code{dbm} files, or other database-type files
  5490. which have data at some points and emptiness in the greater part of
  5491. the file. Such files can appear to be very large when an @samp{ls
  5492. -l} is done on them, when in truth, there may be a very small amount
  5493. of important data contained in the file. It is thus undesirable
  5494. to have @command{tar} think that it must back up this entire file, as
  5495. great quantities of room are wasted on empty blocks, which can lead
  5496. to running out of room on a tape far earlier than is necessary.
  5497. Thus, sparse files are dealt with so that these empty blocks are
  5498. not written to the tape. Instead, what is written to the tape is a
  5499. description, of sorts, of the sparse file: where the holes are, how
  5500. big the holes are, and how much data is found at the end of the hole.
  5501. This way, the file takes up potentially far less room on the tape,
  5502. and when the file is extracted later on, it will look exactly the way
  5503. it looked beforehand. The following is a description of the fields
  5504. used to handle a sparse file:
  5505. The @code{sp} is an array of @code{struct sparse}. Each @code{struct
  5506. sparse} contains two 12-character strings which represent an offset
  5507. into the file and a number of bytes to be written at that offset.
  5508. The offset is absolute, and not relative to the offset in preceding
  5509. array element.
  5510. The header can hold four of these @code{struct sparse} at the moment;
  5511. if more are needed, they are not stored in the header.
  5512. The @code{isextended} flag is set when an @code{extended_header}
  5513. is needed to deal with a file. Note that this means that this flag
  5514. can only be set when dealing with a sparse file, and it is only set
  5515. in the event that the description of the file will not fit in the
  5516. allotted room for sparse structures in the header. In other words,
  5517. an extended_header is needed.
  5518. The @code{extended_header} structure is used for sparse files which
  5519. need more sparse structures than can fit in the header. The header can
  5520. fit 4 such structures; if more are needed, the flag @code{isextended}
  5521. gets set and the next block is an @code{extended_header}.
  5522. Each @code{extended_header} structure contains an array of 21
  5523. sparse structures, along with a similar @code{isextended} flag
  5524. that the header had. There can be an indeterminate number of such
  5525. @code{extended_header}s to describe a sparse file.
  5526. @table @asis
  5527. @item @code{REGTYPE}
  5528. @itemx @code{AREGTYPE}
  5529. These flags represent a regular file. In order to be compatible
  5530. with older versions of @command{tar}, a @code{typeflag} value of
  5531. @code{AREGTYPE} should be silently recognized as a regular file.
  5532. New archives should be created using @code{REGTYPE}. Also, for
  5533. backward compatibility, @command{tar} treats a regular file whose name
  5534. ends with a slash as a directory.
  5535. @item @code{LNKTYPE}
  5536. This flag represents a file linked to another file, of any type,
  5537. previously archived. Such files are identified in Unix by each
  5538. file having the same device and inode number. The linked-to name is
  5539. specified in the @code{linkname} field with a trailing null.
  5540. @item @code{SYMTYPE}
  5541. This represents a symbolic link to another file. The linked-to name
  5542. is specified in the @code{linkname} field with a trailing null.
  5543. @item @code{CHRTYPE}
  5544. @itemx @code{BLKTYPE}
  5545. These represent character special files and block special files
  5546. respectively. In this case the @code{devmajor} and @code{devminor}
  5547. fields will contain the major and minor device numbers respectively.
  5548. Operating systems may map the device specifications to their own
  5549. local specification, or may ignore the entry.
  5550. @item @code{DIRTYPE}
  5551. This flag specifies a directory or sub-directory. The directory
  5552. name in the @code{name} field should end with a slash. On systems where
  5553. disk allocation is performed on a directory basis, the @code{size} field
  5554. will contain the maximum number of bytes (which may be rounded to
  5555. the nearest disk block allocation unit) which the directory may
  5556. hold. A @code{size} field of zero indicates no such limiting. Systems
  5557. which do not support limiting in this manner should ignore the
  5558. @code{size} field.
  5559. @item @code{FIFOTYPE}
  5560. This specifies a FIFO special file. Note that the archiving of a
  5561. FIFO file archives the existence of this file and not its contents.
  5562. @item @code{CONTTYPE}
  5563. This specifies a contiguous file, which is the same as a normal
  5564. file except that, in operating systems which support it, all its
  5565. space is allocated contiguously on the disk. Operating systems
  5566. which do not allow contiguous allocation should silently treat this
  5567. type as a normal file.
  5568. @item @code{A} @dots{} @code{Z}
  5569. These are reserved for custom implementations. Some of these are
  5570. used in the @sc{gnu} modified format, as described below.
  5571. @end table
  5572. Other values are reserved for specification in future revisions of
  5573. the P1003 standard, and should not be used by any @command{tar} program.
  5574. The @code{magic} field indicates that this archive was output in
  5575. the P1003 archive format. If this field contains @code{TMAGIC},
  5576. the @code{uname} and @code{gname} fields will contain the ASCII
  5577. representation of the owner and group of the file respectively.
  5578. If found, the user and group IDs are used rather than the values in
  5579. the @code{uid} and @code{gid} fields.
  5580. For references, see ISO/IEC 9945-1:1990 or IEEE Std 1003.1-1990, pages
  5581. 169-173 (section 10.1) for @cite{Archive/Interchange File Format}; and
  5582. IEEE Std 1003.2-1992, pages 380-388 (section 4.48) and pages 936-940
  5583. (section E.4.48) for @cite{pax - Portable archive interchange}.
  5584. @node Extensions
  5585. @section @sc{gnu} Extensions to the Archive Format
  5586. @UNREVISED
  5587. The @sc{gnu} format uses additional file types to describe new types of
  5588. files in an archive. These are listed below.
  5589. @table @code
  5590. @item GNUTYPE_DUMPDIR
  5591. @itemx 'D'
  5592. This represents a directory and a list of files created by the
  5593. @value{op-incremental} option. The @code{size} field gives the total
  5594. size of the associated list of files. Each file name is preceded by
  5595. either a @samp{Y} (the file should be in this archive) or an @samp{N}.
  5596. (The file is a directory, or is not stored in the archive.) Each file
  5597. name is terminated by a null. There is an additional null after the
  5598. last file name.
  5599. @item GNUTYPE_MULTIVOL
  5600. @itemx 'M'
  5601. This represents a file continued from another volume of a multi-volume
  5602. archive created with the @value{op-multi-volume} option. The original
  5603. type of the file is not given here. The @code{size} field gives the
  5604. maximum size of this piece of the file (assuming the volume does
  5605. not end before the file is written out). The @code{offset} field
  5606. gives the offset from the beginning of the file where this part of
  5607. the file begins. Thus @code{size} plus @code{offset} should equal
  5608. the original size of the file.
  5609. @item GNUTYPE_SPARSE
  5610. @itemx 'S'
  5611. This flag indicates that we are dealing with a sparse file. Note
  5612. that archiving a sparse file requires special operations to find
  5613. holes in the file, which mark the positions of these holes, along
  5614. with the number of bytes of data to be found after the hole.
  5615. @item GNUTYPE_VOLHDR
  5616. @itemx 'V'
  5617. This file type is used to mark the volume header that was given with
  5618. the @value{op-label} option when the archive was created. The @code{name}
  5619. field contains the @code{name} given after the @value{op-label} option.
  5620. The @code{size} field is zero. Only the first file in each volume
  5621. of an archive should have this type.
  5622. @end table
  5623. You may have trouble reading a @sc{gnu} format archive on a non-@sc{gnu}
  5624. system if the options @value{op-incremental}, @value{op-multi-volume},
  5625. @value{op-sparse}, or @value{op-label} were used when writing the archive.
  5626. In general, if @command{tar} does not use the @sc{gnu}-added fields of the
  5627. header, other versions of @command{tar} should be able to read the
  5628. archive. Otherwise, the @command{tar} program will give an error, the
  5629. most likely one being a checksum error.
  5630. @node cpio
  5631. @section Comparison of @command{tar} and @command{cpio}
  5632. @UNREVISED
  5633. @FIXME{Reorganize the following material}
  5634. The @command{cpio} archive formats, like @command{tar}, do have maximum
  5635. pathname lengths. The binary and old ASCII formats have a max path
  5636. length of 256, and the new ASCII and CRC ASCII formats have a max
  5637. path length of 1024. @sc{gnu} @command{cpio} can read and write archives
  5638. with arbitrary pathname lengths, but other @command{cpio} implementations
  5639. may crash unexplainedly trying to read them.
  5640. @command{tar} handles symbolic links in the form in which it comes in BSD;
  5641. @command{cpio} doesn't handle symbolic links in the form in which it comes
  5642. in System V prior to SVR4, and some vendors may have added symlinks
  5643. to their system without enhancing @command{cpio} to know about them.
  5644. Others may have enhanced it in a way other than the way I did it
  5645. at Sun, and which was adopted by AT&T (and which is, I think, also
  5646. present in the @command{cpio} that Berkeley picked up from AT&T and put
  5647. into a later BSD release---I think I gave them my changes).
  5648. (SVR4 does some funny stuff with @command{tar}; basically, its @command{cpio}
  5649. can handle @command{tar} format input, and write it on output, and it
  5650. probably handles symbolic links. They may not have bothered doing
  5651. anything to enhance @command{tar} as a result.)
  5652. @command{cpio} handles special files; traditional @command{tar} doesn't.
  5653. @command{tar} comes with V7, System III, System V, and BSD source;
  5654. @command{cpio} comes only with System III, System V, and later BSD
  5655. (4.3-tahoe and later).
  5656. @command{tar}'s way of handling multiple hard links to a file can handle
  5657. file systems that support 32-bit inumbers (e.g., the BSD file system);
  5658. @command{cpio}s way requires you to play some games (in its "binary"
  5659. format, i-numbers are only 16 bits, and in its "portable ASCII" format,
  5660. they're 18 bits---it would have to play games with the "file system ID"
  5661. field of the header to make sure that the file system ID/i-number pairs
  5662. of different files were always different), and I don't know which
  5663. @command{cpio}s, if any, play those games. Those that don't might get
  5664. confused and think two files are the same file when they're not, and
  5665. make hard links between them.
  5666. @command{tar}s way of handling multiple hard links to a file places only
  5667. one copy of the link on the tape, but the name attached to that copy
  5668. is the @emph{only} one you can use to retrieve the file; @command{cpio}s
  5669. way puts one copy for every link, but you can retrieve it using any
  5670. of the names.
  5671. @quotation
  5672. What type of check sum (if any) is used, and how is this calculated.
  5673. @end quotation
  5674. See the attached manual pages for @command{tar} and @command{cpio} format.
  5675. @command{tar} uses a checksum which is the sum of all the bytes in the
  5676. @command{tar} header for a file; @command{cpio} uses no checksum.
  5677. @quotation
  5678. If anyone knows why @command{cpio} was made when @command{tar} was present
  5679. at the unix scene,
  5680. @end quotation
  5681. It wasn't. @command{cpio} first showed up in PWB/UNIX 1.0; no
  5682. generally-available version of UNIX had @command{tar} at the time. I don't
  5683. know whether any version that was generally available @emph{within AT&T}
  5684. had @command{tar}, or, if so, whether the people within AT&T who did
  5685. @command{cpio} knew about it.
  5686. On restore, if there is a corruption on a tape @command{tar} will stop at
  5687. that point, while @command{cpio} will skip over it and try to restore the
  5688. rest of the files.
  5689. The main difference is just in the command syntax and header format.
  5690. @command{tar} is a little more tape-oriented in that everything is blocked
  5691. to start on a record boundary.
  5692. @quotation
  5693. Is there any differences between the ability to recover crashed
  5694. archives between the two of them. (Is there any chance of recovering
  5695. crashed archives at all.)
  5696. @end quotation
  5697. Theoretically it should be easier under @command{tar} since the blocking
  5698. lets you find a header with some variation of @samp{dd skip=@var{nn}}.
  5699. However, modern @command{cpio}'s and variations have an option to just
  5700. search for the next file header after an error with a reasonable chance
  5701. of resyncing. However, lots of tape driver software won't allow you to
  5702. continue past a media error which should be the only reason for getting
  5703. out of sync unless a file changed sizes while you were writing the
  5704. archive.
  5705. @quotation
  5706. If anyone knows why @command{cpio} was made when @command{tar} was present
  5707. at the unix scene, please tell me about this too.
  5708. @end quotation
  5709. Probably because it is more media efficient (by not blocking everything
  5710. and using only the space needed for the headers where @command{tar}
  5711. always uses 512 bytes per file header) and it knows how to archive
  5712. special files.
  5713. You might want to look at the freely available alternatives. The major
  5714. ones are @command{afio}, @sc{gnu} @command{tar}, and @command{pax}, each of which
  5715. have their own extensions with some backwards compatibility.
  5716. Sparse files were @command{tar}red as sparse files (which you can easily
  5717. test, because the resulting archive gets smaller, and @sc{gnu} @command{cpio}
  5718. can no longer read it).
  5719. @node Media
  5720. @chapter Tapes and Other Archive Media
  5721. @UNREVISED
  5722. A few special cases about tape handling warrant more detailed
  5723. description. These special cases are discussed below.
  5724. Many complexities surround the use of @command{tar} on tape drives. Since
  5725. the creation and manipulation of archives located on magnetic tape was
  5726. the original purpose of @command{tar}, it contains many features making
  5727. such manipulation easier.
  5728. Archives are usually written on dismountable media---tape cartridges,
  5729. mag tapes, or floppy disks.
  5730. The amount of data a tape or disk holds depends not only on its size,
  5731. but also on how it is formatted. A 2400 foot long reel of mag tape
  5732. holds 40 megabytes of data when formatted at 1600 bits per inch. The
  5733. physically smaller EXABYTE tape cartridge holds 2.3 gigabytes.
  5734. Magnetic media are re-usable---once the archive on a tape is no longer
  5735. needed, the archive can be erased and the tape or disk used over.
  5736. Media quality does deteriorate with use, however. Most tapes or disks
  5737. should be discarded when they begin to produce data errors. EXABYTE
  5738. tape cartridges should be discarded when they generate an @dfn{error
  5739. count} (number of non-usable bits) of more than 10k.
  5740. Magnetic media are written and erased using magnetic fields, and
  5741. should be protected from such fields to avoid damage to stored data.
  5742. Sticking a floppy disk to a filing cabinet using a magnet is probably
  5743. not a good idea.
  5744. @menu
  5745. * Device:: Device selection and switching
  5746. * Remote Tape Server::
  5747. * Common Problems and Solutions::
  5748. * Blocking:: Blocking
  5749. * Many:: Many archives on one tape
  5750. * Using Multiple Tapes:: Using Multiple Tapes
  5751. * label:: Including a Label in the Archive
  5752. * verify::
  5753. * Write Protection::
  5754. @end menu
  5755. @node Device
  5756. @section Device Selection and Switching
  5757. @UNREVISED
  5758. @table @kbd
  5759. @item -f [@var{hostname}:]@var{file}
  5760. @itemx --file=[@var{hostname}:]@var{file}
  5761. Use archive file or device @var{file} on @var{hostname}.
  5762. @end table
  5763. This option is used to specify the file name of the archive @command{tar}
  5764. works on.
  5765. If the file name is @samp{-}, @command{tar} reads the archive from standard
  5766. input (when listing or extracting), or writes it to standard output
  5767. (when creating). If the @samp{-} file name is given when updating an
  5768. archive, @command{tar} will read the original archive from its standard
  5769. input, and will write the entire new archive to its standard output.
  5770. If the file name contains a @samp{:}, it is interpreted as
  5771. @samp{hostname:file name}. If the @var{hostname} contains an @dfn{at}
  5772. sign (@kbd{@@}), it is treated as @samp{user@@hostname:file name}. In
  5773. either case, @command{tar} will invoke the command @command{rsh} (or
  5774. @command{remsh}) to start up an @file{/etc/rmt} on the remote machine. If
  5775. you give an alternate login name, it will be given to the @command{rsh}.
  5776. Naturally, the remote machine must have an executable @file{/etc/rmt}.
  5777. This program is free software from the University of California, and a
  5778. copy of the source code can be found with the sources for @command{tar};
  5779. it's compiled and installed by default.
  5780. If this option is not given, but the environment variable @env{TAPE} is
  5781. set, its value is used; otherwise, old versions of @command{tar} used a default
  5782. archive name (which was picked when @command{tar} was compiled). The
  5783. default is normally set up to be the @dfn{first} tape drive or other
  5784. transportable I/O medium on the system.
  5785. Starting with version 1.11.5, @sc{gnu} @command{tar} uses standard input and
  5786. standard output as the default device, and I will not try anymore
  5787. supporting automatic device detection at installation time. This was
  5788. failing really in too many cases, it was hopeless. This is now
  5789. completely left to the installer to override standard input and standard
  5790. output for default device, if this seems preferable.
  5791. Further, I think @emph{most} actual usages of @command{tar} are done with
  5792. pipes or disks, not really tapes, cartridges or diskettes.
  5793. Some users think that using standard input and output is running
  5794. after trouble. This could lead to a nasty surprise on your screen if
  5795. you forget to specify an output file name---especially if you are going
  5796. through a network or terminal server capable of buffering large amounts
  5797. of output. We had so many bug reports in that area of configuring
  5798. default tapes automatically, and so many contradicting requests, that
  5799. we finally consider the problem to be portably intractable. We could
  5800. of course use something like @samp{/dev/tape} as a default, but this
  5801. is @emph{also} running after various kind of trouble, going from hung
  5802. processes to accidental destruction of real tapes. After having seen
  5803. all this mess, using standard input and output as a default really
  5804. sounds like the only clean choice left, and a very useful one too.
  5805. @sc{gnu} @command{tar} reads and writes archive in records, I suspect this is the
  5806. main reason why block devices are preferred over character devices.
  5807. Most probably, block devices are more efficient too. The installer
  5808. could also check for @samp{DEFTAPE} in @file{<sys/mtio.h>}.
  5809. @table @kbd
  5810. @item --force-local
  5811. Archive file is local even if it contains a colon.
  5812. @item --rsh-command=@var{command}
  5813. Use remote @var{command} instead of @command{rsh}. This option exists
  5814. so that people who use something other than the standard @command{rsh}
  5815. (e.g., a Kerberized @command{rsh}) can access a remote device.
  5816. When this command is not used, the shell command found when
  5817. the @command{tar} program was installed is used instead. This is
  5818. the first found of @file{/usr/ucb/rsh}, @file{/usr/bin/remsh},
  5819. @file{/usr/bin/rsh}, @file{/usr/bsd/rsh} or @file{/usr/bin/nsh}.
  5820. The installer may have overridden this by defining the environment
  5821. variable @env{RSH} @emph{at installation time}.
  5822. @item -[0-7][lmh]
  5823. Specify drive and density.
  5824. @item -M
  5825. @itemx --multi-volume
  5826. Create/list/extract multi-volume archive.
  5827. This option causes @command{tar} to write a @dfn{multi-volume} archive---one
  5828. that may be larger than will fit on the medium used to hold it.
  5829. @xref{Multi-Volume Archives}.
  5830. @item -L @var{num}
  5831. @itemx --tape-length=@var{num}
  5832. Change tape after writing @var{num} x 1024 bytes.
  5833. This option might be useful when your tape drivers do not properly
  5834. detect end of physical tapes. By being slightly conservative on the
  5835. maximum tape length, you might avoid the problem entirely.
  5836. @item -F @var{file}
  5837. @itemx --info-script=@var{file}
  5838. @itemx --new-volume-script=@var{file}
  5839. Execute @file{file} at end of each tape. If @file{file} exits with
  5840. nonzero status, exit. This implies @value{op-multi-volume}.
  5841. @end table
  5842. @node Remote Tape Server
  5843. @section The Remote Tape Server
  5844. @cindex remote tape drive
  5845. @pindex rmt
  5846. In order to access the tape drive on a remote machine, @command{tar}
  5847. uses the remote tape server written at the University of California at
  5848. Berkeley. The remote tape server must be installed as @file{/etc/rmt}
  5849. on any machine whose tape drive you want to use. @command{tar} calls
  5850. @file{/etc/rmt} by running an @command{rsh} or @command{remsh} to the remote
  5851. machine, optionally using a different login name if one is supplied.
  5852. A copy of the source for the remote tape server is provided. It is
  5853. Copyright @copyright{} 1983 by the Regents of the University of
  5854. California, but can be freely distributed. Instructions for compiling
  5855. and installing it are included in the @file{Makefile}.
  5856. @cindex absolute file names
  5857. Unless you use the @value{op-absolute-names} option, @sc{gnu} @command{tar} will
  5858. not allow you to create an archive that contains absolute file names
  5859. (a file name beginning with @samp{/}.) If you try, @command{tar} will
  5860. automatically remove the leading @samp{/} from the file names it
  5861. stores in the archive. It will also type a warning message telling
  5862. you what it is doing.
  5863. When reading an archive that was created with a different @command{tar}
  5864. program, @sc{gnu} @command{tar} automatically extracts entries in the archive
  5865. which have absolute file names as if the file names were not absolute.
  5866. This is an important feature. A visitor here once gave a
  5867. @command{tar} tape to an operator to restore; the operator used Sun @command{tar}
  5868. instead of @sc{gnu} @command{tar}, and the result was that it replaced large
  5869. portions of our @file{/bin} and friends with versions from the tape;
  5870. needless to say, we were unhappy about having to recover the file system
  5871. from backup tapes.
  5872. For example, if the archive contained a file @file{/usr/bin/computoy},
  5873. @sc{gnu} @command{tar} would extract the file to @file{usr/bin/computoy},
  5874. relative to the current directory. If you want to extract the files in
  5875. an archive to the same absolute names that they had when the archive
  5876. was created, you should do a @samp{cd /} before extracting the files
  5877. from the archive, or you should either use the @value{op-absolute-names}
  5878. option, or use the command @samp{tar -C / @dots{}}.
  5879. @cindex Ultrix 3.1 and write failure
  5880. Some versions of Unix (Ultrix 3.1 is know to have this problem),
  5881. can claim that a short write near the end of a tape succeeded,
  5882. when it actually failed. This will result in the -M option not
  5883. working correctly. The best workaround at the moment is to use a
  5884. significantly larger blocking factor than the default 20.
  5885. In order to update an archive, @command{tar} must be able to backspace the
  5886. archive in order to reread or rewrite a record that was just read (or
  5887. written). This is currently possible only on two kinds of files: normal
  5888. disk files (or any other file that can be backspaced with @samp{lseek}),
  5889. and industry-standard 9-track magnetic tape (or any other kind of tape
  5890. that can be backspaced with the @code{MTIOCTOP} @code{ioctl}.
  5891. This means that the @value{op-append}, @value{op-update},
  5892. @value{op-concatenate}, and @value{op-delete} commands will not work on any
  5893. other kind of file. Some media simply cannot be backspaced, which
  5894. means these commands and options will never be able to work on them.
  5895. These non-backspacing media include pipes and cartridge tape drives.
  5896. Some other media can be backspaced, and @command{tar} will work on them
  5897. once @command{tar} is modified to do so.
  5898. Archives created with the @value{op-multi-volume}, @value{op-label}, and
  5899. @value{op-incremental} options may not be readable by other version
  5900. of @command{tar}. In particular, restoring a file that was split over
  5901. a volume boundary will require some careful work with @command{dd}, if
  5902. it can be done at all. Other versions of @command{tar} may also create
  5903. an empty file whose name is that of the volume header. Some versions
  5904. of @command{tar} may create normal files instead of directories archived
  5905. with the @value{op-incremental} option.
  5906. @node Common Problems and Solutions
  5907. @section Some Common Problems and their Solutions
  5908. @ifclear PUBLISH
  5909. @format
  5910. errors from system:
  5911. permission denied
  5912. no such file or directory
  5913. not owner
  5914. errors from @command{tar}:
  5915. directory checksum error
  5916. header format error
  5917. errors from media/system:
  5918. i/o error
  5919. device busy
  5920. @end format
  5921. @end ifclear
  5922. @node Blocking
  5923. @section Blocking
  5924. @UNREVISED
  5925. @dfn{Block} and @dfn{record} terminology is rather confused, and it
  5926. is also confusing to the expert reader. On the other hand, readers
  5927. who are new to the field have a fresh mind, and they may safely skip
  5928. the next two paragraphs, as the remainder of this manual uses those
  5929. two terms in a quite consistent way.
  5930. John Gilmore, the writer of the public domain @command{tar} from which
  5931. @sc{gnu} @command{tar} was originally derived, wrote (June 1995):
  5932. @quotation
  5933. The nomenclature of tape drives comes from IBM, where I believe
  5934. they were invented for the IBM 650 or so. On IBM mainframes, what
  5935. is recorded on tape are tape blocks. The logical organization of
  5936. data is into records. There are various ways of putting records into
  5937. blocks, including @code{F} (fixed sized records), @code{V} (variable
  5938. sized records), @code{FB} (fixed blocked: fixed size records, @var{n}
  5939. to a block), @code{VB} (variable size records, @var{n} to a block),
  5940. @code{VSB} (variable spanned blocked: variable sized records that can
  5941. occupy more than one block), etc. The @code{JCL} @samp{DD RECFORM=}
  5942. parameter specified this to the operating system.
  5943. The Unix man page on @command{tar} was totally confused about this.
  5944. When I wrote @code{PD TAR}, I used the historically correct terminology
  5945. (@command{tar} writes data records, which are grouped into blocks).
  5946. It appears that the bogus terminology made it into @sc{posix} (no surprise
  5947. here), and now Fran@,{c}ois has migrated that terminology back
  5948. into the source code too.
  5949. @end quotation
  5950. The term @dfn{physical block} means the basic transfer chunk from or
  5951. to a device, after which reading or writing may stop without anything
  5952. being lost. In this manual, the term @dfn{block} usually refers to
  5953. a disk physical block, @emph{assuming} that each disk block is 512
  5954. bytes in length. It is true that some disk devices have different
  5955. physical blocks, but @command{tar} ignore these differences in its own
  5956. format, which is meant to be portable, so a @command{tar} block is always
  5957. 512 bytes in length, and @dfn{block} always mean a @command{tar} block.
  5958. The term @dfn{logical block} often represents the basic chunk of
  5959. allocation of many disk blocks as a single entity, which the operating
  5960. system treats somewhat atomically; this concept is only barely used
  5961. in @sc{gnu} @command{tar}.
  5962. The term @dfn{physical record} is another way to speak of a physical
  5963. block, those two terms are somewhat interchangeable. In this manual,
  5964. the term @dfn{record} usually refers to a tape physical block,
  5965. @emph{assuming} that the @command{tar} archive is kept on magnetic tape.
  5966. It is true that archives may be put on disk or used with pipes,
  5967. but nevertheless, @command{tar} tries to read and write the archive one
  5968. @dfn{record} at a time, whatever the medium in use. One record is made
  5969. up of an integral number of blocks, and this operation of putting many
  5970. disk blocks into a single tape block is called @dfn{reblocking}, or
  5971. more simply, @dfn{blocking}. The term @dfn{logical record} refers to
  5972. the logical organization of many characters into something meaningful
  5973. to the application. The term @dfn{unit record} describes a small set
  5974. of characters which are transmitted whole to or by the application,
  5975. and often refers to a line of text. Those two last terms are unrelated
  5976. to what we call a @dfn{record} in @sc{gnu} @command{tar}.
  5977. When writing to tapes, @command{tar} writes the contents of the archive
  5978. in chunks known as @dfn{records}. To change the default blocking
  5979. factor, use the @value{op-blocking-factor} option. Each record will
  5980. then be composed of @var{512-size} blocks. (Each @command{tar} block is
  5981. 512 bytes. @xref{Standard}.) Each file written to the archive uses
  5982. at least one full record. As a result, using a larger record size
  5983. can result in more wasted space for small files. On the other hand, a
  5984. larger record size can often be read and written much more efficiently.
  5985. Further complicating the problem is that some tape drives ignore the
  5986. blocking entirely. For these, a larger record size can still improve
  5987. performance (because the software layers above the tape drive still
  5988. honor the blocking), but not as dramatically as on tape drives that
  5989. honor blocking.
  5990. When reading an archive, @command{tar} can usually figure out the record
  5991. size on itself. When this is the case, and a non-standard record size
  5992. was used when the archive was created, @command{tar} will print a message
  5993. about a non-standard blocking factor, and then operate normally. On
  5994. some tape devices, however, @command{tar} cannot figure out the record size
  5995. itself. On most of those, you can specify a blocking factor (with
  5996. @value{op-blocking-factor}) larger than the actual blocking factor, and then use
  5997. the @value{op-read-full-records} option. (If you specify a blocking factor
  5998. with @value{op-blocking-factor} and don't use the @value{op-read-full-records}
  5999. option, then @command{tar} will not attempt to figure out the recording size
  6000. itself.) On some devices, you must always specify the record size
  6001. exactly with @value{op-blocking-factor} when reading, because @command{tar} cannot
  6002. figure it out. In any case, use @value{op-list} before doing any
  6003. extractions to see whether @command{tar} is reading the archive correctly.
  6004. @command{tar} blocks are all fixed size (512 bytes), and its scheme for
  6005. putting them into records is to put a whole number of them (one or
  6006. more) into each record. @command{tar} records are all the same size;
  6007. at the end of the file there's a block containing all zeros, which
  6008. is how you tell that the remainder of the last record(s) are garbage.
  6009. In a standard @command{tar} file (no options), the block size is 512
  6010. and the record size is 10240, for a blocking factor of 20. What the
  6011. @value{op-blocking-factor} option does is sets the blocking factor,
  6012. changing the record size while leaving the block size at 512 bytes.
  6013. 20 was fine for ancient 800 or 1600 bpi reel-to-reel tape drives;
  6014. most tape drives these days prefer much bigger records in order to
  6015. stream and not waste tape. When writing tapes for myself, some tend
  6016. to use a factor of the order of 2048, say, giving a record size of
  6017. around one megabyte.
  6018. If you use a blocking factor larger than 20, older @command{tar} programs
  6019. might not be able to read the archive, so we recommend this as a limit
  6020. to use in practice. @sc{gnu} @command{tar}, however, will support arbitrarily
  6021. large record sizes, limited only by the amount of virtual memory or the
  6022. physical characteristics of the tape device.
  6023. @menu
  6024. * Format Variations:: Format Variations
  6025. * Blocking Factor:: The Blocking Factor of an Archive
  6026. @end menu
  6027. @node Format Variations
  6028. @subsection Format Variations
  6029. @cindex Format Parameters
  6030. @cindex Format Options
  6031. @cindex Options, archive format specifying
  6032. @cindex Options, format specifying
  6033. @UNREVISED
  6034. Format parameters specify how an archive is written on the archive
  6035. media. The best choice of format parameters will vary depending on
  6036. the type and number of files being archived, and on the media used to
  6037. store the archive.
  6038. To specify format parameters when accessing or creating an archive,
  6039. you can use the options described in the following sections.
  6040. If you do not specify any format parameters, @command{tar} uses
  6041. default parameters. You cannot modify a compressed archive.
  6042. If you create an archive with the @value{op-blocking-factor} option
  6043. specified (@value{pxref-blocking-factor}), you must specify that
  6044. blocking-factor when operating on the archive. @xref{Formats}, for other
  6045. examples of format parameter considerations.
  6046. @node Blocking Factor
  6047. @subsection The Blocking Factor of an Archive
  6048. @cindex Blocking Factor
  6049. @cindex Record Size
  6050. @cindex Number of blocks per record
  6051. @cindex Number of bytes per record
  6052. @cindex Bytes per record
  6053. @cindex Blocks per record
  6054. @UNREVISED
  6055. The data in an archive is grouped into blocks, which are 512 bytes.
  6056. Blocks are read and written in whole number multiples called
  6057. @dfn{records}. The number of blocks in a record (ie. the size of a
  6058. record in units of 512 bytes) is called the @dfn{blocking factor}.
  6059. The @value{op-blocking-factor} option specifies the blocking factor of
  6060. an archive. The default blocking factor is typically 20 (ie.@:
  6061. 10240 bytes), but can be specified at installation. To find out
  6062. the blocking factor of an existing archive, use @samp{tar --list
  6063. --file=@var{archive-name}}. This may not work on some devices.
  6064. Records are separated by gaps, which waste space on the archive media.
  6065. If you are archiving on magnetic tape, using a larger blocking factor
  6066. (and therefore larger records) provides faster throughput and allows you
  6067. to fit more data on a tape (because there are fewer gaps). If you are
  6068. archiving on cartridge, a very large blocking factor (say 126 or more)
  6069. greatly increases performance. A smaller blocking factor, on the other
  6070. hand, may be useful when archiving small files, to avoid archiving lots
  6071. of nulls as @command{tar} fills out the archive to the end of the record.
  6072. In general, the ideal record size depends on the size of the
  6073. inter-record gaps on the tape you are using, and the average size of the
  6074. files you are archiving. @xref{create}, for information on
  6075. writing archives.
  6076. @FIXME{Need example of using a cartridge with blocking factor=126 or more.}
  6077. Archives with blocking factors larger than 20 cannot be read
  6078. by very old versions of @command{tar}, or by some newer versions
  6079. of @command{tar} running on old machines with small address spaces.
  6080. With @sc{gnu} @command{tar}, the blocking factor of an archive is limited
  6081. only by the maximum record size of the device containing the archive,
  6082. or by the amount of available virtual memory.
  6083. Also, on some systems, not using adequate blocking factors, as sometimes
  6084. imposed by the device drivers, may yield unexpected diagnostics. For
  6085. example, this has been reported:
  6086. @example
  6087. Cannot write to /dev/dlt: Invalid argument
  6088. @end example
  6089. @noindent
  6090. In such cases, it sometimes happen that the @command{tar} bundled by the
  6091. system is aware of block size idiosyncrasies, while @sc{gnu} @command{tar} requires
  6092. an explicit specification for the block size, which it cannot guess.
  6093. This yields some people to consider @sc{gnu} @command{tar} is misbehaving, because
  6094. by comparison, @cite{the bundle @command{tar} works OK}. Adding @w{@kbd{-b
  6095. 256}}, for example, might resolve the problem.
  6096. If you use a non-default blocking factor when you create an archive, you
  6097. must specify the same blocking factor when you modify that archive. Some
  6098. archive devices will also require you to specify the blocking factor when
  6099. reading that archive, however this is not typically the case. Usually, you
  6100. can use @value{op-list} without specifying a blocking factor---@command{tar}
  6101. reports a non-default record size and then lists the archive members as
  6102. it would normally. To extract files from an archive with a non-standard
  6103. blocking factor (particularly if you're not sure what the blocking factor
  6104. is), you can usually use the @value{op-read-full-records} option while
  6105. specifying a blocking factor larger then the blocking factor of the archive
  6106. (ie. @samp{tar --extract --read-full-records --blocking-factor=300}.
  6107. @xref{list}, for more information on the @value{op-list}
  6108. operation. @xref{Reading}, for a more detailed explanation of that option.
  6109. @table @kbd
  6110. @item --blocking-factor=@var{number}
  6111. @itemx -b @var{number}
  6112. Specifies the blocking factor of an archive. Can be used with any
  6113. operation, but is usually not necessary with @value{op-list}.
  6114. @end table
  6115. Device blocking
  6116. @table @kbd
  6117. @item -b @var{blocks}
  6118. @itemx --blocking-factor=@var{blocks}
  6119. Set record size to @math{@var{blocks} * 512} bytes.
  6120. This option is used to specify a @dfn{blocking factor} for the archive.
  6121. When reading or writing the archive, @command{tar}, will do reads and writes
  6122. of the archive in records of @math{@var{block}*512} bytes. This is true
  6123. even when the archive is compressed. Some devices requires that all
  6124. write operations be a multiple of a certain size, and so, @command{tar}
  6125. pads the archive out to the next record boundary.
  6126. The default blocking factor is set when @command{tar} is compiled, and is
  6127. typically 20. Blocking factors larger than 20 cannot be read by very
  6128. old versions of @command{tar}, or by some newer versions of @command{tar}
  6129. running on old machines with small address spaces.
  6130. With a magnetic tape, larger records give faster throughput and fit
  6131. more data on a tape (because there are fewer inter-record gaps).
  6132. If the archive is in a disk file or a pipe, you may want to specify
  6133. a smaller blocking factor, since a large one will result in a large
  6134. number of null bytes at the end of the archive.
  6135. When writing cartridge or other streaming tapes, a much larger
  6136. blocking factor (say 126 or more) will greatly increase performance.
  6137. However, you must specify the same blocking factor when reading or
  6138. updating the archive.
  6139. Apparently, Exabyte drives have a physical block size of 8K bytes.
  6140. If we choose our blocksize as a multiple of 8k bytes, then the problem
  6141. seems to dissapper. Id est, we are using block size of 112 right
  6142. now, and we haven't had the problem since we switched@dots{}
  6143. With @sc{gnu} @command{tar} the blocking factor is limited only by the maximum
  6144. record size of the device containing the archive, or by the amount of
  6145. available virtual memory.
  6146. However, deblocking or reblocking is virtually avoided in a special
  6147. case which often occurs in practice, but which requires all the
  6148. following conditions to be simultaneously true:
  6149. @itemize @bullet
  6150. @item
  6151. the archive is subject to a compression option,
  6152. @item
  6153. the archive is not handled through standard input or output, nor
  6154. redirected nor piped,
  6155. @item
  6156. the archive is directly handled to a local disk, instead of any special
  6157. device,
  6158. @item
  6159. @value{op-blocking-factor} is not explicitly specified on the @command{tar}
  6160. invocation.
  6161. @end itemize
  6162. In previous versions of @sc{gnu} @command{tar}, the @samp{--compress-block}
  6163. option (or even older: @samp{--block-compress}) was necessary to
  6164. reblock compressed archives. It is now a dummy option just asking
  6165. not to be used, and otherwise ignored. If the output goes directly
  6166. to a local disk, and not through stdout, then the last write is
  6167. not extended to a full record size. Otherwise, reblocking occurs.
  6168. Here are a few other remarks on this topic:
  6169. @itemize @bullet
  6170. @item
  6171. @command{gzip} will complain about trailing garbage if asked to
  6172. uncompress a compressed archive on tape, there is an option to turn
  6173. the message off, but it breaks the regularity of simply having to use
  6174. @samp{@var{prog} -d} for decompression. It would be nice if gzip was
  6175. silently ignoring any number of trailing zeros. I'll ask Jean-loup
  6176. Gailly, by sending a copy of this message to him.
  6177. @item
  6178. @command{compress} does not show this problem, but as Jean-loup pointed
  6179. out to Michael, @samp{compress -d} silently adds garbage after
  6180. the result of decompression, which tar ignores because it already
  6181. recognized its end-of-file indicator. So this bug may be safely
  6182. ignored.
  6183. @item
  6184. @samp{gzip -d -q} will be silent about the trailing zeros indeed,
  6185. but will still return an exit status of 2 which tar reports in turn.
  6186. @command{tar} might ignore the exit status returned, but I hate doing
  6187. that, as it weakens the protection @command{tar} offers users against
  6188. other possible problems at decompression time. If @command{gzip} was
  6189. silently skipping trailing zeros @emph{and} also avoiding setting the
  6190. exit status in this innocuous case, that would solve this situation.
  6191. @item
  6192. @command{tar} should become more solid at not stopping to read a pipe at
  6193. the first null block encountered. This inelegantly breaks the pipe.
  6194. @command{tar} should rather drain the pipe out before exiting itself.
  6195. @end itemize
  6196. @item -i
  6197. @itemx --ignore-zeros
  6198. Ignore blocks of zeros in archive (means EOF).
  6199. The @value{op-ignore-zeros} option causes @command{tar} to ignore blocks
  6200. of zeros in the archive. Normally a block of zeros indicates the
  6201. end of the archive, but when reading a damaged archive, or one which
  6202. was created by concatenating several archives together, this option
  6203. allows @command{tar} to read the entire archive. This option is not on
  6204. by default because many versions of @command{tar} write garbage after
  6205. the zeroed blocks.
  6206. Note that this option causes @command{tar} to read to the end of the
  6207. archive file, which may sometimes avoid problems when multiple files
  6208. are stored on a single physical tape.
  6209. @item -B
  6210. @itemx --read-full-records
  6211. Reblock as we read (for reading 4.2BSD pipes).
  6212. If @value{op-read-full-records} is used, @command{tar} will not panic if an
  6213. attempt to read a record from the archive does not return a full record.
  6214. Instead, @command{tar} will keep reading until it has obtained a full
  6215. record.
  6216. This option is turned on by default when @command{tar} is reading
  6217. an archive from standard input, or from a remote machine. This is
  6218. because on BSD Unix systems, a read of a pipe will return however
  6219. much happens to be in the pipe, even if it is less than @command{tar}
  6220. requested. If this option was not used, @command{tar} would fail as
  6221. soon as it read an incomplete record from the pipe.
  6222. This option is also useful with the commands for updating an archive.
  6223. @end table
  6224. Tape blocking
  6225. @FIXME{Appropriate options should be moved here from elsewhere.}
  6226. @cindex blocking factor
  6227. @cindex tape blocking
  6228. When handling various tapes or cartridges, you have to take care of
  6229. selecting a proper blocking, that is, the number of disk blocks you
  6230. put together as a single tape block on the tape, without intervening
  6231. tape gaps. A @dfn{tape gap} is a small landing area on the tape
  6232. with no information on it, used for decelerating the tape to a
  6233. full stop, and for later regaining the reading or writing speed.
  6234. When the tape driver starts reading a record, the record has to
  6235. be read whole without stopping, as a tape gap is needed to stop the
  6236. tape motion without loosing information.
  6237. @cindex Exabyte blocking
  6238. @cindex DAT blocking
  6239. Using higher blocking (putting more disk blocks per tape block) will use
  6240. the tape more efficiently as there will be less tape gaps. But reading
  6241. such tapes may be more difficult for the system, as more memory will be
  6242. required to receive at once the whole record. Further, if there is a
  6243. reading error on a huge record, this is less likely that the system will
  6244. succeed in recovering the information. So, blocking should not be too
  6245. low, nor it should be too high. @command{tar} uses by default a blocking of
  6246. 20 for historical reasons, and it does not really matter when reading or
  6247. writing to disk. Current tape technology would easily accommodate higher
  6248. blockings. Sun recommends a blocking of 126 for Exabytes and 96 for DATs.
  6249. We were told that for some DLT drives, the blocking should be a multiple
  6250. of 4Kb, preferably 64Kb (@w{@kbd{-b 128}}) or 256 for decent performance.
  6251. Other manufacturers may use different recommendations for the same tapes.
  6252. This might also depends of the buffering techniques used inside modern
  6253. tape controllers. Some imposes a minimum blocking, or a maximum blocking.
  6254. Others request blocking to be some exponent of two.
  6255. So, there is no fixed rule for blocking. But blocking at read time
  6256. should ideally be the same as blocking used at write time. At one place
  6257. I know, with a wide variety of equipment, they found it best to use a
  6258. blocking of 32 to guarantee that their tapes are fully interchangeable.
  6259. I was also told that, for recycled tapes, prior erasure (by the same
  6260. drive unit that will be used to create the archives) sometimes lowers
  6261. the error rates observed at rewriting time.
  6262. I might also use @samp{--number-blocks} instead of
  6263. @samp{--block-number}, so @samp{--block} will then expand to
  6264. @samp{--blocking-factor} unambiguously.
  6265. @node Many
  6266. @section Many Archives on One Tape
  6267. @FIXME{Appropriate options should be moved here from elsewhere.}
  6268. @findex ntape @r{device}
  6269. Most tape devices have two entries in the @file{/dev} directory, or
  6270. entries that come in pairs, which differ only in the minor number for
  6271. this device. Let's take for example @file{/dev/tape}, which often
  6272. points to the only or usual tape device of a given system. There might
  6273. be a corresponding @file{/dev/nrtape} or @file{/dev/ntape}. The simpler
  6274. name is the @emph{rewinding} version of the device, while the name
  6275. having @samp{nr} in it is the @emph{no rewinding} version of the same
  6276. device.
  6277. A rewinding tape device will bring back the tape to its beginning point
  6278. automatically when this device is opened or closed. Since @command{tar}
  6279. opens the archive file before using it and closes it afterwards, this
  6280. means that a simple:
  6281. @example
  6282. $ @kbd{tar cf /dev/tape @var{directory}}
  6283. @end example
  6284. @noindent
  6285. will reposition the tape to its beginning both prior and after saving
  6286. @var{directory} contents to it, thus erasing prior tape contents and
  6287. making it so that any subsequent write operation will destroy what has
  6288. just been saved.
  6289. @cindex tape positioning
  6290. So, a rewinding device is normally meant to hold one and only one file.
  6291. If you want to put more than one @command{tar} archive on a given tape, you
  6292. will need to avoid using the rewinding version of the tape device. You
  6293. will also have to pay special attention to tape positioning. Errors in
  6294. positioning may overwrite the valuable data already on your tape. Many
  6295. people, burnt by past experiences, will only use rewinding devices and
  6296. limit themselves to one file per tape, precisely to avoid the risk of
  6297. such errors. Be fully aware that writing at the wrong position on a
  6298. tape loses all information past this point and most probably until the
  6299. end of the tape, and this destroyed information @emph{cannot} be
  6300. recovered.
  6301. To save @var{directory-1} as a first archive at the beginning of a
  6302. tape, and leave that tape ready for a second archive, you should use:
  6303. @example
  6304. $ @kbd{mt -f /dev/nrtape rewind}
  6305. $ @kbd{tar cf /dev/nrtape @var{directory-1}}
  6306. @end example
  6307. @cindex tape marks
  6308. @dfn{Tape marks} are special magnetic patterns written on the tape
  6309. media, which are later recognizable by the reading hardware. These
  6310. marks are used after each file, when there are many on a single tape.
  6311. An empty file (that is to say, two tape marks in a row) signal the
  6312. logical end of the tape, after which no file exist. Usually,
  6313. non-rewinding tape device drivers will react to the close request issued
  6314. by @command{tar} by first writing two tape marks after your archive, and by
  6315. backspacing over one of these. So, if you remove the tape at that time
  6316. from the tape drive, it is properly terminated. But if you write
  6317. another file at the current position, the second tape mark will be
  6318. erased by the new information, leaving only one tape mark between files.
  6319. So, you may now save @var{directory-2} as a second archive after the
  6320. first on the same tape by issuing the command:
  6321. @example
  6322. $ @kbd{tar cf /dev/nrtape @var{directory-2}}
  6323. @end example
  6324. @noindent
  6325. and so on for all the archives you want to put on the same tape.
  6326. Another usual case is that you do not write all the archives the same
  6327. day, and you need to remove and store the tape between two archive
  6328. sessions. In general, you must remember how many files are already
  6329. saved on your tape. Suppose your tape already has 16 files on it, and
  6330. that you are ready to write the 17th. You have to take care of skipping
  6331. the first 16 tape marks before saving @var{directory-17}, say, by using
  6332. these commands:
  6333. @example
  6334. $ @kbd{mt -f /dev/nrtape rewind}
  6335. $ @kbd{mt -f /dev/nrtape fsf 16}
  6336. $ @kbd{tar cf /dev/nrtape @var{directory-17}}
  6337. @end example
  6338. In all the previous examples, we put aside blocking considerations, but
  6339. you should do the proper things for that as well. @xref{Blocking}.
  6340. @menu
  6341. * Tape Positioning:: Tape Positions and Tape Marks
  6342. * mt:: The @command{mt} Utility
  6343. @end menu
  6344. @node Tape Positioning
  6345. @subsection Tape Positions and Tape Marks
  6346. @UNREVISED
  6347. Just as archives can store more than one file from the file system,
  6348. tapes can store more than one archive file. To keep track of where
  6349. archive files (or any other type of file stored on tape) begin and
  6350. end, tape archive devices write magnetic @dfn{tape marks} on the
  6351. archive media. Tape drives write one tape mark between files,
  6352. two at the end of all the file entries.
  6353. If you think of data as a series of records "rrrr"'s, and tape marks as
  6354. "*"'s, a tape might look like the following:
  6355. @example
  6356. rrrr*rrrrrr*rrrrr*rr*rrrrr**-------------------------
  6357. @end example
  6358. Tape devices read and write tapes using a read/write @dfn{tape
  6359. head}---a physical part of the device which can only access one
  6360. point on the tape at a time. When you use @command{tar} to read or
  6361. write archive data from a tape device, the device will begin reading
  6362. or writing from wherever on the tape the tape head happens to be,
  6363. regardless of which archive or what part of the archive the tape
  6364. head is on. Before writing an archive, you should make sure that no
  6365. data on the tape will be overwritten (unless it is no longer needed).
  6366. Before reading an archive, you should make sure the tape head is at
  6367. the beginning of the archive you want to read. (The @code{restore}
  6368. script will find the archive automatically. @FIXME{There is no such
  6369. restore script!}@FIXME-xref{Scripted Restoration}@xref{mt}, for
  6370. an explanation of the tape moving utility.
  6371. If you want to add new archive file entries to a tape, you should
  6372. advance the tape to the end of the existing file entries, backspace
  6373. over the last tape mark, and write the new archive file. If you were
  6374. to add two archives to the example above, the tape might look like the
  6375. following:
  6376. @example
  6377. rrrr*rrrrrr*rrrrr*rr*rrrrr*rrr*rrrr**----------------
  6378. @end example
  6379. @node mt
  6380. @subsection The @command{mt} Utility
  6381. @UNREVISED
  6382. @FIXME{Is it true that this only works on non-block devices?
  6383. should explain the difference, (fixed or variable).}
  6384. @value{xref-blocking-factor}.
  6385. You can use the @command{mt} utility to advance or rewind a tape past a
  6386. specified number of archive files on the tape. This will allow you
  6387. to move to the beginning of an archive before extracting or reading
  6388. it, or to the end of all the archives before writing a new one.
  6389. @FIXME{Why isn't there an "advance 'til you find two tape marks
  6390. together"?}
  6391. The syntax of the @command{mt} command is:
  6392. @example
  6393. @kbd{mt [-f @var{tapename}] @var{operation} [@var{number}]}
  6394. @end example
  6395. where @var{tapename} is the name of the tape device, @var{number} is
  6396. the number of times an operation is performed (with a default of one),
  6397. and @var{operation} is one of the following:
  6398. @FIXME{is there any use for record operations?}
  6399. @table @kbd
  6400. @item eof
  6401. @itemx weof
  6402. Writes @var{number} tape marks at the current position on the tape.
  6403. @item fsf
  6404. Moves tape position forward @var{number} files.
  6405. @item bsf
  6406. Moves tape position back @var{number} files.
  6407. @item rewind
  6408. Rewinds the tape. (Ignores @var{number}).
  6409. @item offline
  6410. @itemx rewoff1
  6411. Rewinds the tape and takes the tape device off-line. (Ignores @var{number}).
  6412. @item status
  6413. Prints status information about the tape unit.
  6414. @end table
  6415. @FIXME{Is there a better way to frob the spacing on the list?}
  6416. If you don't specify a @var{tapename}, @command{mt} uses the environment
  6417. variable @env{TAPE}; if @env{TAPE} is not set, @command{mt} uses the device
  6418. @file{/dev/rmt12}.
  6419. @command{mt} returns a 0 exit status when the operation(s) were
  6420. successful, 1 if the command was unrecognized, and 2 if an operation
  6421. failed.
  6422. @FIXME{New node on how to find an archive?}
  6423. If you use @value{op-extract} with the @value{op-label} option specified,
  6424. @command{tar} will read an archive label (the tape head has to be positioned
  6425. on it) and print an error if the archive label doesn't match the
  6426. @var{archive-name} specified. @var{archive-name} can be any regular
  6427. expression. If the labels match, @command{tar} extracts the archive.
  6428. @value{xref-label}.
  6429. @FIXME-xref{Matching Format Parameters}@FIXME{fix cross
  6430. references}@samp{tar --list --label} will cause @command{tar} to print the
  6431. label.
  6432. @FIXME{Program to list all the labels on a tape?}
  6433. @node Using Multiple Tapes
  6434. @section Using Multiple Tapes
  6435. @UNREVISED
  6436. Often you might want to write a large archive, one larger than will fit
  6437. on the actual tape you are using. In such a case, you can run multiple
  6438. @command{tar} commands, but this can be inconvenient, particularly if you
  6439. are using options like @value{op-exclude} or dumping entire filesystems.
  6440. Therefore, @command{tar} supports multiple tapes automatically.
  6441. Use @value{op-multi-volume} on the command line, and then @command{tar} will,
  6442. when it reaches the end of the tape, prompt for another tape, and
  6443. continue the archive. Each tape will have an independent archive, and
  6444. can be read without needing the other. (As an exception to this, the
  6445. file that @command{tar} was archiving when it ran out of tape will usually
  6446. be split between the two archives; in this case you need to extract from
  6447. the first archive, using @value{op-multi-volume}, and then put in the
  6448. second tape when prompted, so @command{tar} can restore both halves of the
  6449. file.)
  6450. @sc{gnu} @command{tar} multi-volume archives do not use a truly portable format.
  6451. You need @sc{gnu} @command{tar} at both end to process them properly.
  6452. When prompting for a new tape, @command{tar} accepts any of the following
  6453. responses:
  6454. @table @kbd
  6455. @item ?
  6456. Request @command{tar} to explain possible responses
  6457. @item q
  6458. Request @command{tar} to exit immediately.
  6459. @item n @var{file name}
  6460. Request @command{tar} to write the next volume on the file @var{file name}.
  6461. @item !
  6462. Request @command{tar} to run a subshell.
  6463. @item y
  6464. Request @command{tar} to begin writing the next volume.
  6465. @end table
  6466. (You should only type @samp{y} after you have changed the tape;
  6467. otherwise @command{tar} will write over the volume it just finished.)
  6468. If you want more elaborate behavior than this, give @command{tar} the
  6469. @value{op-info-script} option. The file @var{script-name} is expected
  6470. to be a program (or shell script) to be run instead of the normal
  6471. prompting procedure. If the program fails, @command{tar} exits;
  6472. otherwise, @command{tar} begins writing the next volume. The behavior
  6473. of the
  6474. @samp{n} response to the normal tape-change prompt is not available
  6475. if you use @value{op-info-script}.
  6476. The method @command{tar} uses to detect end of tape is not perfect, and
  6477. fails on some operating systems or on some devices. You can use the
  6478. @value{op-tape-length} option if @command{tar} can't detect the end of the
  6479. tape itself. This option selects @value{op-multi-volume} automatically.
  6480. The @var{size} argument should then be the usable size of the tape.
  6481. But for many devices, and floppy disks in particular, this option is
  6482. never required for real, as far as we know.
  6483. The volume number used by @command{tar} in its tape-change prompt
  6484. can be changed; if you give the @value{op-volno-file} option, then
  6485. @var{file-of-number} should be an unexisting file to be created, or else,
  6486. a file already containing a decimal number. That number will be used
  6487. as the volume number of the first volume written. When @command{tar} is
  6488. finished, it will rewrite the file with the now-current volume number.
  6489. (This does not change the volume number written on a tape label, as
  6490. per @value{ref-label}, it @emph{only} affects the number used in
  6491. the prompt.)
  6492. If you want @command{tar} to cycle through a series of tape drives, then
  6493. you can use the @samp{n} response to the tape-change prompt. This is
  6494. error prone, however, and doesn't work at all with @value{op-info-script}.
  6495. Therefore, if you give @command{tar} multiple @value{op-file} options, then
  6496. the specified files will be used, in sequence, as the successive volumes
  6497. of the archive. Only when the first one in the sequence needs to be
  6498. used again will @command{tar} prompt for a tape change (or run the info
  6499. script).
  6500. Multi-volume archives
  6501. With @value{op-multi-volume}, @command{tar} will not abort when it cannot
  6502. read or write any more data. Instead, it will ask you to prepare a new
  6503. volume. If the archive is on a magnetic tape, you should change tapes
  6504. now; if the archive is on a floppy disk, you should change disks, etc.
  6505. Each volume of a multi-volume archive is an independent @command{tar}
  6506. archive, complete in itself. For example, you can list or extract any
  6507. volume alone; just don't specify @value{op-multi-volume}. However, if one
  6508. file in the archive is split across volumes, the only way to extract
  6509. it successfully is with a multi-volume extract command @samp{--extract
  6510. --multi-volume} (@samp{-xM}) starting on or before the volume where
  6511. the file begins.
  6512. For example, let's presume someone has two tape drives on a system
  6513. named @file{/dev/tape0} and @file{/dev/tape1}. For having @sc{gnu}
  6514. @command{tar} to switch to the second drive when it needs to write the
  6515. second tape, and then back to the first tape, etc., just do either of:
  6516. @smallexample
  6517. $ @kbd{tar --create --multi-volume --file=/dev/tape0 --file=/dev/tape1 @var{files}}
  6518. $ @kbd{tar cMff /dev/tape0 /dev/tape1 @var{files}}
  6519. @end smallexample
  6520. @menu
  6521. * Multi-Volume Archives:: Archives Longer than One Tape or Disk
  6522. * Tape Files:: Tape Files
  6523. @end menu
  6524. @node Multi-Volume Archives
  6525. @subsection Archives Longer than One Tape or Disk
  6526. @cindex Multi-volume archives
  6527. @UNREVISED
  6528. To create an archive that is larger than will fit on a single unit of
  6529. the media, use the @value{op-multi-volume} option in conjunction with
  6530. the @value{op-create} option (@pxref{create}). A
  6531. @dfn{multi-volume} archive can be manipulated like any other archive
  6532. (provided the @value{op-multi-volume} option is specified), but is
  6533. stored on more than one tape or disk.
  6534. When you specify @value{op-multi-volume}, @command{tar} does not report an
  6535. error when it comes to the end of an archive volume (when reading), or
  6536. the end of the media (when writing). Instead, it prompts you to load
  6537. a new storage volume. If the archive is on a magnetic tape, you
  6538. should change tapes when you see the prompt; if the archive is on a
  6539. floppy disk, you should change disks; etc.
  6540. You can read each individual volume of a multi-volume archive as if it
  6541. were an archive by itself. For example, to list the contents of one
  6542. volume, use @value{op-list}, without @value{op-multi-volume} specified.
  6543. To extract an archive member from one volume (assuming it is described
  6544. that volume), use @value{op-extract}, again without
  6545. @value{op-multi-volume}.
  6546. If an archive member is split across volumes (ie. its entry begins on
  6547. one volume of the media and ends on another), you need to specify
  6548. @value{op-multi-volume} to extract it successfully. In this case, you
  6549. should load the volume where the archive member starts, and use
  6550. @samp{tar --extract --multi-volume}---@command{tar} will prompt for later
  6551. volumes as it needs them. @xref{extracting archives}, for more
  6552. information about extracting archives.
  6553. @value{op-info-script} is like @value{op-multi-volume}, except that
  6554. @command{tar} does not prompt you directly to change media volumes when
  6555. a volume is full---instead, @command{tar} runs commands you have stored
  6556. in @var{script-name}. For example, this option can be used to eject
  6557. cassettes, or to broadcast messages such as @samp{Someone please come
  6558. change my tape} when performing unattended backups. When @var{script-name}
  6559. is done, @command{tar} will assume that the media has been changed.
  6560. Multi-volume archives can be modified like any other archive. To add
  6561. files to a multi-volume archive, you need to only mount the last
  6562. volume of the archive media (and new volumes, if needed). For all
  6563. other operations, you need to use the entire archive.
  6564. If a multi-volume archive was labeled using @value{op-label}
  6565. (@value{pxref-label}) when it was created, @command{tar} will not
  6566. automatically label volumes which are added later. To label subsequent
  6567. volumes, specify @value{op-label} again in conjunction with the
  6568. @value{op-append}, @value{op-update} or @value{op-concatenate} operation.
  6569. @cindex Labeling multi-volume archives
  6570. @FIXME{example}
  6571. @FIXME{There should be a sample program here, including an exit
  6572. before end. Is the exit status even checked in tar? :-(}
  6573. @table @kbd
  6574. @item --multi-volume
  6575. @itemx -M
  6576. Creates a multi-volume archive, when used in conjunction with
  6577. @value{op-create}. To perform any other operation on a multi-volume
  6578. archive, specify @value{op-multi-volume} in conjunction with that
  6579. operation.
  6580. @item --info-script=@var{program-file}
  6581. @itemx -F @var{program-file}
  6582. Creates a multi-volume archive via a script. Used in conjunction with
  6583. @value{op-create}.
  6584. @end table
  6585. Beware that there is @emph{no} real standard about the proper way, for a
  6586. @command{tar} archive, to span volume boundaries. If you have a multi-volume
  6587. created by some vendor's @command{tar}, there is almost no chance you could
  6588. read all the volumes with @sc{gnu} @command{tar}. The converse is also true:
  6589. you may not expect multi-volume archives created by @sc{gnu} @command{tar} to
  6590. be fully recovered by vendor's @command{tar}. Since there is little chance
  6591. that, in mixed system configurations, some vendor's @command{tar} will work on
  6592. another vendor's machine, and there is a great chance that @sc{gnu} @command{tar}
  6593. will work on most of them, your best bet is to install @sc{gnu} @command{tar}
  6594. on all machines between which you know exchange of files is possible.
  6595. @node Tape Files
  6596. @subsection Tape Files
  6597. @UNREVISED
  6598. To give the archive a name which will be recorded in it, use the
  6599. @value{op-label} option. This will write a special block identifying
  6600. @var{volume-label} as the name of the archive to the front of the archive
  6601. which will be displayed when the archive is listed with @value{op-list}.
  6602. If you are creating a multi-volume archive with
  6603. @value{op-multi-volume}@FIXME-pxref{Using Multiple Tapes}, then the
  6604. volume label will have
  6605. @samp{Volume @var{nnn}} appended to the name you give, where @var{nnn} is
  6606. the number of the volume of the archive. (If you use the @value{op-label}
  6607. option when reading an archive, it checks to make sure the label on the
  6608. tape matches the one you give. @value{xref-label}.
  6609. When @command{tar} writes an archive to tape, it creates a single
  6610. tape file. If multiple archives are written to the same tape, one
  6611. after the other, they each get written as separate tape files. When
  6612. extracting, it is necessary to position the tape at the right place
  6613. before running @command{tar}. To do this, use the @command{mt} command.
  6614. For more information on the @command{mt} command and on the organization
  6615. of tapes into a sequence of tape files, see @ref{mt}.
  6616. People seem to often do:
  6617. @example
  6618. @kbd{--label="@var{some-prefix} `date +@var{some-format}`"}
  6619. @end example
  6620. or such, for pushing a common date in all volumes or an archive set.
  6621. @node label
  6622. @section Including a Label in the Archive
  6623. @cindex Labeling an archive
  6624. @cindex Labels on the archive media
  6625. @UNREVISED
  6626. @table @kbd
  6627. @item -V @var{name}
  6628. @itemx --label=@var{name}
  6629. Create archive with volume name @var{name}.
  6630. @end table
  6631. This option causes @command{tar} to write out a @dfn{volume header} at
  6632. the beginning of the archive. If @value{op-multi-volume} is used, each
  6633. volume of the archive will have a volume header of @samp{@var{name}
  6634. Volume @var{n}}, where @var{n} is 1 for the first volume, 2 for the
  6635. next, and so on.
  6636. @FIXME{Should the arg to --label be a quoted string?? No.}
  6637. To avoid problems caused by misplaced paper labels on the archive
  6638. media, you can include a @dfn{label} entry---an archive member which
  6639. contains the name of the archive---in the archive itself. Use the
  6640. @value{op-label} option in conjunction with the @value{op-create} operation
  6641. to include a label entry in the archive as it is being created.
  6642. If you create an archive using both @value{op-label} and
  6643. @value{op-multi-volume}, each volume of the archive will have an
  6644. archive label of the form @samp{@var{archive-label} Volume @var{n}},
  6645. where @var{n} is 1 for the first volume, 2 for the next, and so on.
  6646. @FIXME-xref{Multi-Volume Archives, for information on creating multiple
  6647. volume archives.}
  6648. If you list or extract an archive using @value{op-label}, @command{tar} will
  6649. print an error if the archive label doesn't match the @var{archive-label}
  6650. specified, and will then not list nor extract the archive. In those cases,
  6651. @var{archive-label} argument is interpreted as a globbing-style pattern
  6652. which must match the actual magnetic volume label. @xref{exclude}, for
  6653. a precise description of how match is attempted@footnote{Previous versions
  6654. of @command{tar} used full regular expression matching, or before that, only
  6655. exact string matching, instead of wildcard matchers. We decided for the
  6656. sake of simplicity to use a uniform matching device through @command{tar}.}.
  6657. If the switch @value{op-multi-volume} is being used, the volume label
  6658. matcher will also suffix @var{archive-label} by @w{@samp{ Volume [1-9]*}}
  6659. if the initial match fails, before giving up. Since the volume numbering
  6660. is automatically added in labels at creation time, it sounded logical to
  6661. equally help the user taking care of it when the archive is being read.
  6662. The @value{op-label} was once called @samp{--volume}, but is not available
  6663. under that name anymore.
  6664. To find out an archive's label entry (or to find out if an archive has
  6665. a label at all), use @samp{tar --list --verbose}. @command{tar} will print the
  6666. label first, and then print archive member information, as in the
  6667. example below:
  6668. @example
  6669. $ @kbd{tar --verbose --list --file=iamanarchive}
  6670. V--------- 0 0 0 1992-03-07 12:01 iamalabel--Volume Header--
  6671. -rw-rw-rw- ringo user 40 1990-05-21 13:30 iamafilename
  6672. @end example
  6673. @table @kbd
  6674. @item --label=@var{archive-label}
  6675. @itemx -V @var{archive-label}
  6676. Includes an @dfn{archive-label} at the beginning of the archive when
  6677. the archive is being created, when used in conjunction with the
  6678. @value{op-create} option. Checks to make sure the archive label
  6679. matches the one specified (when used in conjunction with the
  6680. @value{op-extract} option.
  6681. @end table
  6682. To get a common information on all tapes of a series, use the
  6683. @value{op-label} option. For having this information different in each
  6684. series created through a single script used on a regular basis, just
  6685. manage to get some date string as part of the label. For example:
  6686. @example
  6687. $ @kbd{tar cfMV /dev/tape "Daily backup for `date +%Y-%m-%d`"}
  6688. $ @kbd{tar --create --file=/dev/tape --multi-volume \
  6689. --volume="Daily backup for `date +%Y-%m-%d`"}
  6690. @end example
  6691. Also note that each label has its own date and time, which corresponds
  6692. to when @sc{gnu} @command{tar} initially attempted to write it, often soon
  6693. after the operator launches @command{tar} or types the carriage return
  6694. telling that the next tape is ready. Comparing date labels does give
  6695. an idea of tape throughput only if the delays for rewinding tapes
  6696. and the operator switching them were negligible, which is usually
  6697. not the case.
  6698. @FIXME{was --volume}
  6699. @node verify
  6700. @section Verifying Data as It is Stored
  6701. @cindex Verifying a write operation
  6702. @cindex Double-checking a write operation
  6703. @table @kbd
  6704. @item -W
  6705. @itemx --verify
  6706. Attempt to verify the archive after writing.
  6707. @end table
  6708. This option causes @command{tar} to verify the archive after writing it.
  6709. Each volume is checked after it is written, and any discrepancies
  6710. are recorded on the standard error output.
  6711. Verification requires that the archive be on a back-space-able medium.
  6712. This means pipes, some cartridge tape drives, and some other devices
  6713. cannot be verified.
  6714. You can insure the accuracy of an archive by comparing files in the
  6715. system with archive members. @command{tar} can compare an archive to the
  6716. file system as the archive is being written, to verify a write
  6717. operation, or can compare a previously written archive, to insure that
  6718. it is up to date.
  6719. To check for discrepancies in an archive immediately after it is
  6720. written, use the @value{op-verify} option in conjunction with
  6721. the @value{op-create} operation. When this option is
  6722. specified, @command{tar} checks archive members against their counterparts
  6723. in the file system, and reports discrepancies on the standard error.
  6724. To verify an archive, you must be able to read it from before the end
  6725. of the last written entry. This option is useful for detecting data
  6726. errors on some tapes. Archives written to pipes, some cartridge tape
  6727. drives, and some other devices cannot be verified.
  6728. One can explicitly compare an already made archive with the file system
  6729. by using the @value{op-compare} option, instead of using the more automatic
  6730. @value{op-verify} option. @value{xref-compare}.
  6731. Note that these two options have a slightly different intent. The
  6732. @value{op-compare} option how identical are the logical contents of some
  6733. archive with what is on your disks, while the @value{op-verify} option is
  6734. really for checking if the physical contents agree and if the recording
  6735. media itself is of dependable quality. So, for the @value{op-verify}
  6736. operation, @command{tar} tries to defeat all in-memory cache pertaining to
  6737. the archive, while it lets the speed optimization undisturbed for the
  6738. @value{op-compare} option. If you nevertheless use @value{op-compare} for
  6739. media verification, you may have to defeat the in-memory cache yourself,
  6740. maybe by opening and reclosing the door latch of your recording unit,
  6741. forcing some doubt in your operating system about the fact this is really
  6742. the same volume as the one just written or read.
  6743. The @value{op-verify} option would not be necessary if drivers were indeed
  6744. able to detect dependably all write failures. This sometimes require many
  6745. magnetic heads, some able to read after the writes occurred. One would
  6746. not say that drivers unable to detect all cases are necessarily flawed,
  6747. as long as programming is concerned.
  6748. The @value{op-verify} option will not work in conjunction with the
  6749. @value{op-multi-volume} option or the @value{op-append},
  6750. @value{op-update} and @value{op-delete} operations. @xref{Operations},
  6751. for more information on these operations.
  6752. Also, since @command{tar} normally strips leading @samp{/} from file
  6753. names (@pxref{absolute}), a command like @samp{tar --verify -cf
  6754. /tmp/foo.tar /etc} will work as desired only if the working directory is
  6755. @file{/}, as @command{tar} uses the archive's relative member names
  6756. (e.g., @file{etc/motd}) when verifying the archive.
  6757. @node Write Protection
  6758. @section Write Protection
  6759. Almost all tapes and diskettes, and in a few rare cases, even disks can
  6760. be @dfn{write protected}, to protect data on them from being changed.
  6761. Once an archive is written, you should write protect the media to prevent
  6762. the archive from being accidentally overwritten or deleted. (This will
  6763. protect the archive from being changed with a tape or floppy drive---it
  6764. will not protect it from magnet fields or other physical hazards).
  6765. The write protection device itself is usually an integral part of the
  6766. physical media, and can be a two position (write enabled/write
  6767. disabled) switch, a notch which can be popped out or covered, a ring
  6768. which can be removed from the center of a tape reel, or some other
  6769. changeable feature.
  6770. @node Free Software Needs Free Documentation
  6771. @appendix Free Software Needs Free Documentation
  6772. @include freemanuals.texi
  6773. @node Copying This Manual
  6774. @appendix Copying This Manual
  6775. @menu
  6776. * GNU Free Documentation License:: License for copying this manual
  6777. @end menu
  6778. @include fdl.texi
  6779. @node Index
  6780. @appendix Index
  6781. @printindex cp
  6782. @summarycontents
  6783. @contents
  6784. @bye
  6785. @c Local variables:
  6786. @c texinfo-column-for-description: 32
  6787. @c End: