FilesystemHierarchyStandard—Draft10 FilesystemHierarchyStandardGroup editedbyDanielQuinlan ABSTRACT Thisstandardconsistsofasetofrequirementsandguidelinesforfileand directoryplacementunderUNIX-likeoperatingsystems.Theguidelinesareintended tosupportinteroperabilityofapplications,systemadministrationtools,development tools,andscriptsaswellasgreateruniformityofdocumentationforthesesystems. January9,1997 FilesystemHierarchyStandard January8,1996 Linuxisnotatrademark,andhasnoconnectiontoUNIX. UNIXisatrademarkoftheX/OpenCompany,Ltd. NovellandNovellNetWarearetrademarksofNovell. SunMicrosystems,SunNIS,SunRPC,andNFSaretrademarksofSunMicrosystems,Inc. SystemVandSVR4aretrademarksofAT&T. XWindowSystemisatrademarkofXConsortium,Inc. Allothercopyrightsareownedbytheirowners,unlessspecificallynotedotherwise.Useofaterm inthisdocumentshouldnotberegardedasaffectingthevalidityofanytrademarkorservice mark. Copyright◯c1994,1995,1996DanielQuinlan Permissionisgrantedtomakeanddistributeverbatimcopiesofthisstandardprovidedthe copyrightandthispermissionnoticearepreservedonallcopies. Permissionisgrantedtocopyanddistributemodifiedversionsofthisstandardunderthe conditionsforverbatimcopying,providedalsothatthetitlepageislabeledasmodifiedincluding areferencetotheoriginalstandard,providedthatinformationonretrievingtheoriginalstandard isincluded,andprovidedthattheentireresultingderivedworkisdistributedunderthetermsofa permissionnoticeidenticaltothisone. Permissionisgrantedtocopyanddistributetranslationsofthisstandardintoanotherlanguage, undertheaboveconditionsformodifiedversions,exceptthatthispermissionnoticemaybestated inatranslationapprovedbythecopyrightholder. -i-FilesystemHierarchyStandard January8,1996 1.Introduction 1.1StatusoftheStandard Thisproposedstandardiscurrentlybeingdistributedforreviewandcomment. Commentsonthisdraftarewelcomefromanyinterestedparty.Suggestionsforchangesin documentsshouldbeintheformofaproposedchangeoftext,togetherwithappropriate supportingcomments. Theguidelinesinthisdraftaresubjecttochange.Useofinformationcontainedinthisdocument isatyourownrisk. 1.2OrganizationoftheStandard Thisstandardisdividedintothesesections: 1.Introduction 2.TheFilesystem:astatementofsomeguidingprinciples. 3.TheRootDirectory. 4.The/usrHierarchy. 5.The/varHierarchy. 6.OperatingSystemSpecificAnnex. 1.3Conventions Aconstant-widthfontisusedfordisplayingthenamesoffilesanddirectories. Componentsoffilenamesthatvaryarerepresentedbyadescriptionofthecontentsenclosedin "<"and">"characters,<thus>.Electronicmailaddressesarealsoenclosedin"<"and">"but areshownintheusualtypeface. Optionalcomponentsoffilenamesareenclosedin"["and"]"charactersandmaybecombined withthe"<"and">"convention.Forexample,ifafileexistedwhichcouldbeeitherbefound eitherwithorwithoutanextension,itmightberepresentedby<filename>[.<extension>]. Variablesubstringsofdirectorynamesandfilenamesareindicatedby"*". -1-FilesystemHierarchyStandard January8,1996 1.4BackgroundoftheFHS TheprocessofdevelopingastandardfilesystemhierarchybeganinAugust1993withaneffortto restructurethefileanddirectorystructureofLinux.TheFSSTND,afilesystemhierarchy standardspecifictotheLinuxoperatingsystem,wasreleasedonFebruary14,1994.Subsequent revisionswerereleasedonOctober9,1994andMarch28,1995. Inearly1995,thegoalofdevelopingamorecomprehensiveversionofFSSTNDtoaddressnot onlyLinux,butotherUNIX-likesystemswasadoptedinconjunctionwithmembersoftheBSD developmentcommunity.Asaresult,aconcertedeffortwasmadetofocusonissuesthatwere generaltoUNIX-likesystems.Inrecognitionofthiswideningofscope,thenameofthestandard waschangedtoFilesystemHierarchyStandardorFHSforshort. Volunteerswhohavecontributedextensivelytothisstandardarelistedattheendofthis document.Thisstandardrepresentsaconsensusviewofthoseandothercontributors. 1.5Scope ThisdocumentspecifiesastandardfilesystemhierarchyforFHSfilesystemsbyspecifyingthe locationoffilesanddirectories,andthecontentsofsomesystemfiles. Thisstandardhasbeendesignedtobeusedbysystemintegrators,packagedevelopers,and systemadministratorsintheconstructionandmaintenanceofFHScompliantfilesystems.Itis primarilyintendedtobeareferenceandisnotatutorialonhowtomanageaconforming filesystemhierarchy. TheFHSgrewoutofearlierworkonFSSTND,afilesystemorganizationstandardfortheLinux operatingsystem.ItbuildsonFSSTNDtoaddressinteroperabilityissuesnotjustintheLinux communitybutinawiderarenaincluding4.4BSD-basedoperatingsystems.Itincorporates lessonslearnedintheBSDworldandelsewhereaboutmulti-architecturesupportandthe demandsofheterogeneousnetworking. Althoughthisstandardismorecomprehensivethanpreviousattemptsatfilesystemhierarchy standardization,periodicupdatesmaybecomenecessaryasrequirementschangeinrelationto emergingtechnology.Itisalsopossiblethatbettersolutionstotheproblemsaddressedherewill bediscoveredorthatoursolutionswillnolongerbethebestpossiblesolutions.Supplementary draftsmaybereleasedinadditiontoperiodicupdatestothisdocument.However,aspecificgoal isbackwardscompatibilityfromonereleaseofthisdocumenttothenext. Commentsrelatedtothisstandardarewelcome.Anycommentsorsuggestionsforchangesshould bedirectedtotheFHSeditor(DanielQuinlan<quinlan@pathname.com>),orifyouprefer,one ofthelistedcontributors.Typographicalorgrammaticalcommentsshouldbedirectedtothe FHSeditor. PleasedonotsendmailtothemailinglistwithoutfirstcontactingtheFHSeditororalisted contributor.Impropermessageswillnotbewell-receivedonthemailinglist. Questionsabouthowtointerpretitemsinthisdocumentmayoccasionallyarise.Ifyouhaveneed foraclarification,pleasecontacttheFHSeditor.Sincethisstandardrepresentsaconsensusof manyparticipants,itisimportanttomakecertainthatanyinterpretationalsorepresentstheir collectiveopinion.Forthisreasonitmaynotbepossibletoprovideanimmediateresponseunless theinquiryhasbeenthesubjectofpreviousdiscussion. -2-FilesystemHierarchyStandard January8,1996 1.6Objectives Intryingtosolvetheproblemsabove,severalobjectiveswereidentifiedthatneededtobe achievedinadditiontothemoretechnicalmatters.Thesegoalscomprisethecorrectionof outstandingproblemsaswellasthevalidationofthisstandard. •Solvetheproblemslistedabovewhilelimitingtransitionaldifficultiesconsequentupon movingawayfromtheformerde-factostandards. •Gainapprovalofdistributors,developers,andotherimportantpeopleindifferentsoftware communities,aswellasencouragingthemtogiveustheirsuggestions. •ProvideastandardthatdifferentUNIX-likesystemswillchoosetofollowbecauseitsolves theproblemsaboveandprovidesthemostsensiblestructureforthefilesystemsofUNIX-like systems. Someoftheseobjectiveshavealreadybeenfullyorpartiallymetbythelimiteddistributionofan advancedrafttoanydeveloperwhorequestedone. 1.7IntendedAudience Theintendedaudienceofthisstandardincludes,butisnotlimitedtothefollowinggroupsof people: •SystemDevelopers •SystemIntegratorsandDistributors •ApplicationDevelopers •DocumentationWriters •SystemAdministratorsandotherinterestedparties(primarilyforinformationpurposes) 1.8ConformancewiththisDocument Thissectiondefinesthemeaningsoftheterms"compliant"and"compatible"withrespecttothis standard,andof"partial"complianceandconformance. An"implementation"herereferstoadistribution,aninstalledsystem,aprogram,apackage(or somesimilarpieceofsoftwareordata),orsomecomponentthereof. Animplementationisfullycompliantwiththisstandardifeveryrequirementinthisstandardis met.Everyfileordirectorywhichispartoftheimplementationmustbelocatedasspecifiedin thisdocument.Ifthecontentsofafilearedescribedheretheactualcontentsmustcorrespondto thedescription.Theimplementationmustalsoattempttofindanyfilesordirectories(externalto itself)primarilyorexclusivelyinthelocationspecifiedinthisstandard. Animplementationisfullycompatiblewiththisstandardifeveryfileordirectorywhichit containscanbefoundbylookinginthelocationspecifiedhereandwillbefoundwiththecontents asspecifiedhere,evenifthatisnottheprimaryorphysicallocationofthefileordirectoryin question.Theimplementationmust,whenitattemptstofindanyfilesordirectorieswhichare notpartofit,dosointhelocationspecifiedinthisstandard,thoughitmayalsoattempttofind itinother(non-standard)locations. Animplementationispartiallycompliantorcompatibleifitcomplieswithoriscompatiblewitha -3-FilesystemHierarchyStandard January8,1996 significantsubsetofthisdocument.Partialcomplianceorcompatibilityisonlyintendedtoapply todistributionsandnottoseparateprograms.Thephrase"asignificantsubset"isadmittedly subjective,andinborderlinecases,theconcernedpartyshouldcontacttheFHSeditor.Itis anticipatedthatsomevariationwillbetoleratedinborderlinecases. ToqualifyaspartiallyFHScompliantorpartiallyFHScompatibleanimplementationmust providealistofallplacesatwhichitandtheFHSdocumentdifferinadditiontoabrief explanationofthereasoningforthisdifference.Thislistshallbeprovidedwiththe implementationinquestion,andalsomadeavailabletotheFHSmailinglistortheFHSeditor. Theterms"must","should","contains","is"andsoforthshouldbereadasrequirementsfor complianceorcompatibility. Notethatanimplementationdoesnotneedtocontainallthefilesanddirectoriesspecifiedinthis standardtobecompliantorcompatible.Itismerelynecessaryforthosefilesthatitdoescontain tobelocatedappropriately.Forexample,iftheminixfilesystemisnotsupportedbya distribution,theminixtoolsneednotbeincluded,eventhoughtheyarementionedexplicitlyin thesectionon/sbin. Furthermore,certainportionsofthisdocumentareoptional.Inthiscasethiswillbestated explicitly,orindicatedwiththeuseofoneormoreof"may","recommend",or"suggest".Items markedasoptionalhavenobearingonthecomplianceorconformanceofanimplementation;they aresuggestionsmeanttoencouragecommonpractice,butmaybelocatedanywhereatthe implementor’schoice. -4-FilesystemHierarchyStandard January8,1996 2.TheFilesystem TheUNIXfilesystemischaracterizedby: •Ahierarchicalstructure •Consistenttreatmentoffiledata •Protectionoffiledata ThisstandardassumesthattheoperatingsystemunderlyinganFHS-compliantfilesystem supportsthesamebasicsecurityfeaturesfoundinmostUNIXfilesystems.Notethatthis standarddoesnotattempttoagreeineverypossiblerespectwithanyparticularUNIXsystem’s implementation.However,manyaspectsofthisstandardarebasedonideasfoundinUNIXand otherUNIX-likesystems. Thisisaftercarefulconsiderationofotherfactors,including: •CommonandsoundpracticesintheLinuxandBSDcommunities •Theimplementationofotherfilesystemstructures •Applicablestandards Itispossibletodefinetwoorthogonalcategoriesoffiles:shareablevs.unshareableandvariablevs. static. Shareabledataisthatwhichcanbesharedbetweenseveraldifferenthosts;unshareableisthat whichmustbespecifictoaparticularhost.Forexample,userhomedirectoriesareshareable data,butdevicelockfilesarenot. Staticdataincludesbinaries,libraries,documentation,andanythingthatdoesnotchangewithout systemadministratorintervention;variabledataisanythingelsethatdoeschangewithoutsystem administratorintervention. Throughoutthisdocument,andinanywell-plannedfilesystem,anunderstandingofthesebasic principleswillhelpguidethestructureandlenditadditionalconsistency. Thedistinctionbetweenshareableandunshareabledataisneededforseveralreasons: •Inanetworkedenvironment(i.e.,morethanonehostatasite),thereisagooddealofdata thatcanbesharedbetweendifferenthoststosavespaceandeasethetaskofmaintenance. •Inanetworkedenvironment,certainfilescontaininformationspecifictoasinglehost. Thereforethesefilesystemscannotbeshared(withouttakingspecialmeasures). •HistoricalimplementationsofLinuxandBSDfilesystemsdidnotallowthe/usrhierarchyto bemountedread-onlybecauseitcontainedfilesanddirectoriesthatneedtobewrittento often.Thisisafactorthatmustbeaddressedwhenpartsof/usraresharedonanetwork ormountedread-onlybecauseofotherconsiderationssuchassecurity. The"shareable"distinctioncanbeusedtosupport,forexample: •A/usrpartition(orcomponentsof/usr)mounted(read-only)throughthenetwork(using NFS). -5-FilesystemHierarchyStandard January8,1996 •A/usrpartition(orcomponentsof/usr)mountedfromread-onlymedia.ACD-ROMcan beconsideredaread-onlyfilesystemsharedwithotherFHS-compliantsystems,usingthe postalmailsystemasa‘‘network’’. The"static"versus"variable"distinctionaffectsthefilesystemintwomajorways: •Since/containsbothvariableandstaticdata,itneedstobemountedread-write. •Sincethetraditional/usrcontainsbothvariableandstaticdata,andsincewemaywantto mountitread-only(seeabove),itisnecessarytoprovideamethodtohave/usrmounted read-only.Thisisdonethroughthecreationofa/varhierarchythatismountedread-write (orisapartofanotherread-writepartition,suchas/),takingovermuchofthe/usr partition’straditionalfunctionality. Summarizingchartwithexamples: shareableunshareable static/usr/etc /opt/boot variable/var/mail/var/run /var/spool/news/var/lock FilesystemHierarchyStandard January8,1996 3.TheRootDirectory Thissectiondescribestherootdirectorystructure.Thecontentsoftherootfilesystemshouldbe adequatetoboot,restore,recover,and/orrepairthesystem: •Tobootasystem,enoughmustbepresentontherootpartitiontomountotherfilesystems. Thisincludesutilities,configuration,bootloaderinformation,andotheressentialstart-up data./usr,/opt,and/vararedesignedsuchthattheymaybelocatedonother filesystems. •Toenablerecoveryand/orrepairofasystem,thoseutilitiesneededbyanexperienced maintainertodiagnoseandreconstructadamagedsystemshouldbepresentontheroot filesystem. •Torestoreasystem,thoseutilitiesneededtorestorefromsystembackups(onfloppy,tape, etc.)shouldbepresentontherootfilesystem. Theprimaryconcernusedtobalancetheseconsiderations,whichfavorplacingmanythingsonthe rootfilesystem,isthegoalofkeepingrootassmallasreasonablypossible.Forseveralreasons,it isdesirabletokeeptherootfilesystemsmall: •Itisoccasionallymountedfromverysmallmedia. •Therootfilesystemhasmanysystem-specificconfigurationfilesinit.Possibleexamples includeakernelthatisspecifictothesystem,adifferenthostname,etc.Thismeansthat therootfilesystemisn’talwaysshareablebetweennetworkedsystems.Keepingitsmallon networkedsystemsminimizestheamountofspacelostonserverstounshareablefiles.It alsoallowsworkstationswithsmallerlocalharddrives. •Whileyoumayhavetherootfilesystemonalargepartition,andmaybeabletofillitto yourheart’scontent,therewillbepeoplewithsmallerpartitions.Ifyouhavemorefiles installed,youmayfindincompatibilitieswithothersystemsusingrootfilesystemsonsmaller partitions.Ifyouareadeveloperthenyoumaybeturningyourassumptionintoaproblem foralargenumberofusers. •Diskerrorsthatcorruptdataontherootfilesystemareagreaterproblemthanerrorson anyotherpartition.Asmallrootfilesystemislesspronetocorruptionastheresultofa systemcrash. Softwareshouldnevercreateorrequirespecialfilesorsubdirectoriesintherootdirectory.Other locationsintheFHShierarchyprovidemorethanenoughflexibilityforanypackage. BEGINRATIONALE Thereareseveralreasonswhyintroducinganewsubdirectoryoftherootfilesystemisprohibited: •Itdemandsspaceonarootpartitionwhichthesystemadministratormaywantkeptsmall andsimpleforeitherperformanceorsecurityreasons. •Itevadeswhateverdisciplinethesystemadministratormayhavesetupfordistributing standardfilehierarchiesacrossmountablevolumes. ENDRATIONALE -7-FilesystemHierarchyStandard January8,1996 /—therootdirectory

bin

Essentialcommandbinaries

boot

Staticfilesofthebootloader

dev

Devicefiles

etc

Host-specificsystemconfiguration

home

Userhomedirectories

lib

Sharedlibraries

mnt

Mountpointoftemporarypartitions

opt

Add-onapplicationsoftwarepackages

proc

Processinformationpseudo-filesystem

root

Homedirectoryfortherootuser

sbin

Essentialsystembinaries

tmp

Temporaryfiles

usr

Secondaryhierarchy

var

Variabledata Eachdirectorylistedaboveisspecifiedindetailinseparatesubsectionsbelow./usrand/var eachhaveacompletesectioninthisdocumentduetothecomplexityofthosedirectories. Theoperatingsystemkernelimageshouldbelocatedineither/or/boot.Additional informationonkernelplacementcanbefoundinthesectionregarding/boot,below. 3.1/bin:Essentialusercommandbinaries(forusebyallusers) /bincontainscommandsthatmaybeusedbyboththesystemadministratorandbyusers,but whicharerequiredinsingleusermode.Itmayalsocontaincommandswhichareusedindirectly byscripts. Allroot-onlybinariessuchasdaemons,init,getty,update,etc.shouldbeplacedin/sbinor /usr/sbin,dependingonwhethertheyareessential. Thereshouldbenosubdirectorieswithin/bin. Commandbinariesthatarenotessentialenoughtoplaceinto/binshouldbeplacedin/usr/bin, instead.Itemsthatareonlyusedbynon-rootusers(mail,chsh,etc.)arenotessentialenoughto beplacedintotherootpartition. Requiredfilesfor/bin: •Generalcommands: Thefollowingcommandshavebeenincludedbecausetheyareessential.Afewarepresent becauseoftheirtraditionalplacementin/bin.

{cat,chgrp,chmod,chown,cp,date,dd,df,dmesg,echo,ed,false,kill,
ln,login,ls,mkdir,mknod,more,mount,mv,ps,pwd,rm,rmdir,sed,
setserial,sh,stty,su,sync,true,umount,uname}

If/bin/shisBash,then/bin/shshouldbeasymbolicorhardlinkto/bin/bashsince Bashbehavesdifferentlywhencalledasshorbash.pdksh,whichmaybethe/bin/shon -8-FilesystemHierarchyStandard January8,1996 installdisks,shouldlikewisebearrangedwith/bin/shbeingasymlinkto/bin/ksh.The useofasymboliclinkinthesecasesallowsuserstoeasilyseethat/bin/shisnotatrue Bourneshell. Sincethede-factostandardlocationoftheC-shellis/bin/csh,ifandonlyifaC-shellor equivalent(suchastcsh)isavailableonthesystem,itshouldbeavailablebythename

/bin/csh./bin/cshmaybeasymboliclinkto/bin/tcshor/usr/bin/tcsh.

Note:The[andtestcommandsarebuiltintomostcommonlyusedBourneshell(/bin/sh) replacements.Thesetwocommandsdonothavetobeplacedin/bin;theymaybeplacedin /usr/bin.TheymustbeincludedasseparatebinarieswithanyUNIXorUNIX-likesystem attemptingtocomplywiththePOSIX.2standard.

•Restorationcommands:
Thesecommandshavebeenaddedtomakerestorationofasystempossible
(providedthat/isintact).

{tar,gzip,gunzip(linktogzip),zcat(linktogzip)} Ifsystembackupsaremadeusingprogramsotherthangzipandtar,thentheroot partitionshouldcontaintheminimalnecessaryrestorationcomponents.Forinstance,many systemsshouldincludecpioasitisthenextmostcommonlyusedbackuputilityaftertar. Conversely,ifnorestorationfromtherootpartitioniseverexpected,thenthesebinaries maybeomitted(i.e.,aROMchiproot,mounting/usrthroughNFS).Ifrestorationofa systemisplannedthroughthenetwork,thenftportftp(alongwitheverythingnecessary togetanftpconnection)shouldbeavailableontherootpartition. Restorationcommandsmayappearineither/binor/usr/binondifferentsystems. •Networkingcommands: Thesearetheonlynecessarynetworkingbinariesthatbothrootanduserswillwantorneed toexecuteotherthantheonesin/usr/binor/usr/local/bin.

{domainname,hostname,netstat,ping}

3.2/boot:Staticfilesofthebootloader Thisdirectorycontainseverythingrequiredforthebootprocessexceptconfigurationfilesandthe mapinstaller.Thus/bootstoresdatawhichisusedbeforethekernelbeingsexecutinguser-mode programs.Thismayincludesavedmasterbootsectors,sectormapfiles,andotherdatathatis notdirectlyeditedbyhand.Programsnecessarytoarrangeforthebootloadertobeabletoboot afileshouldbeplacedin/sbin.Configurationfilesforbootloadersshouldbeplacedin/etc. Theoperatingsystemkernelshouldbelocatedeitherin/orin/boot. Note:Onsomei386machines,itmaybenecessaryfor/boottobelocatedonaseparatepartition locatedcompletelybelowcylinder1024ofthebootdeviceduetohardwareconstraints. -9-FilesystemHierarchyStandard January8,1996 3.3/dev:Devicefiles The/devdirectoryisthelocationofspecialordevicefiles. Ifitispossiblethatdevicesin/devwillneedtobemanuallycreated,/devshallcontaina commandnamedMAKEDEV,whichcancreatedevicesasneeded.Itmayalsocontaina MAKEDEV.localforanylocaldevices. Ifrequired,MAKEDEVshouldhaveprovisionsforcreatinganydevicethatmaybefoundonthe system,notjustthosethataparticularimplementationinstalls. 3.4/etc:Host-specificsystemconfiguration /etccontainsconfigurationfilesanddirectories,whicharespecifictothecurrentsystem. Nobinariesshouldgodirectlyinto/etc.Binariesthatmightinthepasthavebeenfoundin/etc shouldbeplacedin/sbin,/usr/sbin,orpossibly/usr/libexec.Thisincludessuchfilesas init,getty,andupdate.Binariessuchashostnamethatareusedbyordinaryusersaswellas therootusershouldnotbeplacedin/sbinbutin/bin. /etc—Host-specificsystemconfiguration

X11

ConfigurationfortheXWindowSystem

opt

Configurationfor/opt Thefollowingsectionisintendedpartlytoilluminatethedescriptionofthecontentsof/etcwith anumberofexamples;itisdefinitelynotanexhaustivelist. Requiredfilesfor/etc: •Generalfiles:

{adjtime,csh.login,disktab,fdprm,fstab,gettydefs,group,inittab,
confissue,ld.so.conf,lilo.conf,motd,mtab,mtools,passwd,profile,
securetty,shells,syslog.conf,ttytype}

•Networkingfiles:

{exports,ftpusers,gateways,host.conf,hosts,hosts.allow,hosts.deny,
hosts.equiv,hosts.lpd,inetd.conf,networks,printcap,protocols,
resolv.conf,rpc,services}

Notes: Thereareseveraldifferentmodelsforsetupofthe"rc"commandscriptswhichareinvokedatboot timesuchasthe/etc/rc.*BSDmodelandtheSystemVmodel.Nospecificmodelisrequired, butaspecificationofthisareamaybeaddedtoafutureversionofthisstandard. Systemsthatusetheshadowpasswordsuitewillhaveadditionalconfigurationfilesin/etc (/etc/shadowandothers)andprogramsin/usr/sbin(useradd,usermod,andothers). -10-FilesystemHierarchyStandard January8,1996 3.4.1/etc/X11:ConfigurationfortheXWindowSystem /etc/X11istherecommendedlocationforallX11host-specificconfiguration.Thisdirectoryis necessarytoallowlocalcontrolif/usrismountedreadonly.Filesthatshouldbeinthis directoryincludeXconfig(and/orXF86Config)andXmodmap. Subdirectoriesof/etc/X11mayincludethoseforxdmandforanyotherprograms(somewindow managers,forexample)thatneedthem.Werecommendthatwindowmanagerswithonlyone configurationfilewhichisadefault.*wmrcfileshouldnameitsystem.*wmrc(unlessthereisa widely-acceptedalternativename)andnotuseasubdirectory.Anywindowmanager subdirectoriesshouldbeidenticallynamedtotheactualwindowmanagerbinary. /etc/X11/xdmholdstheconfigurationfilesforxdm.Thesearemostofthefilesnormallyfoundin /usr/lib/X11/xdm.Somelocalvariabledataforxdmisstoredin/var/state/xdm. 3.4.2/etc/opt:Configurationfilesfor/opt Host-specificconfigurationfilesforadd-onapplicationsoftwarepackagesshallbeinstalledwithin thedirectory/etc/opt/<package>,where<package>isthenameofthesubtreein/optwhere thestaticdatafromthatpackageisstored.Nostructureisimposedontheinternalarrangement

of/etc/opt/<package>.

Ifaconfigurationfilemustresideinadifferentlocationinorderforthepackageorsystemto functionproperly,itmaybeplacedinalocationotherthan/etc/opt/<package>. BEGINRATIONALE Refertotherationalefor/opt. ENDRATIONALE 3.5/home:Userhomedirectories(optional) /homeisafairlystandardconcept,butitisclearlyasite-specificfilesystem.Thesetupwilldiffer fromhosttohost.Thissectiondescribesonlyasuggestedplacementforuserhomedirectories; neverthelesswerecommendthatallFHS-compliantdistributionsusethisasthedefaultlocation forhomedirectories. Onsmallsystems,eachuser’sdirectoryistypicallyoneofthemanysubdirectoriesof/homesuch

as/home/smith,/home/torvalds,/home/operator,etc.

Onlargesystems(especiallywhenthe/homedirectoriesaresharedamongstmanyhostsusing NFS)itisusefultosubdivideuserhomedirectories.Subdivisionmaybeaccomplishedbyusing

subdirectoriessuchas/home/staff,/home/guests,/home/students,etc.

Differentpeopleprefertoplaceuseraccountsinavarietyofplaces.Therefore,noprogramshould relyonthislocation.Ifyouwanttofindoutauser’shomedirectory,youshouldusethe getpwent(3)libraryfunctionratherthanrelyingon/etc/passwdbecauseuserinformationmay bestoredremotelyusingsystemssuchasNIS. -11-FilesystemHierarchyStandard January8,1996 3.6/lib:Essentialsharedlibrariesandkernelmodules The/libdirectorycontainsthosesharedlibraryimagesneededtobootthesystemandrunthe commandsintherootfilesystem. /lib—essentialsharedlibrariesandkernelmodules

modules

Loadablekernelmodules Thisincludes/lib/libc.so.*,/lib/libm.so.*,theshareddynamiclinker/lib/ld.so,and othersharedlibrariesrequiredbybinariesin/binand/sbin. Sharedlibrariesthatareonlynecessaryforbinariesin/usr(suchasanyXWindowbinaries)do notbelongin/lib.Onlythesharedlibrariesrequiredtorunbinariesin/binand/sbinshould behere.Thelibrarylibm.so.*mayalsobeplacedin/usr/libifitisnotrequiredbyanything

in/binor/sbin.

Forcompatibilityreasons,/lib/cppneedstoexistasareferencetotheCpreprocessorinstalled onthesystem.Theusualplacementofthisbinaryis

/usr/lib/gcc-lib/<target>/<version>/cpp./lib/cppcaneitherpointatthisbinary,orat

anyotherreferencetothisbinarywhichexistsinthefilesystem.(Forexample,/usr/bin/cppis alsooftenused.) Thespecificationfor/lib/modulesisforthcoming. 3.7/mnt:Mountpointfortemporarilymountedfilesystems Thisdirectoryisprovidedsothatthesystemadministratormaytemporarilymountfilesystemsas needed.Thecontentofthisdirectoryisalocalissueandshouldnotaffectthemannerinwhich anyprogramisrun. Werecommendagainsttheuseofthisdirectorybyinstallationprograms,andsuggestthata suitabletemporarydirectorynotinusebythesystemshouldbeusedinstead. 3.8/opt:Add-onapplicationsoftwarepackages /opt—Add-onapplicationsoftwarepackages

<package>

Staticpackageobjects /optisreservedfortheinstallationofadd-onapplicationsoftwarepackages. Apackagetobeinstalledin/optshalllocateitsstaticfilesinaseparate/opt/<package> directorytree,where<package>isanamethatdescribesthesoftwarepackage. Programstobeinvokedbyusersshallbelocatedinthedirectory/opt/<package>/bin.Ifthe packageincludesUNIXmanualpages,theyshallbelocatedin/opt/<package>/manandthesame -12-FilesystemHierarchyStandard January8,1996 substructureas/usr/share/manshallbeused.

Thedirectories/opt/bin,/opt/doc,/opt/include,/opt/info,/opt/lib,and/opt/manare

reservedforlocalsystemadministratoruse.Packagesmayprovide"front-end"filesintendedto beplacedin(bylinkingorcopying)thesereserveddirectoriesbythelocalsystemadministrator, butshallfunctionnormallyintheabsenceofthesereserveddirectories. Packagefilesthatarevariable(changeinnormaloperation)shouldbeinstalledin/var/opt.See thesectionon/var/optformoreinformation. Host-specificconfigurationfilesshouldbeinstalledin/etc/opt.Seethesectionon/etcformore information. Nootherpackagefilesshouldexistoutsidethe/opt,/var/opt,and/etc/opthierarchiesexcept forthosepackagefilesthatmustresideinspecificlocationswithinthefilesystemtreeinorderto functionproperly.Forexample,devicelockfilesmustbeplacedin/var/lockanddevicesmust belocatedin/dev. BEGINRATIONALE Theuseof/optforadd-onsoftwareisawell-establishedpracticeintheUNIXcommunity.The SystemVApplicationBinaryInterface[AT&T1990],basedontheSystemVInterfaceDefinition (ThirdEdition),providesforan/optstructureverysimilartotheonedefinedhere. TheIntelBinaryCompatibilityStandardv.2(iBCS2)alsoprovidesasimilarstructurefor/opt. Generally,alldatarequiredtoinstallapackageonasystemshouldbepresentwithin /opt/<package>,includingfilesintendedtobecopiedinto/etc/opt/<package>and /var/opt/<package>aswellasreserveddirectoriesin/opt. ENDRATIONALE 3.9/proc:Kernelandprocessinformationvirtualfilesystem Theprocfilesystemisbecomingthede-factostandardLinuxmethodforhandlingprocessand systeminformation,ratherthan/dev/kmemandothersimilarmethods.Westronglyencourage thisforthestorageandretrievalofprocessinformationaswellasotherkernelandmemory information. 3.10/root:Homedirectoryfortherootuser(optional) /istraditionallythehomedirectoryoftherootaccountonUNIXsystems./rootisusedon manyLinuxsystemsandonsomeUNIXsystems(inordertoreduceclutterinthe/directory). Therootaccount’shomedirectorymaybedeterminedbydeveloperorlocalpreference.Obvious possibilitiesinclude/,/root,and/home/root. Ifthehomedirectoryoftherootaccountisnotstoredontherootpartitionitwillbenecessaryto makecertainitwilldefaultto/ifitcannotbelocated. Note:werecommendagainstusingtherootaccountformundanethingssuchasmailandnews, andthatitbeusedsolelyforsystemadministration.Forthisreason,werecommendthat subdirectoriessuchasMailandNewsnotappearintherootaccount’shomedirectory,andthat mailforadministrationrolessuchasroot,postmasterandwebmasterbeforwardedtoan -13-FilesystemHierarchyStandard January8,1996 appropriateuser. 3.11/sbin:Systembinaries(binariesoncekeptin/etc) Utilitiesusedforsystemadministration(andotherroot-onlycommands)arestoredin/sbin, /usr/sbin,and/usr/local/sbin./sbintypicallycontainsbinariesessentialforbootingthe systeminadditiontothebinariesin/bin.Anythingexecutedafter/usrisknowntobemounted (whentherearenoproblems)shouldbeplacedinto/usr/sbin.Local-onlysystemadministration binariesshouldbeplacedinto/usr/local/sbin. Decidingwhatthingsgointo"sbin"directoriesissimple:Ifanormal(notasystem administrator)userwilleverrunitdirectly,thenitshouldbeplacedinoneofthe"bin" directories.Ordinaryusersshouldnothavetoplaceanyofthesbindirectoriesintheirpath. Note:Forexample,filessuchaschfnwhichusersonlyoccasionallyuseshouldstillbeplacedin /usr/bin.ping,althoughitisabsolutelynecessaryforroot(networkrecoveryanddiagnosis)is oftenusedbyusersandshouldlivein/binforthatreason.

Werecommendthatusershavereadandexecutepermissionforeverythingin/sbin
except,perhaps,certainsetuidandsetgidprograms.Thedivisionbetween/bin
and/sbinwasnotcreatedforsecurityreasonsortopreventusersfromseeingthe
operatingsystem,buttoprovideagoodpartitionbetweenbinariesthateveryone
usesandonesthatareprimarilyusedforadministrationtasks.Thereisno
inherentsecurityadvantageinmaking/sbinoff-limitsforusers.

Requiredfilesfor/sbin: •Generalcommands:

{clock,getty,init,update,mkswap,swapon,swapoff,telinit}

•Shutdowncommands:

{fastboot,fasthalt,halt,reboot,shutdown}

(Oranycombinationoftheabove,solongasshutdownisincluded.) •Filesystemmanagementcommands:

{fdisk,fsck,fsck.*,mkfs,mkfs.*}

*=oneormoreofext,ext2,minix,msdos,xiaandperhapsothers •Networkingcommands:

{ifconfig,route}

3.12/tmp:Temporaryfiles The/tmpdirectoryshallbemadeavailableforprogramsthatrequiretemporaryfiles. Althoughdatastoredin/tmpmaybedeletedinasite-specificmanner,itisrecommendedthat filesanddirectorieslocatedin/tmpbedeletedwheneverthesystemisbooted. -14-FilesystemHierarchyStandard January8,1996 Programsshallnotassumethatanyfilesordirectoriesin/tmparepreservedbetweeninvocations oftheprogram. BEGINRATIONALE IEEEstandardP1003.2(POSIX,part2)makesrequirementsthataresimilartotheabove section. FHSaddedtherecommendationthat/tmpbecleanedatboottimeonthebasisofhistorical precedentandcommonpractice,butdidnotmakeitarequirementbecausesystemadministration isnotwithinthescopeofthisstandard. ENDRATIONALE FilesystemHierarchyStandard January8,1996 4.The/usrHierarchy /usristhesecondmajorsectionofthefilesystem./usrisshareable,read-onlydata.That meansthat/usrshouldbeshareablebetweenvarioushostsrunningFHS-compliantandshould notbewrittento.Anyinformationthatishost-specificorvarieswithtimeisstoredelsewhere. Nolargesoftwarepackagesshoulduseadirectsubdirectoryunderthe/usrhierarchy.An exceptionismadefortheXWindowSystembecauseofconsiderableprecedentandwidelyacceptedpractice.Thissectionofthestandardspecifiesthelocationformostsuchpackages. /usr—SecondaryHierarchy

X11R6

XWindowSystem,version11release6

X386

XWindowSystem,version11release5onx86platforms

bin

Mostusercommands

games

Gamesandeducationalbinaries

include

HeaderfilesincludedbyCprograms

lib

Libraries

libexec

Internalbinaries

local

Localhierarchy(emptyaftermaininstallation)

sbin

Non-vitalsystemadministrationbinaries

share

Architecture-independentdata

src

Sourcecode Thefollowingsymboliclinkstodirectoriesmaybepresent.Thispossibilityisbasedontheneedto preservecompatibilitywitholdersystemsuntilallimplementationscanbeassumedtousethe /varhierarchy.

/usr/adm->/var/log
/usr/preserve->/var/state/<editor>
/usr/spool->/var/spool
/usr/tmp->/var/tmp
/usr/spool/locks->/var/lock

Onceasystemnolongerrequiresanyoneoftheabovesymboliclinks,thelinkmayberemoved,if desired.Notably,ittakeslittleefforttocompletelyremove/usr/preservesinceonlyelvisuses it. -16-FilesystemHierarchyStandard January8,1996 4.1/usr/X11R6:XWindowSystem,Version11Release6 ThishierarchyisreservedfortheXWindowSystem,version11release6,andrelatedfiles. TosimplifymattersandmakeXFree86morecompatiblewiththeXWindowSystemonother systems,thefollowingsymboliclinksshouldbepresent:

/usr/bin/X11->/usr/X11R6/bin
/usr/lib/X11->/usr/X11R6/lib/X11
/usr/include/X11->/usr/X11R6/include/X11

Ingeneral,softwareshouldnotbeinstalledormanagedviatheabovesymboliclinks.Theyare intendedforutilizationbyusersonly.ThedifficultyisrelatedtothereleaseversionoftheX WindowSystem—intransitionalperiods,itisimpossibletoknowwhatreleaseofX11isinuse. Forthesamereason,thereshouldnotbeasymboliclinkfrom/usr/X11pointingtothecurrentX WindowSystemhierarchy. Host-specificdatain/usr/X11R6/lib/X11shouldbeinterpretedasademonstrationfile. Applicationsrequiringinformmationaboutthecurrenthostmustreferenceaconfigurationfilein /etc/X11,whichmaybelinkedtoafilein/usr/X11R6/lib. 4.2/usr/X386:XWindowSystem,Version11Release5,onx86 platforms Thishierarchyisgenerallyidenticalto/usr/X11R6,exceptthatthe/usrsymboliclinksshouldbe absentif/usr/X11R6isinstalled. 4.3/usr/bin:Mostusercommands Thisistheprimarydirectoryofexecutablecommandsonthesystem. /usr/bin—Binariesthatarenotneededinsingle-usermode

mh

CommandsfortheMHmailhandlingsystem

X11

Symlinkto/usr/X11R6/bin

Becauseshellscriptinterpreters(invokedwith#!<path>onthefirstlineofashellscript)cannot relyonapath,itisadvantageoustostandardizetheirlocations.TheBourneshellandC-shell interpretersarealreadyfixedin/bin,butPerl,Python,andTclareoftenfoundinmanydifferent

places./usr/bin/perl,/usr/bin/python,and/usr/bin/tclshouldreferencetheperl,python,

andtclshellinterpreters,respectively.Theymaybesymlinkstothephysicallocationofthe shellinterpreters. -17-FilesystemHierarchyStandard January8,1996 4.4/usr/include:Directoryforstandardincludefiles. Thisiswhereallofthesystem’sgeneral-useincludefilesfortheCandC++programming languagesshouldbeplaced. /usr/include—Includefiles

X11

Symlinkto/usr/X11R6/include/X11
arpa

ARPAnetdefinedprotocoldefinitions

bsd

BSDcompatibilityincludefiles

g++

GNUC++includefiles

gnu

GNUincludefiles

net

Genericnetwork-relateddefinitions

netax25

+AX25(ARRLAX.25)specificdefinitions

netinet

TCP/IPspecificdefinitions

netipx

+IPX(NovellIPX/SPX)specificdefinitions

protocols

Protocoldefinitions(mostlyINET-based)

readline

TheGNUreadlinelibrary

rpc

SunMicrosystemsRPCdefinitions

rpcsvc

SunMicrosystemsRPCservicedefinitions

sys

Systemgenerationincludefiles ThearpasubdirectorycontainsprotocolheaderdefinitionsfortheARPAnetprotocols,TCP/IP conversionfunctions,definitionsforftp,telnetprototypes,andsimilarmaterial. Thenetsubdirectorycontainsgenericnetwork-relateddefinitions.Itdefinesthesystemkernel interface,protocolfamilydetails,etc. ThenetinetsubdirectorycontainsINET(DARPAInternet,whichisalsoknownasTCP/IP) specificdefinitions. ARRLAX.25isbetterknownaspacketradio.TheNovellIPX/SPXprotocolsarepartofthe NovellNetWarefileservices. 4.5/usr/lib:Librariesforprogramming /usr/libisintendedforobjectfilesandlibraries. Historically,/usr/libhasalsoincludedcompilerprogrambinariesandstaticdataofvarious kinds—bothexecutablecode(forexample,GCC’sinternalbinariesmaybelocatedunder /usr/lib/gcc-lib)andothertypesofdata. Miscellaneousapplication-specificstaticfilesandsubdirectoriesshouldbeplacedin/usr/share, andapplication-specificbinariesin/usr/libexec(forinternalbinaries),/usr/bin(foruser commands),or/usr/sbin(forsystemcommands).However,distributorsmayplaceapplicationspecificstaticdataandbinariesinsubdirectoriesof/usr/libinstead,attheirdiscretion.Such application-specificdirectoriesmightinclude,forexample,emacs,gcc-lib,mf,news,smail,

texmf,oruucp.

Someexecutablecommandssuchasmakewhatisandsendmailhavealsobeentraditionallyplaced -18-FilesystemHierarchyStandard January8,1996 in/usr/lib.makewhatisisaninternalbinaryandshouldbeplacedinabinarydirectory;users accessonlycatman.Newersendmailbinariesarenowplacedbydefaultin/usr/sbin;asymbolic linkshouldremainfrom/usr/lib.Additionally,systemsusingSmailshouldplaceSmailin

/usr/sbin/smail,and/usr/sbin/sendmailshouldbeasymboliclinktoit.

Asymboliclink/usr/lib/X11pointingtothelib/X11directoryofthedefaultXdistributionis requiredifXisinstalled. Note:Nohost-specificdatafortheXWindowSystemshouldbestoredin/usr/lib/X11.Host-specificconfigurationfilessuchasXconfigorXF86Configshouldbestoredin/etc/X11.This shouldincludeconfigurationdatasuchassystem.twmrcevenifitisonlymadeasymboliclinkto amoreglobalconfigurationfile(probablyin/usr/X11R6/lib/X11). 4.6/usr/libexec:Internalbinaries /usr/libexecisforexecutableprogramstoberunbyotherprogramsratherthanbyusersfrom theshell.Thenameisderivedfrom"libraryexecutables". Examplesofprogramslocatedin/usr/libexecincludeinternetdaemonsstartedbyinetd; programsstartedbyinitsuchasgetty;andcompilerbinariesstartedbytheCcompilersuchas

cc1.

Applicationsmayuseasinglesubdirectoryunder/usr/libexec.Ifanapplicationusesa subdirectory,allprogramsexclusivelyusedbytheapplicationshouldbeplacedwithinthat subdirectory.Examplesofsubdirectorieslocatedin/usr/libexecincludeuucpforUUCP componentbinariesandlprforprinterdaemonfilterprograms. Nospecificprogramsmustbeplacedhere,butitisrecommendedthatanybinariesin/usr/lib and/usr/sbinthatmeettheabovecriteriabemovedtothisdirectory. BEGINRATIONALE TheconceptofalibexecdirectorywasintroducedintheNet/2distributionoftheBSD operatingsystem.Itwascreatedtoremoveexecutablesthatweren’tintendedtobeexecuted directlybyusersfromthestandardexecutionpath.TheGNUCodingStandardsalsousea libexecdirectory. AsimilarconcepthasbeenusedinotherUNIXoperatingsystemssuchasOSF/1,whichinstead usesthedirectory/usr/lbinfor"back-endexecutables".Thename/usr/lbinwasnotchosen becauseitwasfirstusedforlocalbinaries(ratherthaninternalbinaries)inSystemIII.Wealso feltthat/usr/lbinwouldbemoreeasilymistakenforadirectorythatwasmeanttobeplacedin theexecutionpath. Additionally,asinternalbinariesmigratefrom/usr/libto/usr/libexec,/usr/lib,originally designedforobjectlibrariesandarchives,shouldregainsomemeasureofclarity. ENDRATIONALE -19-FilesystemHierarchyStandard January8,1996 4.7/usr/local:Localhierarchy The/usr/localhierarchyisforusebythesystemadministratorwheninstallingsoftwarelocally. Itneedstobesafefrombeingoverwrittenwhenthesystemsoftwareisupdated.Itmaybeused forprogramsanddatathatareshareableamongstagroupofhosts,butnotfoundin/usr. /usr/local—Localhierarchy

bin

Localbinaries

etc

Localconfiguration

games

Localgamebinaries

lib

Locallibraries

libexec

Localinternalbinaries

share

Localarchitecture-independenthierarchy

src

Localsourcecode ThisdirectoryshouldalwaysbeemptyafterfirstinstallingaFHS-compliantsystem.No exceptionstothisruleshouldbemadeotherthanthelisteddirectorystubs. Locallyinstalledsoftwareshouldbeplacedwithin/usr/localratherthan/usrunlessitisbeing installedtoreplaceorupgradesoftwarein/usr. Notethatsoftwareplacedin/or/usrmaybeoverwrittenbysystemupgrades(thoughwe recommendthatdistributionsdonotoverwritedatain/etcunderthesecircumstances).Forthis reason,localsoftwareshouldnotbeplacedoutsideof/usr/localwithoutgoodreason. 4.8/usr/sbin:Non-essentialstandardsystembinaries Thisdirectorycontainsanynon-essentialbinariesusedexclusivelybythesystemadministrator. Systemadministrationprogramsthatarerequiredforsystemrepair,systemrecovery,mounting /usr,orotheressentialfunctionsshouldbeplacedin/sbininstead. Typically,/usr/sbincontainsnetworkingdaemons,anynon-essentialadministrationtools,and binariesfornon-criticalserverprograms. TheseserverprogramsareusedwhenenteringtheSystemVstatesknownas"runlevel2"(multiuserstate)and"runlevel3"(networkedstate)ortheBSDstateknownas"multi-usermode".At thispointthesystemismakingservicesavailabletousers(e.g.,printersupport)andtoother hosts(e.g.,NFSexports). Locallyinstalledsystemadministrationprogramsshouldbeplacedin/usr/local/sbin. -20-FilesystemHierarchyStandard January8,1996 4.9/usr/share:Architecture-independentdata /usr/share—Architecture-independentdata

dict

Wordlists

doc

Miscellaneousdocumentation

games

Staticdatafilesfor/usr/games

info

GNUInfosystem’sprimarydirectory

locale

Localeinformation

man

Onlinemanuals

nls

Nativelanguagesupport

misc

Miscellaneousarchitecture-independentdata

terminfo

Directoriesforterminfodatabase

tmac

troffmacrosnotdistributedwithgroff

zoneinfo

Timezoneinformationandconfiguration The/usr/sharehierarchyisforallread-onlyarchitectureindependentdatafiles.Muchofthis dataoriginallylivedin/usr(man,doc)or/usr/lib(dict,terminfo,zoneinfo).Thishierarchy isintendedtobeshareableamongallarchitectureplatformsofagivenOS;thus,forexample,a sitewithi386,Alpha,andPPCplatformsmightmaintainasingle/usr/sharedirectorythatis centrally-mounted.Note,however,that/usr/shareisgenerallynotintendedtobesharedby differentOSesorbydifferentreleasesofthesameOS. Anyprogramorpackagewhichcontainsorrequiresdatathatdoesn’tneedtobemodifiedshould storethatdatain/usr/share(or/usr/local/share,ifinstalledlocally).Itisrecommended thatasubdirectorybeusedin/usr/shareforthispurpose. NotethatLinuxcurrentlyusesDBM-formatdatabasefiles.Whilethesearenotarchitecture-independent,theyareallowedin/usr/shareasashort-termmeasurependingananticipated switchtotheDB2.0format.DB2.0usesanarchitectureindependentformat. Gamedatastoredin/usr/lib/gamesshouldbepurelystaticdata.Anymodifiablefiles,suchas scorefiles,gameplaylogs,andsoforth,shouldbeplacedin/var/games. Itisrecommendedthatapplication-specific,architecture-independentdirectoriesbeplacedhere. Suchdirectoriesincludegroff,perl,ghostscript,texmf,andkbd(Linux)orsyscons(BSD). Theymay,however,beplacedin/usr/libforbackwardscompatibility,atthedistributor’s discretion.Similarly,a/usr/lib/gameshierarchymaybeusedinadditiontothe /usr/share/gameshierarchyifthedistributorwishestoplacesomegamedatathere. 4.9.1/usr/share/dict:Wordlists Recommendedfilesfor/usr/share/dict:

{words}

TraditionallythisdirectorycontainsonlytheEnglishwordsfile,whichisusedbylook(1)and variousspellingprograms.wordsmayuseeitherAmericanorBritishspelling.Sitesthatrequire

bothmaylinkwordsto/usr/share/dict/american-englishor

-21-FilesystemHierarchyStandard January8,1996

/usr/share/dict/british-english.

WordlistsforotherlanguagesmaybeaddedusingtheEnglishnameforthatlanguage,e.g.,

/usr/share/dict/french,/usr/share/dict/danish,etc.Theseshould,ifpossible,useanISO

8859charactersetwhichisappropriateforthelanguageinquestion;ifpossibletheLatin1(ISO 8859-1)charactersetshouldbeused(thisisoftennotpossible). Otherwordlists,suchastheweb2"dictionary"shouldbeincludedhere,ifpresent. BEGINRATIONALE Thereasonthatonlywordlistsarelocatedhereisthattheyaretheonlyfilescommontoallspell checkers. ENDRATIONALE 4.9.2/usr/share/man:Manualpages Thissectiondetailstheorganizationformanualpagesthroughoutthesystem,including

/usr/share/man.Alsorefertothesectionon/var/cache/man.
Manualpagesarestoredin<mandir>/<locale>/man[1-9]/<arch>.
Anexplanationof<mandir>,<locale>,and<arch>

isgivenbelow. <mandir>/<locale>—Amanualpagehierarchy

man1

Userprograms

man2

Systemcalls

man3

Libraryfunctionsandsubroutines

man4

Devices

man5

Fileformats

man6

Games

man7

Miscellaneous

man8

Systemadministration

man9

Kernelinternalvariablesandfunctions Theprimary<mandir>ofthesystemis/usr/share/man./usr/share/mancontainsmanual informationforcommandsanddataunderthe/and/usrfilesystems.Obviously,thereareno manualpagesin/becausetheyarenotrequiredatboottimenoraretheyrequiredin emergencies. Provisionsmustbemadeinthestructureof/usr/share/mantosupportmanualpageswhichare writtenindifferent(ormultiple)languages.Theseprovisionsmusttakeintoaccountthestorage andreferenceofthesemanualpages.Relevantfactorsincludelanguage(includinggeographicalbaseddifferences),andcharactercodeset. Thisnamingoflanguagesubdirectoriesof/usr/share/manisbasedonAppendixEofthePOSIX 1003.1standardwhichdescribesthelocaleidentificationstring—themostwell-acceptedmethod todescribeaculturalenvironment.The<locale>stringis: -22-FilesystemHierarchyStandard January8,1996

<language>[_<territory>][.<character-set>][,<version>]

The<language>fieldshallbetakenfromISO639(acodefortherepresentationofnamesof languages).Itshallbetwocharacterswideandspecifiedwithlowercaselettersonly. The<territory>fieldshallbethetwo-lettercodeofISO3166(aspecificationofrepresentations ofcountries),ifpossible.(Mostpeoplearefamiliarwiththetwo-lettercodesusedforthecountry codesinemailaddresses.1)Itshallbetwocharacterswideandspecifiedwithuppercaseletters only. The<character-set>fieldshouldrepresentthestandarddescribingthecharacterset.Ifthe <character-set>fieldisjustanumericspecification,thenumberrepresentsthenumberofthe internationalstandarddescribingthecharacterset.Itisrecommendedthatthisbeanumeric representationifpossible(ISOstandards,especially),notincludeadditionalpunctuationsymbols, andthatanylettersbeinlowercase. Aparameterspecifyinga<version>oftheprofilemaybeplacedafterthe<character-set> field,delimitedbyacomma.Thismaybeusedtodiscriminatebetweendifferentculturalneeds; forinstance,dictionaryorderversusamoresystems-orientedcollatingorder.Thisstandard recommendsnotusingthe<version>field,unlessitisnecessary. Systemswhichuseauniquelanguageandcodesetforallmanualpagesmayomitthe<locale> substringandstoreallmanualpagesin<mandir>.Forexample,systemswhichonlyhaveEnglish manualpagescodedwithASCII,maystoremanualpages(theman[1-9]directories)directlyin /usr/share/man.(Thatisthetraditionalcircumstanceandarrangement,infact.) Countriesforwhichthereisawell-acceptedstandardcharactercodesetmayomitthe <character-set>field,butitisstronglyrecommendedthatitbeincluded,especiallyfor countrieswithseveral"competing"standards. Variousexamples: LanguageTerritoryCharacterSetDirectory

English—ASCII/usr/share/man/en

EnglishUnitedKingdomASCII/usr/share/man/en_GB EnglishUnitedStatesASCII/usr/share/man/en_US FrenchCanadaISO8859-1/usr/share/man/fr_CA FrenchFranceISO8859-1/usr/share/man/fr_FR

GermanGermanyISO646/usr/share/man/de_DE.646
GermanGermanyISO6937/usr/share/man/de_DE.6937
GermanGermanyISO8859-1/usr/share/man/de_DE.88591
GermanSwitzerlandISO646/usr/share/man/de_CH.646
JapaneseJapanJIS/usr/share/man/ja_JP.jis
JapaneseJapanSJIS/usr/share/man/ja_JP.sjis

JapaneseJapanUJIS(orEUC-J)/usr/share/man/ja_JP.ujis Similarly,provisionmustbemadeformanualpageswhicharearchitecture-dependent,suchas 1.

AmajorexceptiontothisruleistheUnitedKingdom,whichis‘GB’intheISO3166,but‘UK’formostemail addresses. -23-FilesystemHierarchyStandard January8,1996 device-driverdocumentationorlow-levelsystemadministrationcommands.Theseshouldbe placedunderan<arch>directoryintheappropriateman[1-9]directory;forexample,amanpage forthei386ctrlaltdel(8)commandmightbeplacedin

/usr/share/man/<locale>/man8/i386/ctlaltdel.8.

Manualpagesforcommandsanddataunder/usr/localarestoredin/usr/local/man.Manual pagesfortheXWindowSystemarestoredin/usr/X11R6/man.Itfollowsthatallmanualpage hierarchiesinthesystemshouldhavethesamestructureas/usr/share/man.Emptydirectories maybeomittedfromamanualpagehierarchy.Forexample,if/usr/local/manhasnomanual pagesinsection4(Devices),then/usr/local/man/man4maybeomitted. Thecatpagesections(cat[1-9])containingformattedmanualpageentriesarealsofoundwithin subdirectoriesof<mandir>/<locale>,butarenotrequirednorshouldtheybedistributedinlieu ofnroffsourcemanualpages. TheMHmailhandlingsystemmanualpagesshouldhavemhappendedtoallmanualpage filenames.AllXWindowSystemmanualpagesshouldhaveanxappendedtothefilename. Thepracticeofplacingvariouslanguagemanualpagesinappropriatesubdirectoriesof /usr/share/manalsoappliestotheothermanualpagehierarchies,suchas/usr/local/manand /usr/X11R6/man.(Thisportionofthestandardalsoapplieslaterinthesectionontheoptional

/var/cache/manstructure.)

Adescriptionofeachsectionfollows: •man1:Userprograms Manualpagesthatdescribepubliclyaccessiblecommandsarecontainedinthischapter. Mostprogramdocumentationthatauserwillneedtouseislocatedhere. •man2:Systemcalls Thissectiondescribesallofthesystemcalls(requestsforthekerneltoperformoperations). •man3:Libraryfunctionsandsubroutines Section3describesprogramlibraryroutinesthatarenotdirectcallstokernelservices.This andchapter2areonlyreallyofinteresttoprogrammers. •man4:Specialfiles Section4describesthespecialfiles,relateddriverfunctions,andnetworkingsupport availableinthesystem.Typically,thisincludesthedevicefilesfoundin/devandthekernel interfacetonetworkingprotocolsupport. •man5:Fileformats Theformatsformanynonintuitivedatafilesaredocumentedinthesection5.Thisincludes variousincludefiles,programoutputfiles,andsystemfiles. •man6:Games Thischapterdocumentsgames,demos,andgenerallytrivialprograms.Differentpeople havevariousnotionsabouthowessentialthisis. •man7:Miscellaneous Manualpagesthataredifficulttoclassifyaredesignatedasbeingsection7.Thetroffand othertextprocessingmacropackagesarefoundhere. •man8:Systemadministration Documentationforprogramsusedbysystemadministratorsforsystemoperationand -24-FilesystemHierarchyStandard January8,1996 maintenancearedocumentedhere.Someoftheseprogramsarealsooccasionallyusefulfor normalusers. •man9:Kernelinternalvariablesandfunctions Thisisusedonsystemsthatdocumentthekernelsourcecode. 4.9.3/usr/share/misc:Miscellaneousarchitecture-independentdata Thisdirectorycontainsmiscellaneousarchitecture-independentfileswhichdon’trequireaseparate subdirectoryunder/usr/share.Itisarequireddirectoryunder/usr/share. Thefollowingfiles,ifpresent,shouldbelocatedunder/usr/share/misc:

{ascii,magic,termcap,termcap.db}

Other(application-specific)filesmayappearhere,butadistributormayplacethemin/usr/lib attheirdiscretion.Somesuchfilesinclude:

{airport,birthtoken,eqnchar,getopt,gprof.callg,gprof.flat,inter.phone,
ipfw.samp.filters,ipfw.samp.scripts,keycap.pcvt,mail.help,mail.tildehelp,
man.template,map3270,mdoc.template,more.help,na.phone,nslookup.help,
operator,scsi_modes,sendmail.hf,style,units.lib,vgrindefs,vgrindefs.db,
zipcodes}

4.10/usr/src:Sourcecode Anynon-localsourcecodeshouldbeplacedinthissubdirectory. -25-FilesystemHierarchyStandard January8,1996 5.The/varHierarchy /var—Variabledata

account

Processaccountinglogs(ifsupported)

cache

Applicationcachedata

crash

Systemcrashdumps(ifsupported)

cron

cronandatjobs

games

Variablegamedata

lock

Lockfiles

log

Logfilesanddirectories

mail

Usermailboxfiles

opt

Variabledatafor/opt

run

Filesrelevanttorunningprocesses

spool

Applicationspooldata

state

Variablestateinformation

tmp

Temporaryfilespreservedbetweensystemreboots

yp

NetworkInformationService(NIS)databasefiles /varcontainsvariabledatafiles.Thisincludesspooldirectoriesandfiles,administrativeand loggingdata,andtransientandtemporaryfiles. Someportionsof/vararenotshareablebetweendifferentsystems.Forinstance,/var/log,

/var/lock,and/var/run.Otherportionsareshareable,notably/var/mail,/var/cache/man,
/var/cache/fonts,and/var/spool/news.

/varisspecifiedhereinordertomakeitpossibletomount/usrread-only.Everythingthatonce wentinto/usrthatiswrittentoduringsystemoperation(asopposedtoinstallationandsoftware maintenance)mustbein/var. If/varcannotbemadeaseparatepartition,itisoftenpreferabletomove/varoutoftheroot partitionandintothe/usrpartition.(Thisissometimesdonetoreducethesizeoftheroot partitionorwhenspacerunslowintherootpartition.)However,/varshouldnotbelinkedto /usrbecausethismakesseparationof/usrand/varmoredifficultandislikelytocreatea namingconflict.Instead,link/varto/usr/var. Applicationsshouldgenerallynotadddirectoriestothetoplevelof/var.Suchdirectoriesshould onlybeaddediftheyhavesomesystem-wideimplication,andinconsultationwiththeFHS mailinglist. Thecache,lock,log,run,spool,state,andtmpdirectoriesmustbeincludedandusedinall distributions;theaccount,crash,cron,games,mail,andypdirectoriesmustbeincludedand usedifthecorrespondingapplicationsorfeaturesareprovidedinthedistribution. Severaldirectoriesare‘reserved’inthesensethattheyshouldnotbeusedarbitrarilybysomenew application,sincetheywouldconflictwithhistoricaland/orlocalpractice.Theyare:

/var/backups
/var/local
/var/msgs
/var/preserve

-26-FilesystemHierarchyStandard January8,1996 5.1/var/account:Processaccountinglogs(ifsupported) Thisdirectoryholdsthecurrentactiveprocessaccountinglogandthecompositeprocessusage data(asusedbylastcommandsa).Asofthedateofthisreleaseofthestandard,process accountingwasnotsupportedunderLinux. 5.2/var/cache:Applicationcachedata /var/cache—Cachedirectories

fonts

Locally-generatedfonts

man

Locally-formattedmanualpages

www

WWWproxyorcachedata

<package>

Packagespecificcachedata /var/cacheisintendedforcacheddatafromapplications.Suchdataislocallygeneratedasa resultoftimeconsumingI/Oorcalculation.Theapplicationmustbeabletoregenerateor restorethedata.Unlike/var/spool,thecachedfilescanbedeletedwithoutdataloss.Thedata shouldremainvalidbetweeninvocationsoftheapplicationandrebootingthesystem. Fileslocatedunder/var/cachemaybeexpiredinanapplicationspecificmanner,bythesystem administrator,orboth.Theapplicationshouldalwaysbeabletorecoverfrommanualdeletionof files(generallybecauseofadiskspaceshortage).Nootherrequirementsaremadeonthedata formatofthecachedirectories. BEGINRATIONALE Theexistanceofaseparatedirectoryforcacheddataallowssystemadministratorstosetdifferent diskandbackuppoliciesfromotherdirectoriesin/var. ENDRATIONALE 5.2.1/var/cache/fonts:Locally-generatedfonts Thedirectory/var/cache/fontsshouldbeusedtostoreanydynamically-createdfonts.In particular,/var/cache/fonts/pkwillstoreallofthefontswhichareautomaticallygeneratedby

MakeTeXPK.
Thereshouldbealinkfrom/usr/lib/texmf/fonts/tmpto/var/cache/fonts.Thislinkallows

userstousesinglepath/usr/lib/texmf/fonts/tfmwhenmakingchangestotheirTEXFONTS environmentvariable.(ThisisthedefaultpathforKarlBerry’sTEXtools,distributedfrom ftp.cs.umb.edu:/pub/tex.2IfanotherTEXdistributionisused,alinkfromtheappropriatefont directoryto/var/cache/fontsshouldbemade.) TheMakeTeXPKthatisdistributedwithdvipskwillplace.pkfilesin

fonts/pk/<device>/<fontname>(e.g.,fonts/pk/CanonCX/cmr10.300pk).The.pkfilescanbe

periodicallypurgedfromthe/var/cache/fontstree,orcanbemovedintothe/usr/lib/texmf tree.Ifautomatic.mfor.tfmgeneratorsareused,theyshouldplacetheirdatainthemfortfm subdirectoriesof/var/cache/fonts. 2.

ThereasonthatKarlBerry’stoolsarementionedisthattheyarethede-factostandardforUNIXinstallationsof TEX.ThesetoolsarewidelyusedinthefreeUNIXcommunity. -27-FilesystemHierarchyStandard January8,1996 Otherdynamicallycreatedfontsmayalsobeplacedinthistree,underappropriately-named subdirectoriesof/var/cache/fonts. 5.2.2/var/cache/man:Locally-formattedmanualpages(optional) Thisdirectoryprovidesastandardlocationforsitesthatprovidearead-only/usrpartition,but wishtoallowcachingoflocally-formattedmanpages.Sitesthatmount/usraswritable(e.g., single-userinstallations)maychoosenottouse/var/cache/manandmaywriteformattedman pagesintothecat[1-9]directoriesin/usr/share/mandirectly.Werecommendthatmostsites useoneofthefollowingoptionsinstead: •Preformatallmanualpagesalongsidetheunformattedversions. •Allownocachingofformattedmanpages,andrequireformattingtobedoneeachtimea manpageisbroughtup. •Allowlocalcachingofformattedmanpagesin/var/cache/man. Thestructureof/var/cache/manneedstoreflectboththefactofmultiplemanpagehierarchies andthepossibilityofmultiplelanguagesupport. Givenanunformattedmanualpagethatnormallyappearsin /usr/<path>/man/<locale>/man[1-9],thecachedformattedversionshouldgoin

/var/cache/man/<path>/<locale>/cat[1-9].(Notethatthe<locale>componentmaybe

missing.)Foramanualpagethatnormallyappearsoutside/usr,in /<path>/man/<locale>/man[1-9],thecachedformattedversionshouldgoin

/var/cache/man/<path>/<locale>/cat[1-9].The<path>componentisabsentinthecaseof
/usr/share/manand/var/cache/man.
Forexample,/usr/share/man/man1/ls.1isformattedinto/var/cache/man/cat1/ls.1,and
/usr/X11R6/man/<locale>/man3/XtClass.3xinto
/var/cache/man/X11R6/<locale>/cat3/XtClass.3x.

Manpageswrittento/var/cache/man/cat[1-9]mayeventuallybetransferredto

/usr/<path>/cat[1-9]orexpired;likewiseformattedmanpagesin/usr/<path>/cat[1-9]may

beexpirediftheyarenotaccessedforaperiodoftime. Ifpreformattedmanualpagescomewithasystemonread-onlymedia(aCD-ROM,forinstance), theyshallbeinstalledinto/usr/<path>/cat[1-9]./var/cache/manisreservedasawritable cacheforformattedmanualpages. BEGINRATIONALE Release1.2ofthestandardspecified/var/catmanforthishierarchy.Thepathhasbeenchanged to/var/cachetobetterreflectthedynamicnatureoftheformattedmanpages.Thedirectory namehasbeenchangedtomantoallowforenhancingthehierarchytoincludepost-processed formatsotherthan"cat",suchasPostScript,HTML,orDVI. ENDRATIONALE 5.3/var/crash:Systemcrashdumps(ifsupported) Thisdirectoryholdssystemcrashdumps.Asofthedateofthisreleaseofthestandard,system crashdumpswerenotsupportedunderLinux. -28-FilesystemHierarchyStandard January8,1996 5.4/var/cron:cronandatjobs Thisdirectorycontainsthevariabledataforthecronandatprocesses. BEGINRATIONALE PreviousLinuxreleases,aswellasmostcommercialvendors,use/var/spoolforcron.Giventhe definitionof/var/spool,itwasjudgedreasonabletomovecronelsewhereinthe/varhierarchy. PrecedentfromBSDUNIXsuggestedusing/var/cronratherthan/var/state/cron. Combiningcronandatinthishierarchyassumesthatafreecronthatincludesatfunctionality willbeimplementedinthefuture. ENDRATIONALE 5.5/var/games:Variablegamedata Anyvariabledatarelatingtogames,suchasthosein/usr/games,shouldbeplacedhere. /var/gamesshouldholdthevariabledatapreviouslyfoundin/usr;staticdata,suchashelptext, leveldescriptions,andsoon,shouldremainelsewhere,suchas/usr/lib/games. BEGINRATIONALE /var/gameshasbeengivenahierarchyofitsown,ratherthanleavingitmergedinwiththeold /var/libasinrelease1.2.Theseparationallowslocalcontrolofbackupstrategies,permissions, anddiskusage,aswellasallowinginter-hostsharingandreducingclutterin/var/state. Additionally,/var/gamesisthepathtraditionallyusedbyBSD. ENDRATIONALE 5.6/var/lock:Lockfiles Lockfilesshouldbestoredwithinthe/var/lockdirectorystructure. Devicelockfiles,suchastheserialdevicelockfilesthatwereoriginallyfoundineither

/usr/spool/locksor/usr/spool/uucp,mustnowbestoredin/var/lock.Thenaming

conventionwhichmustbeusedisLCK..followedbythebasenameofthedevice.Forexample,to lock/dev/cua0thefileLCK..cua0wouldbecreated. TheformatusedfordevicelockfilesmustbetheHDBUUCPlockfileformat.TheHDBformat istostoretheprocessidentifier(PID)asatenbyteASCIIdecimalnumber,withatrailing newline.Forexample,ifprocess1230holdsalockfile,itwouldcontaintheelevencharacters: space,space,space,space,space,space,one,two,three,zero,andnewline. Then,anythingwishingtouse/dev/cua0canreadthelockfileandactaccordingly(alllocksin /var/lockshouldbeworld-readable). 5.7/var/log:Logfilesanddirectories Thedirectorycontainsmiscellaneouslogfiles.Mostlogsshouldbewrittentothisdirectoryoran appropriatesubdirectory. lastlogrecordoflastloginofeachuser messagessystemmessagesfromsyslogd -29-FilesystemHierarchyStandard January8,1996 wtmprecordofallloginsandlogouts 5.8/var/opt:Variabledatafor/opt Variabledatashouldbeinstalledin/var/opt/<package>,where<package>isthenameofthe subtreein/optwherethestaticdatafromanadd-onsoftwarepackageisstored,exceptwhere supersededbyanotherfilein/etc.Nostructureisimposedontheinternalarrangementof

/var/opt/<package>.

BEGINRATIONALE Refertotherationalefor/opt. ENDRATIONALE 5.9/var/run:Run-timevariablefiles Thisdirectorycontainssysteminformationfilesdescribingthesystemsinceitwasbooted.Files inthisdirectoryshouldbecleared(removedortruncatedasappropriate)atthebeginningofthe bootprocess. Processidentifier(PID)files,whichwereoriginallyplacedin/etc,shouldbeplacedin/var/run. ThenamingconventionforPIDfilesis<program-name>.pid.Forexample,thecrondPIDfileis

named/var/run/crond.pid.

TheinternalformatofPIDfilesremainsunchanged.Thefileshouldconsistoftheprocess identifierinASCII-encodeddecimal,followedbyanewlinecharacter.Forexample,ifcrondwas processnumber25,/var/run/crond.pidwouldcontainthreecharacters:two,five,andnewline. ProgramsthatreadPIDfilesshouldbesomewhatflexibleinwhattheyaccept;i.e.,theyshould ignoreextrawhitespace,leadingzeroes,absenceofthetrailingnewline,oradditionallinesinthe PIDfile.ProgramsthatcreatePIDfilesshouldusethesimplespecificationlocatedintheabove paragraph. Theutmpfile,whichstoresinformationaboutwhoiscurrentlyusingthesystem,islocatedinthis directory. ProgramsthatmaintaintransientUNIX-domainsocketsshouldplacetheminthisdirectory. 5.10/var/spool:Applicationspooldata /var/spool—Spooldirectories

lpd

Printerspooldirectory

mqueue

Outgoingmailqueue

news

Newsspooldirectory

rwho

Rwhodfiles

smail

Spooldirectoriesforsmail

uucp

SpooldirectoryforUUCP /var/spoolcontainsdatawhichisawaitingsomekindoflaterprocessing.Datain/var/spool -30-FilesystemHierarchyStandard January8,1996 representsworktobedoneinthefuture(byaprogram,user,oradministrator);oftendatais deletedafterithasbeenprocessed. UUCPlockfilesmustbeplacedin/var/lock.Seetheabovesectionon/var/lock. 5.10.1/var/spool/lpd:Line-printerdaemonprintqueues /var/spool/lpd—Printerspooldirectory

<printer>

Spoolsforaspecificprinter(optional) Thelockfileforlpd,lpd.lock,shouldbeplacedin/var/spool/lpd.Itissuggestedthatthe lockfileforeachprinterbeplacedinthespooldirectoryforthatspecificprinterandnamedlock. 5.10.2/var/spool/rwho:Rwhodfiles Thisdirectoryholdstherwhodinformationforothersystemsonthelocalnet. BEGINRATIONALE PreviousBSDreleasesused/var/rwhoforthisdata;givenitsclosefittothedefinitionof ‘spooled’data,anditshistoricalprecedentin/var/spoolonothersystems,amovewasdeemed appropriate. ENDRATIONALE 5.11/var/state:Variablestateinformation /var/state—Variablestateinformation

<editor>

Savedfilesaftercrashandothereditorstate

misc

Miscellaneousstatedata

xdm

Xdisplaymanagervariabledata

<pkgtool>

Packagingsupportfiles

<package>

Statedataforpackagesandsubsystems Thishierarchyholdsstateinformationpertainingtoanapplicationorthesystem.State informationisdatathatprogramsmodifywhiletheyrun,andthatpertainstoonespecifichost. Usersshouldneverneedtomodifyfilesin/var/statetoconfigureapackage’soperation. Stateinformationisgenerallyusedtopreservetheconditionofanapplication(oragroupofinterrelatedapplications)betweeninvocationsandbetweendifferentinstancesofthesameapplication. Stateinformationshouldgenerallyremainvalidafterareboot,shouldnotbeloggingoutput,and shouldnotbespooleddata. -31-FilesystemHierarchyStandard January8,1996 Anapplication(oragroupofinter-relatedapplications)shoulduseasubdirectoryof/var/state foritsdata.Thereisonerequiredsubdirectory,/var/state/misc,whichisintendedforstate filesthatdon’tneedasubdirectory;theothersubdirectoriesshouldonlybepresentifthe applicationinquestionisincludedinthedistribution. /var/state/<name>isthelocationthatshouldbeusedforalldistributionpackagingsupport. Differentdistributionsmayutilizedifferentnames,ofcourse. BEGINRATIONALE Previousreleasesofthestandardusedthename/var/lib.However,/usr/libisincreasingly usedsolelyforobjectfilesorarchivesofthem;thisistrueofthecurrentBSDUNIXvariantsas wellascurrentGNUpackages.Accordingly,thename/var/libseemedinappropriate. BSDusedthename/var/dbforasimilardirectory.Thisnameseemedoverlyconstricting,asit impliedadirectorystructureintendedprimarilyfordatabase(.db)files. ENDRATIONALE 5.11.1/var/state/<editor>:Savedfilesaftercrashandothereditor state Thesedirectoriescontainsavedfilesgeneratedbyanyunexpectedterminationofaneditor(e.g., elvis,jove,nvi). Othereditorsmaynotrequireadirectoryforcrash-recoveryfiles,butmayrequireawell-defined placetostoreotherinformationwhiletheeditorisrunning.Thisinformationshouldbestoredin asubdirectoryunder/var/state(forexample,GNUEmacswouldplacelockfilesin

/var/state/emacs/lock).

Futureeditorsmayrequireadditionalstateinformationbeyondcrash-recoveryfilesandlockfiles --thisinformationshouldalsobeplacedunder/var/state/<editor>. BEGINRATIONALE PreviousLinuxreleases,aswellasallcommercialvendors,use/var/preserveforvioritsclones. However,eacheditorusesitsownformatforthesecrash-recoveryfiles,soaseparatedirectoryis neededforeacheditor. Editor-specificlockfilesareusuallyquitedifferentfromthedeviceorresourcelockfilesthatare storedin/var/lockand,hence,arestoredunder/var/state. ENDRATIONALE 5.11.2/var/state/misc:Miscellaneousvariabledata Thisdirectorycontainsvariabledatanotplacedinasubdirectoryin/var/state.Anattempt shouldbemadetouserelativelyuniquenamesinthisdirectorytoavoidnamespaceconflicts. Notethatfilespreviouslystoredin/var/dbinpreviousBSDreleasesaremovedhere.These includelocate.databaseandmountdtab,andthekernelsymboldatabase(s). -32-FilesystemHierarchyStandard January8,1996 5.12/var/tmp:Temporaryfilespreservedbetweensystemreboots The/var/tmpdirectoryismadeavailableforprogramsthatrequiretemporaryfilesordirectories thatarepreservedbetweensystemreboots.Therefore,datastoredin/var/tmpismorepersistent thandatain/tmp. Filesanddirectorieslocatedin/var/tmpmustnotbedeletedwhenthesystemisbooted. Althoughdatastoredin/var/tmpistypicallydeletedinasite-specificmanner,itisrecommended thatdeletionsoccuratalessfrequentintervalthan/tmp. 5.13/var/yp:NetworkInformationService(NIS)databasefiles VariabledatafortheNetworkInformationService(NIS),formerlyknownastheSunYellowPages (YP),shallbeplacedinthisdirectory. BEGINRATIONALE /var/ypisthestandarddirectoryforNIS(YP)dataandisalmostexclusivelyusedinNIS documentationandsystems. NISshouldnotbeconfusedwithSunNIS+,whichusesadifferentdirectory,/var/nis. ENDRATIONALE FilesystemHierarchyStandard January8,1996 6.OperatingSystemSpecificAnnex Thissectionisforadditionalrequirementsandrecommendationsthatonlyapplytoaspecific operatingsystem.Thematerialinthissectionshouldneverconflictwiththebasestandard. 6.1Linux ThisistheannexfortheLinuxoperatingsystem. 6.1.1/ OnLinuxsystems,ifthekernelislocatedin/,werecommendusingthenamesvmlinuxor vmlinuz,whichhavebeenusedinrecentLinuxkernelsourcepackages. 6.1.2/dev Alldevicesandspecialfilesin/devshouldadheretotheLinuxAllocatedDevicesdocument,which isavailablewiththeLinuxkernelsource.ItismaintainedbyH.PeterAnvin<hpa@zytor.com>. Symboliclinksin/devshouldnotbedistributedwithLinuxsystemsexceptasprovidedinthe LinuxAllocatedDevicesdocument. BEGINRATIONALE Therequirementnottomakesymlinkspromiscuouslyismadebecauselocalsetupswilloftendiffer fromthatonthedistributor’sdevelopmentmachine.Also,ifadistributioninstallscript configuresthesymboliclinksatinstalltime,thesesymlinkswilloftennotgetupdatediflocal changesaremadeinhardware.Whenusedresponsiblyatalocallevel,however,theycanbeput togooduse. ENDRATIONALE 6.1.3/sbin Linuxsystemsplacetheseadditionalfilesinto/sbin. •Secondextendedfilesystemcommands(optional):

{badblocks,dumpe2fs,e2fsck,mke2fs,mklost+found,tune2fs}

•Boot-loadermapinstaller:

{lilo}

Optionalfilesfor/sbin: •Staticbinaries:

{ldconfig,sln,ssync}

Staticln(sln)andstaticsync(ssync)areusefulwhenthingsgowrong.Theprimaryuse ofsln(torepairincorrectsymlinksin/libafterapoorlyorchestratedupgrade)isnolonger -34-FilesystemHierarchyStandard January8,1996 amajorconcernnowthattheldconfigprogram(usuallylocatedin/usr/sbin)existsand canactasaguidinghandinupgradingthedynamiclibraries.Staticsyncisusefulinsome emergencysituations.Notethattheseneednotbestaticallylinkedversionsofthestandard lnandsync,butmaybe. Theldconfigbinaryisoptionalfor/sbinsinceasitemaychoosetorunldconfigatboot time,ratherthanonlywhenupgradingthesharedlibraries.(It’snotclearwhetherornotit isadvantageoustorunldconfigoneachboot.)Evenso,somepeoplelikeldconfig aroundforthefollowing(alltoocommon)situation: (1)I’vejustremoved/lib/<file>. (2)Ican’tfindoutthenameofthelibrarybecauselsisdynamicallylinked,I’musing ashellthatdoesn’thavelsbuilt-in,andIdon’tknowaboutusing"echo*"asa replacement. (3)Ihaveastaticsln,butIdon’tknowwhattocallthelink. •Miscellaneous:

{ctrlaltdel,kbdrate}

Soastocopewiththefactthatsomekeyboardscomeupwithsuchahighrepeatrateasto beunusable,kbdratemaybeinstalledin/sbinonsomesystems. SincethedefaultactioninthekernelfortheCtrl-Alt-Delkeycombinationisaninstanthard reboot,itisgenerallyadvisabletodisablethebehaviorbeforemountingtherootfilesystem inread-writemode.SomeinitsuitesareabletodisableCtrl-Alt-Del,butothersmay requirethectrlaltdelprogram,whichmaybeinstalledin/sbinonthosesystems. 6.1.4/usr/include ThesesymboliclinksarerequiredifaCorC++compilerisinstalled.

/usr/include/asm->/usr/src/linux/include/asm-<arch>
/usr/include/linux->/usr/src/linux/include/linux

6.1.5/usr/src TheonlysourcecodethatshouldbeplacedinaspecificlocationistheLinuxkernelsourcecode.

Itislocatedin/usr/src/linux.

IfaCorC++compilerisinstalled,butthecompleteLinuxkernelsourcecodeisnotinstalled, thentheincludefilesfromthekernelsourcecodeshallbelocatedinthesedirectories:

/usr/src/linux/include/asm-<arch>
/usr/src/linux/include/linux

<arch>isthenameofthesystemarchitecture. Note:/usr/src/linuxmaybeasymboliclinktoakernelsourcecodetree. -35-FilesystemHierarchyStandard January8,1996 BEGINRATIONALE Itisimportantthatthekernelincludefilesbelocatedin/usr/src/linuxandnotin /usr/includesotherearenoproblemswhensystemadministratorsupgradetheirkernelversion forthefirsttime. ENDRATIONALE FilesystemHierarchyStandard January8,1996 TheFHSmailinglist TheFHSmailinglistislocatedat<fhs-discuss@ucsd.edu>.Tosubscribetothelistsendmailto <listserv@ucsd.edu>withbody"ADDfhs-discuss". ThankstoNetworkOperationsattheUniversityofCaliforniaatSanDiegowhoallowedustouse theirexcellentmailinglistserver. Asnotedintheintroduction,pleasedonotsendmailtothemailinglistwithoutfirstcontacting theFHSeditororalistedcontributor. Acknowledgments Thedevelopersofthe3swishtothankthedevelopers,systemadministrators,anduserswhose inputwasessentialtothisstandard.Wewishtothankeachofthecontributorswhohelpedto write,compile,andcomposethisstandard. TheFHSGroupalsowishestothankthoseLinuxdeveloperswhosupportedtheFSSTND,the predecessortothisstandard.Iftheyhadn’tdemonstratedthattheFSSTNDwasbeneficial,the FHScouldneverhaveevolved. Originalcontributors DrewEckhardt<drew@colorado.edu> IanJackson<ijackson@cus.cam.ac.uk> IanMcCloghrie<ian@ucsd.edu> DanielQuinlan<quinlan@pathname.com> MikeSangrey<mike@sojurn.lns.pa.us> DavidH.Silber<dhs@glowworm.firefly.com> TheodoreTs’o<tytso@athena.mit.edu> StephenTweedie<sct@dcs.ed.ac.uk> Additionalcontributors BrandonS.Allbery<bsa@kf8nh.wariat.org> KeithBostic<bostic@cs.berkeley.edu> RikFaith<faith@cs.unc.edu> StephenHarris<sweh@spuddy.mew.co.uk> FredN.vanKempen<waltje@infomagic.com> JohnA.Martin<jmartin@acm.org> ChrisMetcalf<metcalf@lcs.mit.edu> IanMurdock<imurdock@debian.org> DavidC.Niemi<niemidc@clark.net> EricS.Raymond<esr@thyrsus.com> -37-CONTENTS 1.

Introduction ........................................................................................................................1 1.1 StatusoftheStandard ................................................................................................1 1.2 OrganizationoftheStandard ......................................................................................1 1.3 Conventions .................................................................................................................1 1.4 BackgroundoftheFHS ...............................................................................................2 1.5 Scope ...........................................................................................................................2 1.6 Objectives ...................................................................................................................3 1.7 IntendedAudience ......................................................................................................3 1.8 ConformancewiththisDocument ...............................................................................3 2.

TheFilesystem ....................................................................................................................5 3.

TheRootDirectory .............................................................................................................7 3.1 /bin:Essentialusercommandbinaries(forusebyallusers)

.....................................8 3.2 /boot:Staticfilesofthebootloader ..........................................................................9 3.3 /dev:Devicefiles ......................................................................................................10 3.4 /etc:Host-specificsystemconfiguration ...................................................................10 3.5 /home:Userhomedirectories(optional)

..................................................................11 3.6 /lib:Essentialsharedlibrariesandkernelmodules ..................................................12 3.7 /mnt:Mountpointfortemporarilymountedfilesystems .........................................12 3.8 /opt:Add-onapplicationsoftwarepackages ............................................................12 3.9 /proc:Kernelandprocessinformationvirtualfilesystem ........................................13 3.10 /root:Homedirectoryfortherootuser(optional)

..................................................13 3.11 /sbin:Systembinaries(binariesoncekeptin/etc)

..................................................14 3.12 /tmp:Temporaryfiles ..............................................................................................14 4.

The/usrHierarchy ............................................................................................................16 4.1 /usr/X11R6:XWindowSystem,Version11Release6 ............................................17 4.2 /usr/X386:XWindowSystem,Version11Release5,onx86platforms .................17 4.3 /usr/bin:Mostusercommands ................................................................................17 4.4 /usr/include:Directoryforstandardincludefiles.

...................................................18 4.5 /usr/lib:Librariesforprogramming .........................................................................18 4.6 /usr/libexec:Internalbinaries ..................................................................................19 4.7 /usr/local:Localhierarchy .......................................................................................20 4.8 /usr/sbin:Non-essentialstandardsystembinaries ...................................................20 4.9 /usr/share:Architecture-independentdata ..............................................................20 4.10 /usr/src:Sourcecode ...............................................................................................25 5.

The/varHierarchy ............................................................................................................26 5.1 /var/account:Processaccountinglogs(ifsupported)

..............................................27 5.2 /var/cache:Applicationcachedata .........................................................................27 5.3 /var/crash:Systemcrashdumps(ifsupported)

.......................................................28 5.4 /var/cron:cronandatjobs ......................................................................................29 5.5 /var/games:Variablegamedata ..............................................................................29 5.6 /var/lock:Lockfiles .................................................................................................29 5.7 /var/log:Logfilesanddirectories ............................................................................29 5.8 /var/opt:Variabledatafor/opt ..............................................................................30 5.9 /var/run:Run-timevariablefiles .............................................................................30 5.10 i /var/spool:Applicationspooldata ..........................................................................30 5.11 /var/state:Variablestateinformation .....................................................................31 5.12 /var/tmp:Temporaryfilespreservedbetweensystemreboots ................................33 5.13 /var/yp:NetworkInformationService(NIS)databasefiles .....................................33 6.

OperatingSystemSpecificAnnex .....................................................................................34 6.1 Linux .........................................................................................................................34