Slackware Linux Essentials
Slackware Linux Essentials
Preface 1AnIntroductiontoSlackwareLinux 1.1WhatisLinux? 1.1.1AWordonGNU 1.2WhatisSlackware? 1.3OpenSourceandFreeSoftware 2Help 2.1SystemHelp 2.1.1man 2.1.2The/usr/docDirectory 2.1.3HOWTOsandminiHOWTOs 2.2OnlineHelp 2.2.1TheOfficialWebsiteandHelpForums 2.2.2EmailSupport 2.2.3NonOfficialWebsitesandHelpForums 3Installation 3.1GettingSlackware 3.1.1TheOfficialDiscandBoxSets 3.1.2ViatheInternet 3.2SystemRequirements 3.2.1TheSoftwareSeries 3.2.2InstallationMethods 3.2.3BootDisk 3.2.4RootDisk 3.2.5SupplementalDisk 3.2.6MakingtheDisks 3.3Partitioning 3.4ThesetupProgram 3.4.1HELP 3.4.2KEYMAP 3.4.3ADDSWAP 3.4.4TARGET 3.4.5SOURCE 3.4.6SELECT 3.4.7INSTALL 3.4.8CONFIGURE 4SystemConfiguration 4.1SystemOverview 4.1.1FileSystemLayout 4.1.2FindingFiles
4.1.3The/etc/rc.dDirectory 4.2SelectingaKernel 4.2.1The/kernelsDirectoryontheSlackwareCDROM 4.2.2CompilingaKernelfromSource 4.2.3UsingKernelModules 5NetworkConfiguration 5.1Introduction:netconfigisyourfriend. 5.2NetworkHardwareConfiguration 5.2.1LoadingNetworkModules 5.2.2LAN(10/100/1000BaseTandBase2)cards 5.2.3Modems 5.2.4PCMCIA 5.3TCP/IPConfiguration 5.3.1DHCP 5.3.2StaticIP 5.3.3/etc/rc.d/rc.inet1.conf 5.3.4/etc/resolv.conf 5.3.5/etc/hosts 5.4PPP 5.4.1pppsetup 5.4.2/etc/ppp 5.5Wireless 5.5.1HardwareSupport 5.5.2ConfiguretheWirelessSettings 5.5.3ConfiguretheNetwork 5.6NetworkFileSystems 5.6.1SMB/Samba/CIFS 5.6.2NetworkFileSystem(NFS) 6XConfiguration 6.1xorgconfig 6.2xorgsetup 6.3xinitrc 6.4xwmconfig 6.5xdm 7Booting 7.1LILO 7.2LOADLIN 7.3DualBooting 7.3.1Windows 7.3.2Linux
8TheShell 8.1Users 8.1.1LoggingIn 8.1.2Root:TheSuperuser 8.2TheCommandLine 8.2.1RunningPrograms 8.2.2WildcardMatching 8.2.3Input/OutputRedirectionandPiping 8.3TheBourneAgainShell(bash) 8.3.1EnvironmentVariables 8.3.2TabCompletion 8.4VirtualTerminals 8.4.1Screen 9FilesystemStructure 9.1Ownership 9.2Permissions 9.3Links 9.4MountingDevices 9.4.1fstab 9.4.2mountandumount 9.5NFSMounts 10HandlingFilesandDirectories 10.1Navigation:ls,cd,andpwd 10.1.1ls 10.1.2cd 10.1.3pwd 10.2Pagers:more,less,andmost 10.2.1more 10.2.2less 10.2.3most 10.3SimpleOutput:catandecho 10.3.1cat 10.3.2echo 10.4Creation:touchandmkdir 10.4.1touch 10.4.2mkdir 10.5CopyandMove
10.5.1cp 10.5.2mv 10.6Deletion:rmandrmdir 10.6.1rm 10.6.2rmdir 10.7Aliasingfileswithln 11ProcessControl 11.1Backgrounding 11.2Foregrounding 11.3ps 11.4kill 11.5top 12EssentialSystemAdministration 12.1UsersandGroups 12.1.1SuppliedScripts 12.1.2ChangingPasswords 12.1.3ChangingUserInformation 12.2UsersandGroups,theHardWay 12.3ShuttingDownProperly 13BasicNetworkCommands 13.1ping 13.2traceroute 13.3DNSTools 13.3.1host 13.3.2nslookup 13.3.3dig 13.4finger 13.5telnet 13.5.1Theotheruseoftelnet 13.6TheSecureshell 13.7email 13.7.1pine 13.7.2elm 13.7.3mutt 13.7.4nail 13.8Browsers 13.8.1lynx 13.8.2links 13.8.3wget 13.9FTPClients
13.9.1ftp 13.9.2ncftp 13.10TalkingtoOtherPeople 13.10.1wall 13.10.2talk 13.10.3ytalk 14Security 14.1DisablingServices 14.1.1Servicesstartedfrominetd 14.1.2Servicesstartedfrominitscripts 14.2HostAccessControl 14.2.1iptables 14.2.2tcpwrappers 14.3KeepingCurrent 14.3.1slackwaresecuritymailinglist 14.3.2The/patchesdirectory 15ArchiveFiles 15.1gzip 15.2bzip2 15.3tar 15.4zip 16Vi 16.1Startingvi 16.2Modes 16.2.1CommandMode 16.2.2InsertMode 16.3OpeningFiles 16.4SavingFiles 16.5Quittingvi 16.6viConfiguration 16.7ViKeys 17Emacs 17.1Startingemacs 17.1.1CommandKeys 17.2Buffers 17.3Modes 17.3.1Openingfiles 17.4BasicEditing
17.5SavingFiles 17.5.1QuittingEmacs 18SlackwarePackageManagement 18.1OverviewofPackageFormat 18.2PackageUtilities 18.2.1pkgtool 18.2.2installpkg 18.2.3removepkg 18.2.4upgradepkg 18.2.5rpm2tgz/rpm2targz 18.3MakingPackages 18.3.1explodepkg 18.3.2makepkg 18.3.3SlackBuildScripts 18.4MakingTagsandTagfiles(forsetup) 19ZipSlack 19.1WhatisZipSlack? 19.1.1Advantages 19.1.2Disadvantages 19.2GettingZipSlack 19.2.1Installation 19.3BootingZipSlack Glossary A.TheGNUGeneralPublicLicense A.1.Preamble A.2.TERMSANDCONDITIONS A.3.HowtoApplyTheseTermstoYourNewPrograms ListofTables 21.ManPageSections 31.SlackwareLinux,Inc.ContactInformation 32.SystemRequirements 33.SoftwareSeries 91.OctalPermissionValues 131.ftpcommands 161.Movement 162.Editing 163.Searching 164.SavingandQuitting 171.BasicEmacsEditingCommands 181.installpkgOptions 182.removepkgOptions
183.TagfileStatusOptions ListofFigures 41.KernelConfigurationMenu 61.xorgconfigMouseConfiguration 62.xorgconfigHorizontalSync 63.xorgconfigVerticalSync 64.xorgconfigVideoCard 65.DesktopConfigurationwithxorgconfig 71.liloconfig 72.liloconfigExpertMenu 111.Basicpsoutput 131.Telnettingtoawebserver 132.ThePinemainmenu 133.Elmmainscreen 134.Muttmainscreen 135.Lynxdefaultstartpage 136.Links,withthefilemenuopen 137.Twousersinatalksession 138.Twousersinaytalksession 161.Avisession. 181.Pkgtool'smainmenu. 182.Pkgtoolviewmode ListofExamples 81.ListingEnvironmentVariableswithset
Preface
IntendedAudience
TheSlackwareLinuxoperatingsystemisapowerfulplatformforIntelbasedcomputers.Itisdesigned tobestable,secure,andfunctionalasbothahighendserverandpowerfulworkstation. ThisbookisdesignedtogetyoustartedwiththeSlackwareLinuxoperatingsystem.It'snotmeantto covereverysingleaspectofthedistribution,butrathertoshowwhatitiscapableofandgiveyoua basicworkingknowledgeofthesystem. AsyougainexperiencewithSlackwareLinux,wehopeyoufindthisbooktobeahandyreference.We alsohopeyou'lllendittoallofyourfriendswhentheycomeaskingaboutthatcoolSlackwareLinux operatingsystemyou'rerunning. Whilethisbookmaynotanedgeofyourseatnovel,wecertainlytriedtomakeitasentertainingas possible.Withanyluck,we'llgetamoviedeal.Ofcourse,wealsohopeyouareabletolearnfromit andfindituseful. Andnow,onwiththeshow.
ChangesfromtheFirstEdition
Thissecondeditionistheculminationofyearsofhardworkbythededicatedmembersofthe SlackwareDocumentationProject.Thefollowingarethemajorchangesinthisnewedition: Chapter3,Installation,hasbeenmodifiedwithnewscreenshotsoftheinstaller,andreflects changesindisksets,andCDinstallation. Chapter4,SystemConfiguration,hasbeenupdatedwithnewinformationaboutLinux2.6.x kernels. Chapter5,NetworkConfiguration,hasbeenexpandedwithfurtherexplanationofSamba, NFS,andDHCP.Asectiononwirelessnetworkinghasalsobeenadded.Thischapternow reflectsmajorchangesinhowSlackwarehandlesnetworksetup. Chapter6,XWindowSystem,hasbeensubstantiallyrewrittenforXorgbasedsystems. Thischapternowalsocoversthexdmgraphicalloginmanager. Chapter13,BasicNetworkCommands,hasbeenenhancedwithinformationabout additionalnetworkutilities. Chapter14,Security,isanewchapterwiththisedition.Itexplainshowtokeepa SlackwareLinuxsystemsecure. Chapter17,Emacs,isanewchapterwiththisedition.ItdescribeshowtouseEmacs,a powerfuleditorforUnix. Chapter18,PackageManagement,hasbeenupdatedwithinformationaboutSlackBuild scripts. Therearemanyotherchanges,bothminorandmajor,toreflectchangesinSlackwareasit hasmatured.
OrganizationofthisBook
Chapter1,Introduction ProvidesintroductorymaterialonLinux,Slackware,andtheOpenSourceandFreeSoftware Movements. Chapter2,Help DescribesthehelpresourcesavailableonaSlackwareLinuxsystemandonline. Chapter3,Installation Describestheinstallationprocessstepbystepwithscreenshotstoprovideanillustrativewalk through. Chapter4,SystemConfiguration Describestheimportantconfigurationfilesandcoverskernelrecompilation. Chapter5,NetworkConfiguration DescribeshowtoconnectaSlackwareLinuxmachinetoanetwork.CoversTCP/IP,PPP/dial
up,wirelessnetworking,andmore. Chapter6,TheXWindowSystem DescribeshowtosetupandusethegraphicalXWindowSysteminSlackware. Chapter7,Booting DescribestheprocessbywhichacomputerbootsintoSlackwareLinux.Alsocoversdual bootingwithMicrosoftWindowsoperatingsystems. Chapter8,TheShell DescribesthepowerfulcommandlineinterfaceforLinux. Chapter9,FilesystemStructure Describesthefilesystemstructure,includingfileownership,permission,andlinking. Chapter10,HandlingFilesandDirectories Describesthecommandsusedtomanipulatefilesanddirectoriesfromthecommandline interface. Chapter11,ProcessControl DescribesthepowerfulLinuxprocessmanagementcommandsusedtomanagemultiplerunning applications. Chapter12,EssentialSystemAdministration Describesbasicsystemadministrationtaskssuchasaddingandremovingusers,shuttingdown thesystemproperly,andmore. Chapter13,BasicNetworkCommands DescribesthecollectionofnetworkclientsincludedwithSlackware. Chapter14,Security DescribesmanydifferenttoolsavailabletohelpkeepyourSlackwaresystemsecure,including iptablesandtcpwrappers. Chapter15,ArchiveFiles DescribesthedifferentcompressionandarchiveutilitiesavailableforLinux. Chapter16,vi Describesthepowerfulvitexteditor. Chapter17,Emacs DescribesthepowerfulEmacstexteditor.
Conventionsusedinthisbook
Toprovideaconsistentandeasytoreadtext,severalconventionsarefollowedthroughoutthebook.
TypographicConventions
Italic Anitalicfontisusedforcommands,emphasizedtext,andthefirstusageoftechnicalterms. Monospace Amonospacedfontisusedforerrormessages,commands,environmentvariables,namesof ports,hostnames,usernames,groupnames,devicenames,variables,andcodefragments. Bold Aboldfontisusedforuserinputinexamples.
UserInput
Keysareshowninboldtostandoutfromothertext.Keycombinationsthataremeanttobetyped simultaneouslyareshownwith`+'betweenthekeys,suchas: Ctrl+Alt+Del MeaningtheusershouldtypetheCtrl,Alt,andDelkeysatthesametime. Keysthataremeanttobetypedinsequencewillbeseparatedwithcommas,forexample: Ctrl+X,Ctrl+S WouldmeanthattheuserisexpectedtotypetheCtrlandXkeyssimultaneouslyandthentotypethe CtrlandSkeyssimultaneously.
Examples
ExamplesstartingwithE:\>indicateaMSDOScommand.Unlessotherwisenoted,these commandsmaybeexecutedfromaCommandPromptwindowinamodernMicrosoftWindows
environment.
D:\>rawritea:bare.i
Acknowledgments
Thisprojectistheaccumulationofmonthsofworkbymanydedicatedindividuals.Itwouldnothave beenpossibleformetoproducethisworkinavacuum.Manypeopledeserveourthanksfortheir selflessacts:KeithKellerforhisworkonwirelessnetworking,JoostKremersforhisgreatworkin singlehandedlywritingtheemacssection,SimonWilliamsforthesecuritychapter,JurgenPhillippaerts forbasicnetworkingcommands,CibaoCuAliGColibrifortheinspirationandagoodkickinthe pants.Countlessothershavesentinsuggestionsandfixes.Anincompletelistincludes:JacobAnhoej, JohnYast,SallyWelch,MorganLandry,andCharlieLaw.I'dalsoliketothankKeithKellerfor hostingthemailinglistforthisproject,aswellasCarlInglisfortheinitialwebhosting.Lastbutnotleast, I'dliketothankPatrickJ.VolkerdingforSlackwareLinux,andDavidCantrell,LoganJohnson,and ChrisLumensforSlackwareLinuxEssentials1stEdition.Withouttheirinitialframework,noneofthis wouldhaveeverhappened.Manyothershavecontributedinsmallandlargewaystothisprojectand havenotbeenlisted.Ihopetheywillforgivemeforapoormemory. AlanHicks,May2005
Chapter1AnIntroductiontoSlackware Linux
1.1WhatisLinux?
LinusTorvaldsstartedLinux,anoperatingsystemkernel,asapersonalprojectin1991.Hestartedthe projectbecausehewantedtorunaUnixbasedoperatingsystemwithoutspendingalotofmoney.In addition,hewantedtolearntheinsandoutsofthe386processor.Linuxwasreleasedfreeofchargeto thepublicsothatanyonecouldstudyitandmakeimprovementsundertheGeneralPublicLicense.(See Section1.3andAppendixAforanexplanationofthelicense.)Today,Linuxhasgrownintoamajor playerintheoperatingsystemmarket.Ithasbeenportedtorunonavarietyofsystemarchitectures,
1.1.1AWordonGNU
TheLinuxkernelprojectbeganasasoloendeavorbyLinusTorvaldsin1991,butasIsaacNewton oncesaid,IfIhaveseenfurther,itisbystandingontheshouldersofgiants.WhenLinusTorvalds beganthekerneltheFreeSoftwareFoundationhadalreadyestablishedtheideaofcollaborative software.TheyentitledtheireffortGNU,arecursiveacronymthatmeanssimplyGNU'sNotUnix. GNUsoftwareranatoptheLinuxkernelfromday1.Theircompilergccwasusedtocompilethe kernel.TodaymanyGNUtoolsfromgcctognutararestillatthebasisofeverymajorLinux distribution.ForthisreasonmanyoftheFreeSoftwareFoundation'sproponentsferventlystatethat theirworkshouldbegiventhesamecreditastheLinuxkernel.TheystronglysuggestthatallLinux distributionsshouldrefertothemselvesasGNU/Linuxdistributions. Thisisthetopicofmanyflamewars,surpassedonlybytheancientviversusemacsholywar.The purposeofthisbookisnottofanthefiresofthisheateddiscussion,butrathertoclarifytheterminology forneophytes.WhenoneseesGNU/LinuxitmeansaLinuxdistribution.WhenoneseesLinuxtheycan eitherbereferringtothekernel,ortoadistribution.Itcanberatherconfusing.Typicallytheterm GNU/Linuxisn'tusedbecauseit'samouthfull.
1.2WhatisSlackware?
Slackware,startedbyPatrickVolkerdinginlate1992,andinitiallyreleasedtotheworldonJuly17, 1993,wasthefirstLinuxdistributiontoachievewidespreaduse.VolkerdingfirstlearnedofLinuxwhen heneededaninexpensiveLISPinterpreterforaproject.Oneofthefewdistributionsavailableatthe timewasSLSLinuxfromSoftLandingSystems.VolkerdingusedSLSLinux,fixingbugsashefound them.Eventually,hedecidedtomergeallofthesebugfixesintohisownprivatedistributionthatheand hisfriendscoulduse.Thisprivatedistributionquicklygainedpopularity,soVolkerdingdecidedtoname itSlackwareandmakeitpubliclyavailable.Alongtheway,PatrickaddednewthingstoSlackwarea userfriendlyinstallationprogrambasedonamenuingsystem,aswellastheconceptofpackage management,whichallowsuserstoeasilyadd,remove,orupgradesoftwarepackagesontheirsystems. TherearemanyreasonswhySlackwareisLinux'soldestlivingdistribution.Itdoesnottrytoemulate Windows,ittriestobeasUnixlikeaspossible.Itdoesnottrytocoverupprocesseswithfancy,point andclickGUIs(GraphicalUserInterfaces).Instead,itputsusersincontrolbylettingthemseeexactly what'sgoingon.Itsdevelopmentisnotrushedtomeetdeadlineseachversioncomesoutwhenitis ready. Slackwareisforpeoplewhoenjoylearningandtweakingtheirsystemtodoexactlywhattheywant. Slackware'sstabilityandsimplicityarewhypeoplewillcontinuetouseitforyearstocome.Slackware currentlyenjoysareputationasasolidserverandanononsenseworkstation.YoucanfindSlackware desktopsrunningnearlyanywindowmanagerordesktopenvironment,ornoneatall.Slackware
serverspowerbusinesses,actingineverycapacitythataservercanbeusedin.Slackwareusersare amongthemostsatisfiedLinuxusers.Ofcourse,we'dsaythat.:^)
1.3OpenSourceandFreeSoftware
WithintheLinuxcommunity,therearetwomajorideologicalmovementsatwork.TheFreeSoftware movement(whichwe'llgetintoinamoment)isworkingtowardthegoalofmakingallsoftwarefreeof intellectualpropertyrestrictions.Followersofthismovementbelievetheserestrictionshampertechnical improvementandworkagainstthegoodofthecommunity.TheOpenSourcemovementisworking towardmostofthesamegoals,buttakesamorepragmaticapproachtothem.Followersofthis movementprefertobasetheirargumentsontheeconomicandtechnicalmeritsofmakingsourcecode freelyavailable,ratherthanthemoralandethicalprinciplesthatdrivetheFreeSoftwareMovement. Attheotherendofthespectrumaregroupsthatwishtomaintaintightercontrolsovertheirsoftware. TheFreeSoftwaremovementisheadedbytheFreeSoftwareFoundation,afundraisingorganization fortheGNUproject.Freesoftwareismoreofanideology.Theoftusedexpressionisfreeasin speech,notfreeasinbeer.Inessence,freesoftwareisanattempttoguaranteecertainrightsforboth usersanddevelopers.Thesefreedomsincludethefreedomtoruntheprogramforanyreason,tostudy andmodifythesourcecode,toredistributethesource,andtoshareanymodificationsyoumake.In ordertoguaranteethesefreedoms,theGNUGeneralPublicLicense(GPL)wascreated.TheGPL,in brief,providesthatanyonedistributingacompiledprogramwhichislicensedundertheGPLmustalso providesourcecode,andisfreetomakemodificationstotheprogramaslongasthosemodifications arealsomadeavailableinsourcecodeform.Thisguaranteesthatonceaprogramisopenedtothe community,itcannotbeclosedexceptbyconsentofeveryauthorofeverypieceofcode(eventhe modifications)withinit.MostLinuxprogramsarelicensedundertheGPL. ItisimportanttonotethattheGPLdoesnotsayanythingaboutprice.Asoddasitmaysound,youcan chargeforfreesoftware.Thefreepartisinthelibertiesyouhavewiththesourcecode,notinthe priceyoupayforthesoftware.(However,oncesomeonehassoldyou,orevengivenyou,acompiled programlicensedundertheGPLtheyareobligatedtoprovideitssourcecodeaswell.) AnotherpopularlicenseistheBSDlicense.IncontrasttotheGPL,theBSDlicensegivesno requirementforthereleaseofaprogram'ssourcecode.SoftwarereleasedundertheBSDlicense allowsredistributioninsourceorbinaryformprovidedonlyafewconditionsaremet.Theauthor's credentialscannotbeusedasasortofadvertisementfortheprogram.Italsoindemnifiestheauthor fromliabilityfordamagesthatmayarisefromtheuseofthesoftware.Muchofthesoftwareincludedin SlackwareLinuxisBSDlicensed. AttheforefrontoftheyoungerOpenSourcemovement,theOpenSourceInitiativeisanorganization thatsolelyexiststogainsupportforopensourcesoftware,thatis,softwarethathasthesourcecode availableaswellasthereadytorunprogram.Theydonotofferaspecificlicense,butinsteadthey supportthevarioustypesofopensourcelicensesavailable. TheideabehindtheOSIistogetmorecompaniesbehindopensourcebyallowingthemtowritetheir ownopensourcelicensesandhavethoselicensescertifiedbytheOpenSourceInitiative.Many companieswanttoreleasesourcecode,butdonotwanttousetheGPL.Sincetheycannotradically changetheGPL,theyareofferedtheopportunitytoprovidetheirownlicenseandhaveitcertifiedby thisorganization. WhiletheFreeSoftwareFoundationandtheOpenSourceInitiativeworktohelpeachother,theyare
Chapter2Help
Oftentherearetimeswhenyoumightneedhelpwithaspecificcommand,settingupaprogram,or gettingapieceofhardwaretowork.Maybeyousimplywanttounderstandagivencommandbetter,or seewhatotheroptionsareavailabletousewithit.Luckily,thereareavarietyofwaysthatyoucanget thehelpyou'relookingfor.WhenyouinstallSlackwareyouhavetheoptionofinstallingpackagesfrom theFserieswhichincludesFAQsandHOWTOs.Programsalsocomewithhelpabouttheiroptions, configurationfiles,andusage.
2.1SystemHelp
2.1.1man
Themancommand(shortformanual)isthetraditionalformofonlinedocumentationinUnixandLinux operatingsystems.Comprisedofspeciallyformattedfiles,themanpages,arewrittenforthevast majorityofcommandsandaredistributedwiththesoftwareitself.Executingmansomecommandwill displaythemanpagefor(naturally)thecommandspecified,inourexamplethiswouldbetheimaginary programsomecommand. Asyoumightimagine,theamountofmanpagescanquicklyaddup,becomingoverlyconfusingand seriouslycomplicated,evenforanadvanceduser.So,forthisreason,manpagesaregroupedinto enumeratedsections.Thissystemhasbeenaroundforaverylongtimeenoughsothatyouwilloften seecommands,programs,andevenprogramminglibraryfunctionsreferredtowiththeirmansection number. Forexample: Youmightseeareferencetoman(1).Thenumberingtellsyouthatmanisdocumentedinsection1 (usercommands)youcanspecifythatyouwantthesection1manpageformanwiththecommand man1man.Specifyingthesectionthatmanshouldlookinisusefulinthecaseofmultipleitemswiththe samename. Table21.ManPageSections Section Section1 Section2 Section3 Section4 Section5 Section6 Contents usercommands(introonly) systemcalls Clibrarycalls devices(e.g.,hd,sd) fileformatsandprotocols(e.g.,wtmp,/etc/passwd,nfs) games(introonly)
Section7 Section8
conventions,macropackages,etc.(e.g.,nroff,ascii) systemadministration(introonly)
Thecommandaproposisusedtosearchforamanpagecontainingagivenkeyword. Example:
%aproposwav cdda2wav(1)asamplingutilitythatdumpsCDaudiodataintowavsoundfiles netwave_cs(4)XircomCreditcardNetwavedevicedriver oggdec(1)simpledecoder,OggVorbisfiletoPCMaudiofile(WAVorRAW) wavelan(4)AT&TGISWaveLANISAdevicedriver wavelan_cs(4)AT&TGISWaveLANPCMCIAdevicedriver wvlan_cs(4)LucentWaveLAN/IEEE802.11devicedriver
Ifyou'dlikefurtherinformationonanyofthesecommands,readtheirmanpagesforthedetails.)
2.1.2The/usr/docDirectory
Thesourceformostpackagesthatwebuildcomeswithsomesortofdocumentation:READMEfiles, usageinstructions,licensefiles,etc.Anysortofdocumentationthatcomeswiththesourceisincluded andinstalledonyoursysteminthe/usr/docdirectory.Eachprogramwill(usually)installitsown documentationintheorderof:
/usr/doc/$program$version
Ifreadingtheappropriatemanpage(s)doesn'tprovideyouwithenoughinformation,oraddresswhat you'relookingforinparticular,the/usr/docdirectoryshouldbeyournextstop.
2.1.3HOWTOsandminiHOWTOs
ItisinthetruestspiritoftheOpenSourcecommunitythatbringsustotheHOWTO/miniHOWTO collection.Thesefilesareexactlywhattheysoundlikedocumentsandguidesdescribinghowtodo stuff.IfyouinstalledtheHOWTOcollection,theHOWTOswillbeinstalledto/usr/doc/Linux HOWTOsandtheminiHOWTOsto/usr/doc/LinuxminiHOWTOs. AlsoincludedinthesamepackageseriesisacollectionofFAQs,whichisanacronymwhichstandsfor Frequently Asked Questions ThesedocumentsarewritteninaQuestionandanswerstylefor(surprise)FrequentlyAsked Questions.TheFAQscanoftenbeaveryusefulplacetolookifyou'rejustlookingforaQuickFixto something.IfyoudecidetoinstalltheFAQsduringsetup,youwillfindtheminstalledtothe /usr/doc/LinuxFAQsdirectory. Thesefilesarewellworthreadingwheneveryou'renotquitesurehowtoproceedwithsomething.They coveranamazingrangeoftopics,moreoftenthannotinasurprisinglydetailedmanner.Goodstuff!
2.2OnlineHelp
InadditiontothedocumentationprovidedandinstallablewiththeSlackwareLinuxOperatingSystem, thereareavastmultitudeofonlineresourcesavailableforyoutolearnfromaswell.
2.2.1TheOfficialWebsiteandHelpForums
TheOfficialSlackwareWebsite TheOfficialSlackwareLinuxwebsiteissometimesoutofdate,butstillcontainsinformationrelevantto thelatestSlackwareversions.Atonetimeanactivehelpforumexistedtherebeforeahordeoftrolls, troublemakers,andwhinersdescendedontheforum.Maintainingtheforumwasbeginningtobetoo muchwork,andsoPatshutitdown.Onecanfindthatoldforumbackupandrunningcompletewith searchablearchivesoftheolddataathttp://www.userlocal.com/phorum/. Aftertheforumsweretakendownonhttp://slackware.com,severalothersitessprangupthatoffered forumsupportforSlackware.Aftermuchthought,Patchosetoendorsewww.linuxquestions.orgasthe officialforumforSlackwareLinux.
2.2.2EmailSupport
EveryonewhopurchasesanofficialCDsetisentitledtofreeinstallationsupportviaemailfromthe developer.Thathavingbeensaid,pleasekeepinmindthatwe,thedevelopers,(andavastmajorityof users)ofSlackwareareofTheOldSchool.Thatmeansthatweprefertohelpthosewhohavea sincereinterestandarewillingtohelpthemselvesintheprocess.Wewillalwaysdoourbesttohelp everyonewhoemailsuswithsupportquestions.However,Pleasecheckyourdocumentationandthe website(especiallytheFAQsandmaybesomeoftheforumslistedbelow)beforeemailing.Youmay getafasteranswerthatway,andthelessemailwehavetoanswer,obviouslythesoonerwewillbeof assistancetothosethatneedit.
Theemailaddressfortechnicalsupportis:[email protected] contactinformationarelistedonthewebsite. 2.2.2.1SlackwareLinuxProjectMailingLists Wehaveseveralmailinglists,availableindigestandnormalforms.Checktheinstructionsforhowto subscribe. Tosubscribetoamailinglist,email: [email protected] withthephrasesubscribe[nameoflist]inthebodyoftheemail.Thelistchoicesaredescribed below(useonethenamesbelowforthenameofthelist). ArchivesofthemailinglistcanbefoundonSlackware'swebsiteat: http://slackware.com/lists/archive/ slackwareannounce Theslackwareannouncemailinglistisforannouncementsofnewversions,majorupdatesand othergeneralinformation. slackwaresecurity Theslackwaresecuritymailinglistisforannouncementsrelatingtosecurityissues.Anyexploits orothervulnerabilitiesdirectlypertainingtoSlackwarewillgetpostedtothislistimmediately. Theselistsarealsoavailableindigestformat.Thismeansthatyougetonelargemessageperdayinstead ofseveralmessagesthroughouttheday.Sincetheslackwaremailinglistsdonotallowuserstopost,and thelistsaresuchlowtraffic,mostusersfindlittleadvantageinthedigestlists.Still,theyareavailableif youwantthembysubscribingtoslackwareannouncedigestorslackwaresecuritydigest.
2.2.3NonOfficialWebsitesandHelpForums
2.2.3.1Websites Google TheKungFuMasterofSearchEngines.Whenyouabsolutely,positivelygottafindeverylast kernelofinformationonasubject:Acceptnosubstitutes. Google:Linux LinuxSpecificsearches Google:BSD BSDSpecificsearches.SlackwareissogenericasaUnixworkalikeoperatingsystemthatone canasoftenasnotfindverydetailedinformationthatisalmost100%relevanttoSlackwarehere. ManytimesaBSDsearchrevealsfarmoretechnicalinformationthantheoftenPRrelatedLinux searches.
Google:Groups SearchthroughdecadesofUsenetpostsforyourpearlsofwisdom. http://userlocal.com Avirtualtreasuretroveofknowledge,goodadvice,firsthandexperienceandinterestingarticles. Oftenthefirstplaceyou'llhearaboutnewdevelopmentsintheworldofSlackware. 2.2.3.2WebbasedResources linuxquestions.org TheofficiallysanctionedwebforumforSlackwareusers. LinuxISO.orgSlackwareForum AplacetodownloadandgethelpwithLinux. alt.os.linux.slackwareFAQ AnotherFAQ 2.2.3.3UsenetGroups(NNTP) Usenethaslongbeenaplaceforgeekstogatherandhelponeanother.Therearefewnewsgroups dedicatedtoSlackwareLinux,buttheytendtobefilledwithveryknowledgeablepeople. alt.os.linux.slackware alt.os.linux.slackware,betterknownasaols(nottobeconfusedwithAOL!)isoneofthemost activeplacestofindtechnicalhelpwithSlackwareproblems.LikeeveryUsenetnewsgroup,afew unhelpfulparticipants(trolls)canmartheexperiencewithconstantarguing.Learningtoignorethe trollsandidentifyingthetrulyhelpfulpeopleiskeytomakingthemostofthisresource.
Chapter3Installation
BeforeyoucanuseSlackwareLinux,you'llhavetoobtainandinstallit.GettingSlackwareisaseasyas purchasingitordownloadingitforfreeovertheInternet.Installingitisalsoeasyaslongasyouhave somebasicknowledgeaboutyourcomputerandarewillingtolearnafewotherthings.Theinstallation programitselfisverymuchastepbystepprocess.Becauseofthis,youcanbeupandrunningvery quickly.Infact,SlackwareboastsoneofthelowestinstallationtimesofanyfullfeaturedLinux distribution.
3.1GettingSlackware
3.1.1TheOfficialDiscandBoxSets
TheofficialSlackwareLinuxCDsetisavailablefromSlackwareLinux,Inc.TheCDsetconsistsof4
discs.Thefirstdiskcontainsallthesoftwareneededforabasicserverinstall,andtheXwindow system.Thesecondcdisalivecdthatis,abootablecdthatinstallsintoRAMandgivesyoua temporaryinstallationtoplayaroundwithordoadataormachinerescue.Thiscdalsocontainsafew packagessuchastheKDEandGNOMEdesktopenvironments.Afewothergoodiesareincludedon thesecondcdincludingmanynonvitalpackagesintheextrafolder.ThethirdandfourthCDscontain thesourcecodetoallofSlackware,alongwiththeoriginaleditionofthisbook. Onemayalsopurchaseaboxedsetthatincludesthe4discsandacopyofthisbook,aswellaslotsof neatSlackwaregeartoshowoffyourgeekpride.CDsubscriptionsareavailableatareducedratealso. ThepreferredmethodforshoppingforSlackwaremerchandiseisonlineattheSlackwarestore. http://store.slackware.com Youcanalsocalloremailyourorderin. Table31.SlackwareLinux,Inc.ContactInformation Method ContactDetails
3.1.2ViatheInternet
SlackwareLinuxisalsofreelyavailableovertheInternet.Youmayemailinyoursupportquestions,but higherprioritywillbegiventothosewhohavepurchasedtheofficialCDset.Withthatsaid,wegetalot ofemailsandourtimeisratherlimited.BeforeemailingforsupportconsiderreadingChapter2first. TheofficialSlackwareLinuxProjectwebsiteislocatedat: http://www.slackware.com/ TheprimaryFTPlocationforSlackwareLinuxis: ftp://ftp.slackware.com/pub/slackware/ Bearinmindthatourftpsite,whileopenforgeneraluse,doesnothaveunlimitedbandwidth.Please considerusingamirrornearyoutodownloadSlackware.Anincompletelistofmirrorscanbefoundon oursiteathttp://www.slackware.com/getslack.
3.2SystemRequirements
AneasySlackwareinstallationrequires,atminimum,thefollowing: Table32.SystemRequirements Hardware Requirement Processor 586
RAM
32MB
DiskSpace 1GB MediaDrive 4xCDROM IfyouhavethebootableCD,youwillprobablynotneedafloppydrive.Ofcourse,itstandstoreason thatifyoudon'tpossessaCDROMdrive,youwillneedafloppydrivetodoanetworkinstall.A networkcardisrequiredforanNFSinstall.SeethesectioncalledNFSformoreinformation. Thediskspacerequirementissomewhattricky.The1GBrecommendationisusuallysafeforaminimal install,butifyoudoafullinstall,youwillneedaroundtwogigabytesofavailableharddiskspaceplus additionalspaceforpersonalfiles..Mostusersdon'tdoafullinstall.Infact,manyrunSlackwareonas littleas100MBofharddiskspace. SlackwarecanbeinstalledtosystemswithlessRAM,smallerharddrives,andweakerCPUs,but doingsowillrequirealittleelbowgrease.Ifyou'reupforalittlework,takealookattheLOWMEM.TXT fileinthedistributiontreeforafewhelpfulhints.
3.2.1TheSoftwareSeries
Forreasonsofsimplicity,Slackwarehashistoricallybeendividedintosoftwareseries.Oncecalled disksetsbecausetheyweredesignedforfloppybasedinstallation,thesoftwareseriesarenowused primarilytocategorizethepackagesincludedinSlackware.Today,floppyinstallationisnolonger possible. Thefollowingisabriefdescriptionofeachsoftwareseries. Table33.SoftwareSeries Series A Contents
Thebasesystem.Containsenoughsoftwaretogetupandrunningandhaveatexteditorand basiccommunicationprogram. AP VariousapplicationsthatdonotrequiretheXWindowSystem. D Programdevelopmenttools.Compilers,debuggers,interpreters,andmanpagesareallhere. E GNUEmacs. F FAQs,HOWTOs,andothermiscellaneousdocumentation. GNOME TheGNOMEdesktopenvironment. K ThesourcecodefortheLinuxkernel. TheKDesktopEnvironment.AnXenvironmentwhichsharesalotoflookandfeelfeatures KDE withMacOSandWindows.TheQtlibrary,whichKDErequires,isalsointhisseries. KDEI InternationalizationpackagesfortheKDEdesktop. L Libraries.Dynamicallylinkedlibrariesrequiredbymanyotherprograms. N Networkingprograms.Daemons,mailprograms,telnet,newsreaders,andsoon. T teTeXdocumentformattingsystem. TCL TheToolCommandLanguage.Tk,TclX,andTkDesk. X ThebaseXWindowSystem. XApplicationsthatarenotpartofamajordesktopenvironment(forexample,Ghostscript XAP andNetscape).
BSDConsolegames
3.2.2InstallationMethods
3.2.2.1Floppy WhileitwasoncepossibletoinstallallofSlackwareLinuxfromfloppydisks,theincreasingsizeof softwarepackages(indeed,ofsomeindividualprograms)hasforcedtheabandonmentofthefloppy install.AslateasSlackwareversion7.1apartialinstallwaspossibleusingfloppydisks.TheAandN seriescouldbenearlyentirelyinstalled,providingabasesystemfromwhichtoinstalltherestofthe distribution.Ifyouareconsideringafloppyinstall(typicallyonolderhardware),itistypically recommendedtofindanotherway,oruseanolderrelease.Slackware4.0isstillverypopularforthis reason,asis7.0. PleasenotethatfloppydisksarestillrequiredforaCDROMinstallifyoudonothaveabootableCD, aswellasforanNFSinstall. 3.2.2.2CDROM IfyouhavethebootableCD,availableintheofficialdiscsetpublishedbySlackwareLinux,Inc.(see thesectioncalledGettingSlackware),aCDbasedinstallationwillbeabitsimplerforyou.Ifnot,you willneedtobootfromfloppies.Also,ifyouhavespecialhardwarethatmakesusageofthekernelon thebootableCDproblematic,youmayneedtousespecializedfloppies. AsofSlackwareversion8.1,anewmethodisusedforcreatingthebootableCDs,whichdoesnot workaswellwithcertainflakyBIOSchips(itisworthnotingthatmostallLinuxCDssufferfromthis thesedays).Ifthatisthecase,werecommendbootingfromafloppydisk. Section3.2.3andSection3.2.5provideinformationonchoosingandcreatingfloppiesfromwhichto boot,shouldthisbenecessary. 3.2.2.3NFS NFS(theNetworkFileSystem)isawayofmakingfilesystemsavailabletoremotemachines.AnNFS installallowsyoutoinstallSlackwarefromanothercomputeronyournetwork.Themachinefromwhich youareinstallingneedstobeconfiguredtoexporttheSlackwaredistributiontreetothemachineto whichyou'reinstalling.This,ofcourse,involvessomeknowledgeofNFS,whichiscoveredinSection 5.6. ItispossibletoperformanNFSinstallviasuchmethodsasPLIP(overaparallelport),SLIP,andPPP (thoughnotoveramodemconnection).However,werecommendtheuseofanetworkcardif available.Afterall,installinganoperatingsystemthroughyourprinterportisgoingtobeavery,very slowprocess.
3.2.3BootDisk
Thebootdiskisthefloppyyouactuallybootfromtobegintheinstallation.Itcontainsacompressed kernelimagewhichisusedtocontrolthehardwareduringinstallation.Therefore,itisverymuch required(unlessyou'rebootingfromCD,asisdiscussedinthesectioncalledCDROM).Theboot disksarelocatedinthebootdisks/directoryinthedistributiontree.
3.2.4RootDisk
Therootdiskscontainthesetupprogramandafilesystemwhichisusedduringinstallation.Theyare alsorequired.Therootdiskimagesarelocatedinthedirectoryrootdisksinthedistributiontree.You'll havetomaketworootdisksfromtheinstall.1andinstall.2images.Hereyoucanalsofindthe network.dsk,pcmcia.dsk,rescue.dsk,andsbootmgr.dskdisks.
3.2.5SupplementalDisk
AsupplementaldiskisneededifyouareperforminganNFSinstallorinstallingtoasystemwith PCMCIAdevices.Supplementaldisksareintherootdsksdirectoryinthedistributiontree,withthe filenamesnetwork.dskandpcmcia.dsk.Recentlyothersupplementaldiskssuchasrescue.dsk andsbootmgr.dskhavebeenadded.Therescuediskisasmallfloppyrootimagethatrunsina4MB RAMdrive.Itincludessomebasicnetworkingutilitiesandthevieditorforquickfixesonbusted machines.Thesbootmgr.dskdiskisusedtoboototherdevices.Bootoffthisdiskifyourbootable CDROMdrivedoesn'twanttoboottheSlackwareCDs.Itwillpromptyoufordifferentthingstoboot andmayofferaconvenientwaytoworkaroundabuggyBIOS. Therootdiskwillinstructyouontheuseofsupplementaldiskswhenitisloaded.
3.2.6MakingtheDisks
Onceyou'veselectedabootdiskimage,youneedtoputitonafloppy.Theprocessisslightlydifferent dependingonwhichoperatingsystemyou'reusingtomakethedisks.Ifyou'rerunningLinux(orpretty muchanyUnixlikeOS)you'llneedtousethedd(1)command.Assumingbare.iisyourdiskimage fileandyourfloppydriveis/dev/fd0,thecommandtomakeabare.ifloppyis:
%ddif=bare.iof=/dev/fd0
3.3Partitioning
Afterbootingfromyourpreferredmedia,youwillneedtopartitionyourharddisk.Thediskpartitionis wheretheLinuxfilesystemwillbecreatedandiswhereSlackwarewillbeinstalled.Atthevery minimumwerecommendcreatingtwopartitionsoneforyourrootfilesystem(/)andoneforswap space. Aftertherootdiskfinishesloading,itwillpresentyouwithaloginprompt.Loginasroot(thereisno password).Attheshellprompt,runeithercfdisk(8)orfdisk(8).Thecfdiskprogramprovidesa moreuserfriendlyinterfacethantheregularfdiskprogram,butdoeslacksomefeatures.Wewill brieflyexplainthefdiskprogrambelow. Beginbyrunningfdiskforyourharddisk.InLinux,theharddisksdonothavedriveletters,butare representedbyafile.ThefirstIDEharddisk(primarymaster)is/dev/hda,theprimaryslaveis /dev/hdb,andsoon.SCSIdisksfollowthesametypesystem,butareintheformof/dev/sdX.You willneedtostartfdiskandpassityourharddisk:
#fdisk/dev/hda
LikeallgoodUnixprograms,fdiskgivesyouaprompt(thoughtyouweregettingamenu,right?).The firstthingyoushoulddoisexamineyourcurrentpartitions.Wedothatbytypingpatthefdiskprompt:
Command(mforhelp):p
3.4ThesetupProgram
Onceyouhavecreatedyourpartitions,youarereadytoinstallSlackware.Thenextstepinthe installationprocessisrunningthesetup(8)program.Todoso,simplytypesetupattheshellprompt. setupisamenudrivensystemforactuallyinstallingtheSlackwarepackagesandconfiguringyour system.
3.4.1HELP
IfthisisyourfirsttimeinstallingSlackware,youmightwanttotakealookatthehelpscreen.Itwillgive adescriptionofeachpartofsetup(muchliketheonewe'rewritingnow,butlessinvolved)and instructionsfornavigatingtherestoftheinstall.
3.4.2KEYMAP
IfyourequireakeymapotherthantheUnitedStatesqwertylayout,youmaywanttotakealookat thissection.Itoffersanumberofalternatelayoutsforyourkeyboardingenjoyment.
3.4.3ADDSWAP
3.4.4TARGET
Thetargetsectioniswhereyourother(nonswap)partitionsareformattedandmappedtofilesystem
3.4.5SOURCE
ThesourcesectioniswhereyouselectthesourcemediafromwhichyouareinstallingSlackware. Currentlytherearefoursourcestochoosefrom.TheseareCDROM,NFS,orapremounted directory.
TheCDROMselectionenablesaCDROMbasedinstallation.Itwilloffertheoptionofscanningfora CDROMdriveordisplayingalistfromwhichyoucanpickyourdrivetype.Makesureyouhavethe SlackwareCDinyourdrivebeforeallowingittoscan. TheNFSselectionpromptsforyournetworkinformationandthenetworkinformationforyourNFS server.TheNFSservermustbesetupinadvance.Alsonotethatyoucannotusehostnames,youmust usetheIPaddressesforbothyourmachineandtheNFSserver(thereisnonameresolveronthesetup disk).Naturallyyoumusthaveusedthenetwork.dskfloppytoaddsupportforyournetwork controller. Thepremounteddirectoryoffersthemostflexibility.Youcanusethismethodtoinstallfromthingssuch asJazdisks,NFSmountsoverPLIP,andFATfilesystems.Mountthefilesystemtoalocationofyour choosingbeforerunningsetup,thenspecifythatlocationhere.
3.4.6SELECT
Theselectoptionallowsyoutoselectthesoftwareseriesthatyouwishtoinstall.Theseseriesare describedinSection3.2.1.PleasenotethatyoumustinstalltheAseriestohaveaworkingbasesystem. Allotherseriesareoptional.
3.4.7INSTALL
Assumingthatyouhavegonethroughthetarget,source,andselectoptions,theinstalloptionwill allowyoutoselectpackagesfromyourchosensoftwareseries.Ifnot,itwillpromptyoutogobackand completetheothersectionsofthesetupprogram.Thisoptionallowsyoutoselectfromsixdifferent installationmethods:full,newbie,menu,expert,custom,andtagpath.
Thefulloptionwillinstalleverypackagefromallthesoftwareseriesthatyouchoseintheselect section.Thereisnofurtherprompting.Thisistheeasiestinstallationmethod,sinceyoudonotneedto makeanydecisionsontheactualpackagestoinstall.Ofcourse,thisoptionalsotakesupthemosthard drivespace. Thenextoptionisnewbie.Thisoptioninstallsalloftherequiredpackagesintheselectedseries.Forall otherpackages,itoffersapromptwhereyoucanselectYes,No,orSkip.YesandNodothe obvious,whileSkipwillgoaheadtothenextsoftwareseries.Additionally,youwillseeadescription andsizerequirementforeachpackagetohelpyoudecideifyouneedit.Werecommendthisoptionfor newusers,asitensuresthatyougetalltherequiredpackagesinstalled.However,itisalittleslow becauseoftheprompting. Menuisafasterandmoreadvancedversionofthenewbieoption.Foreachseries,amenuisdisplayed, fromwhichyoucanselectallthenonrequiredpackagesyouwanttoinstall.Requiredpackagesarenot displayedonthismenu. Forthemoreadvanceduser,installofferstheexpertoption.Thisallowsyoucompletecontrolover whatpackagesgetinstalled.Youcandeselectpackagesthatareabsolutelyrequired,resultingina brokensystem.Ontheotherhand,youcancontrolexactlywhatgoesontoyoursystem.Simplyselect thepackagesfromeachseriesthatyouwantinstalled.Thisisnotrecommendedforthenewuser,asitis quiteeasytoshootyourselfinthefoot. Thecustomandtagpathoptionsarealsoforadvancedusers.Theseoptionsallowyoutoinstallbased uponcustomtagfilesthatyoucreatedinthedistributiontree.Thisisusefulforinstallingtolargenumbers ofmachinesfairlyquickly.Formoreinformationonusingtagfiles,seeSection18.4. Afterselectingyourinstallationmethod,oneofafewthingswillhappen.Ifyouselectedfullormenu,a menuscreenwillappear,allowingyoutoselectthepackagestobeinstalled.Ifyouselectedfull, packageswillimmediatelystartgettinginstalledtothetarget.Ifyouselectednewbie,packageswillbe installeduntilanoptionalpackageisreached.
3.4.8CONFIGURE
Theconfiguresectionallowsyoutodosomebasicsystemconfiguration,nowthatthepackageshave beeninstalled.Whatyouseeheredependsinlargepartuponwhichsoftwareyouhaveinstalled.You will,however,alwaysseethefollowing: 3.4.8.1Kernelselection Hereyouwillbeaskedtoselectakerneltoinstall.Youcaninstallthekernelfromthebootdiskyou usedtoinstall,theSlackwareCDROM,orfromanotherfloppywhichyou(alwaysthinkingahead) haveprepared.Oryoucanelecttoskip,inwhichcasethedefaultkernelwillbeinstalledandplaywill continuetothedealer'sleft.
Thesenextconfigurationsubsectionsmayormaynotappear,dependingonwhetherornotyouinstalled theircorrespondingpackages.
3.4.8.7Font
Thefontsubsectionallowsyoutochoosefromalistofcustomconsolefonts.
IfSlackwareistobetheonlyoperatingsystemonyourcomputer,simpleshouldworkjustfineforyou. Ifyouaredualbooting,theexpertoptionisabetterchoice.SeeSection7.3formoreinformationon dualbooting.Thethirdoption,donotinstall,isnotrecommendedunlessyouknowwhatyou'redoing andhaveaverygoodreasonfornotinstallingLILO.Ifyouareperforminganexpertinstall,youwillbe givenachoiceastowhereLILOwillbeput.YoumayplaceLILOintheMBR(MasterBootRecord) ofyourharddrive,inthesuperblockofyourrootLinuxpartition,oronafloppydisk. 3.4.8.9Network Thenetworkconfigurationsubsectionisactuallynetconfig.SeeSection5.1formoreinformation. 3.4.8.10XWindowManager ThissubsectionwillallowyoutochooseadefaultwindowmanagerforX.SeeChapter6formore detailsonXandwindowmanagers.
Chapter4SystemConfiguration
Beforeyoucanconfigurethemoreadvancedpartsofyoursystem,it'sagoodideatolearnhowthe systemisorganizedandwhatcommandscanbeusedtosearchforfilesandprograms.It'salsogoodto knowifyouneedtocompileacustomkernelandwhatthestepsfordoingthatare.Thischapterwill familiarizeyouwithsystemorganizationandconfigurationfiles.Then,youcanmoveontoconfiguring themoreadvancedpartsofthesystem.
4.1SystemOverview
It'simportanttounderstandhowaLinuxsystemisputtogetherbeforedivingintothevarious configurationaspects.ALinuxsystemissignificantlydifferentfromaDOS,Windows,orMacintosh system(withtheexceptionoftheUnixbasedMacOSX),butthesesectionswillhelpyouget acquaintedwiththelayoutsothatyoucaneasilyconfigureyoursystemtomeetyourneeds.
4.1.1FileSystemLayout
ThefirstnoticeabledifferencebetweenSlackwareLinuxandaDOSorWindowssystemisthe filesystem.Forstarters,wedonotusedriveletterstodenotedifferentpartitions.UnderLinux,thereis onemaindirectory.YoucanrelatethistotheC:driveunderDOS.Eachpartitiononyoursystemis mountedtoadirectoryonthemaindirectory.It'skindoflikeaneverexpandingharddisk. Wecallthemaindirectorytherootdirectory,andit'sdenotedwithasingleslash(/).Thisconceptmay seemstrange,butitactuallymakeslifeeasyforyouwhenyouwanttoaddmorespace.Forexample, let'ssayyourunoutofspaceonthedrivethathas/homeonit.MostpeopleinstallSlackwareand makeonebigrootdrive.Well,sinceapartitioncanbemountedtoanydirectory,youcansimplygoto thestoreandpickupanewharddriveandmountitto/home.You'venowgraftedonsomemore spacetoyoursystem.Andallwithouthavingtomovemanythingsaround. Below,youwillfinddescriptionsofthemajortopleveldirectoriesunderSlackware.
bin
Systemlibrariesthatarerequiredforbasicoperationarestoredhere.TheClibrary,thedynamic loader,thencurseslibrary,andkernelmodulesareamongthethingsstoredhere.
mnt
Thisdirectorycontainstemporarymountpointsforworkingonharddisksorremovabledrives. Hereyou'llfindmountpointsforyourCDROMandfloppydrives.
opt
Essentialprogramsthatarerunbyrootandduringthesystembootupprocessarekepthere. Normaluserswillnotrunprogramsinthisdirectory.
tmp
Thetemporarystoragelocation.Allusershavereadandwriteaccesstothisdirectory.
usr
youfindspecificfileseasily,soyoudon'thavetodoitbyhand.
4.1.2FindingFiles
Younowknowwhateachmajordirectoryholds,butitstilldoesn'treallyhelpyoufindthings.Imean, youcouldgolookingthroughdirectories,buttherearequickerways.Therearefourmainfilesearch commandsavailableinSlackware. 4.1.2.1which Thefirstisthewhich(1)command.whichisusuallyusedtolocateaprogramquickly.Itjustsearches yourPATHandreturnsthefirstinstanceitfindsandthedirectorypathtoit.Takethisexample:
%whichbash /bin/bash
4.1.2.4slocate
Wegotmorethanwhatwewerelookingfor,andquicklytoo.Withthesecommands,youshouldbe abletofindwhateveryou'relookingforonyourLinuxsystem.
4.1.3The/etc/rc.dDirectory
Thesysteminitializationfilesarestoredinthe/etc/rc.ddirectory.SlackwareusestheBSDstyle layoutforitsinitializationfilesasopposedtoSystemVinitscripts,whichtendtomakeconfiguration changesmuchmoredifficultwithoutusingaprogramspecificallydesignedforthatpurpose.InBSDinit scripts,eachrunlevelisgivenasinglercfile.InSystemV,eachrunlevelisgivenitsowndirectory,each containingnumerousinitscripts.Thisprovidesanorganizedstructurethatiseasytomaintain. Thereareseveralcategoriesofinitializationfiles.Thesearesystemstartup,runlevels,network initialization,andSystemVcompatibility.Aspertradition,we'lllumpeverythingelseintoanother category. 4.1.3.1SystemStartup ThefirstprogramtorununderSlackwarebesidestheLinuxkernelisinit(8).Thisprogramreadsthe /etc/inittab(5)filetoseehowtorunthesystem.Itrunsthe/etc/rc.d/rc.Sscripttopreparethe systembeforegoingintoyourdesiredrunlevel.Therc.Sfileenablesyourvirtualmemory,mountsyour filesystems,cleansupcertainlogdirectories,initializesPlugandPlaydevices,loadskernelmodules, configuresPCMCIAdevices,setsupserialports,andrunsSystemVinitscripts(iffound).Obviously rc.Shasalotonitsplate,butherearesomescriptsin/etc/rc.dthatrc.Swillcallontocomplete itswork:
rc.S
Thisistheactualsysteminitializationscript.
rc.modules
Loadskernelmodules.Thingslikeyournetworkcard,PPPsupport,andotherthingsareloaded here.Ifthisscriptfindsrc.netdevice,itwillrunthataswell.
rc.pcmcia
ProbesforandconfiguresanyPCMCIAdevicesthatyoumighthaveonyoursystem.Thisis mostusefulforlaptopusers,whoprobablyhaveaPCMCIAmodemornetworkcard.
rc.serial
Configuresyourserialportsbyrunningtheappropriatesetserialcommands.
rc.sysvinit
Haltthesystem(runlevel0).Bydefault,thisissymlinkedtorc.6.
rc.4
Multiuserstartup(runlevel4),butinX11withKDM,GDM,orXDMastheloginmanager.
rc.6
Rebootthesystem(runlevel6).
rc.K
Startupinsingleusermode(runlevel1).
rc.M
Createdbynetconfig,thisfileisresponsibleforconfiguringtheactualnetworkinterface.
rc.inet2
Runsafterrc.inet1andstartsupbasicnetworkservices.
rc.atalk
StartsupAppleTalkservices.
rc.httpd
StartsuptheApachewebserver.Likeafewotherrcscripts,thisonecanalsobeusedtostop
andrestartaservice.rc.httpdtakesargumentsofstop,start,orrestart.
rc.news
Startsupthenewsserver. 4.1.3.4SystemVCompatibility SystemVinitcompatibilitywasintroducedinSlackware7.0.ManyotherLinuxdistributionsmakeuse ofthisstyleinsteadoftheBSDstyle.Basicallyeachrunlevelisgivenasubdirectoryforinitscripts, whereasBSDstylegivesoneinitscripttoeachrunlevel. Therc.sysvinitscriptwillsearchforanySystemVinitscriptsyouhavein/etc/rc.dandrun them,iftherunlevelisappropriate.Thisisusefulforcertaincommercialsoftwarepackagesthatinstall SystemVinitscripts 4.1.3.5OtherFiles Thescriptsdescribedbelowaretheothersysteminitializationscripts.Theyaretypicallyrunfromoneof themajorscriptsabove,soallyouneedtodoiseditthecontents.
rc.gpm
Loadsthecustomscreenfontfortheconsole.
rc.local
4.2SelectingaKernel
Thekernelisthepartoftheoperatingsystemthatprovideshardwareaccess,processcontrol,and overallsystemcontrol.Thekernelcontainssupportforyourhardwaredevices,sopickingoneforyour systemisanimportantsetupstep. Slackwareprovidesmorethanadozenprecompiledkernelsthatyoucanpickfrom,eachwitha standardsetofdriversandadditionalspecificdrivers.Youcanrunoneoftheprecompiledkernelsor youcanbuildyourownkernelfromsource.Eitherway,youneedtomakesurethatyourkernelhasthe hardwaresupportyoursystemneeds.
4.2.1The/kernelsDirectoryontheSlackwareCDROM
TheprecompiledSlackwarekernelsareavailableinthe/kernelsdirectoryontheSlackwareCD ROMorontheFTPsiteinthemainSlackwaredirectory.Theavailablekernelschangeasnewreleases aremade,sothedocumentationinthatdirectoryisalwaystheauthoritativesource.The/kernels directoryhassubdirectoriesforeachkernelavailable.Thesubdirectorieshavethesamenameastheir accompanyingbootdisk.Ineachsubdirectoryyouwillfindthefollowingfiles: File
System.map bzImage config
4.2.2CompilingaKernelfromSource
ThequestionShouldIcompileakernelformysystem?isoftenaskedbynewusers.Theanswerisa definitemaybe.Therearefewinstanceswhereyouwillneedtocompileakernelspecifictoyour system.Mostuserscanuseaprecompiledkernelandtheloadablekernelmodulestoachieveafully workingsystem.Youwillwanttocompileakernelforyoursystemifyouareupgradingkernelversions toonethatwedonotcurrentlyofferinSlackware,orifyouhavepatchedthekernelsourcetoget specialdevicesupportthatisnotinthenativekernelsource.AnyonewithanSMPsystemwilldefinitely wanttocompileakernelwithSMPsupport.Also,manyusersfindacustomcompiledkernelrunsmuch fasterontheirmachine.Youmayfinditusefultocompilethekernelwithoptimizationsforthespecific processorinyourmachine. Buildingyourownkernelisnotthathard.Thefirststepistomakesureyouhavethekernelsource installedonyoursystem.MakesurethatyouinstalledthepackagesfromtheKseriesduringthe installation.YouwillalsowanttomakesureyouhavetheDseriesinstalled,specificallytheCcompiler, GNUmake,andGNUbinutils.Ingeneral,it'sagoodideatohavetheentireDseriesinstalledifyou planondoinganykindofdevelopment.Youcanalsodownloadthelatestkernelsourcefrom http://www.kernel.org/mirrors. 4.2.2.1LinuxKernelversion2.4.xCompilation
%su Password: #cd/usr/src/linux
Thefirststepistobringthekernelsourceintoitsbasestate.Weissuethiscommandtodothat(note, youmaywishtobackupthe.configfileasthiscommandwilldeleteitwithoutwarning):
#makemrproper
Figure41.KernelConfigurationMenu
Thenextstepistocompilethekernel.FirsttryissuingthebzImagecommandbelow.
#makebzImage
Thismaytakeawhile,dependingonyourCPUspeed.Duringthebuildprocess,youwillseethe
compilermessages.Afterbuildingthekernelimage,youwillwanttobuildanypartsofthekernelthat youflaggedasmodular.
#makemodules
Wecannowinstallthekernelandmodulesthatyoucompiled.ToinstallthekernelonaSlackware system,thesecommandsshouldbeissued:
#mv/boot/vmlinuz/boot/vmlinuz.old #catarch/i386/boot/bzImage>/vmlinuz #mv/boot/System.map/boot/System.map.old #cpSystem.map/boot/System.map #makemodules_install
Youwillwanttoedit/etc/lilo.confandaddasectiontobootyouroldkernelincaseyournew onedoesnotwork.Afterdoingthat,run/sbin/lilotoinstallthenewbootblock.Youcannow rebootwithyournewkernel. 4.2.2.2LinuxKernelVersion2.6.x Thecompilationofa2.6kernelisonlyslightlydifferentfroma2.4ora2.2kernel,butitisimportant thatyouunderstandthedifferencesbeforedelvingin.It'snolongernecessarytorunmakedepand makeclean.Also,thekernelcompilationprocessisnotasverboseinthe2.6kernelseries.This resultsinabuildprocessthatiseasiertounderstand,buthassomeshortcomingsaswell.Ifyouhave troublebuildingthekernel,it'shighlyrecommendedthatyouturnverbositybackup.Youdothissimply byappendingV=1tothebuild.Thisallowsyoutologmoreinformationthatcouldhelpakernel developerorotherfriendlygeekaidyouinresolvingtheissue.
#makebzImageV=1
4.2.3UsingKernelModules
Kernelmodulesareanothernamefordevicedriversthatcanbeinsertedintoarunningkernel.They allowyoutoextendthehardwaresupportedbyyourkernelwithoutneedingtopickanotherkernelor compileoneyourself. Modulescanalsobeloadedandunloadedatanytime,evenwhenthesystemisrunning.Thismakes upgradingspecificdriverseasyforsystemadministrators.Anewmodulecanbecompiled,theoldone removed,andthenewoneloaded,allwithoutrebootingthemachine. Modulesarestoredinthe/lib/modules/kernelversiondirectoryonyoursystem.Theycanbe loadedatboottimethroughtherc.modulesfile.Thisfileisverywellcommentedandoffersexamples formajorhardwarecomponents.Toseealistofmodulesthatarecurrentlyactive,usethelsmod(1) command:
#lsmod ModuleSizeUsedby parport_pc72200
parport78440[parport_pc]
YoucanseeherethatIonlyhavetheparallelportmoduleloaded.Toremoveamodule,youusethe rmmod(1)command.Modulescanbeloadedbythemodprobe(1)orinsmod(1)command.modprobe isusuallysaferbecauseitwillloadanymodulesthattheoneyou'retryingtoloaddependson. Alotofusersneverhavetoloadorunloadmodulesbyhand.Theyusethekernelautoloaderfor modulemanagement.Bydefault,Slackwareincludeskmodinitskernels.kmodisakerneloptionthat enablesthekerneltoautomaticallyloadmodulesastheyarerequested.Formoreinformationonkmod andhowitisconfigured,see/usr/src/linux/Documentation/kmod.txt.You'llhaveneededto havethekernelsourcepackage,ordownloadedkernelsourcefromhttp://kernel.org. Moreinformationcanbefoundinthemanpagesforeachofthesecommands,plustherc.modules file.
Chapter5NetworkConfiguration
5.1Introduction:netconfigisyourfriend.
WhenyouinitiallyinstalledSlackware,thesetupprograminvokedthenetconfigprogram. netconfigattemptedtoperformthefollowingfunctionsforyou: Itaskedyouforthenameofyourcomputer,andthedomainnameforyourcomputer. Itgaveabriefexplanationofthevarioustypesofaddressingschemes,toldwhenthey shouldbeused,andaskedyouwhichIPaddressingschemeyouwishedtousetoconfigure yournetworkcard: StaticIP DHCP Loopback
Itthenofferedtoprobeforanetworkcardtoconfigure.
netconfigwillgenerallytakecareofabout80%oftheworkofconfiguringyourLANnetwork
5.2NetworkHardwareConfiguration
HavingdecidedthatyouwishtobringyourSlackwaremachineontosomeformofnetwork,thefirst thingyou'llneedisaLinuxcompatiblenetworkcard.Youwillneedtotakealittlecaretoensurethat thecardistrulyLinuxcompatible(pleaserefertotheLinuxDocumentationProjectand/orthekernel documentationforinformationonthecurrentstatusofyourproposednetworkcard).Asageneralrule, youwillmostlikelybepleasantlysurprisedbythenumberofnetworkingcardsthataresupportedunder themoremodernkernels.Havingsaidthat,I'dstillsuggestreferringtoanyofthevariousLinux hardwarecompatibilitylists(suchasTheGNU/LinuxBeginnersGroupHardwareCompatibilityLinks andTheLinuxDocumentationProjectHardwareHOWTO)thatareavailableontheInternetbefore purchasingyourcard.Alittleextratimespentinresearchcansavedaysorevenweekstryingto troubleshootacardthatisn'tcompatiblewithLinuxatall. WhenyouvisittheLinuxHardwareCompatibilitylistsavailableontheInternet,orwhenyourefertothe kerneldocumentationinstalledonyourmachine,itwouldbewisetonotewhichkernelmoduleyou'll needtousetosupportyournetworkcard.
5.2.1LoadingNetworkModules
Kernelmodulesthataretobeloadedonbootupareloadedfromtherc.modulesfilein/etc/rc.d orbythekernel'sautomoduleloadingstartedby/etc/rc.d/rc.hotplug.Thedefaultrc.modules fileincludesaNetworkdevicesupportsection.Ifyouopenrc.modulesandlookforthatsection, you'llnoticethatitfirstchecksforanexecutablerc.netdevicefilein/etc/rc.d/.Thisscriptis createdifsetupsuccessfullyautoprobesyournetworkdeviceduringinstallation. Belowthatifblockisalistofnetworkdevicesandmodprobelines,eachcommentedout.Findyour deviceanduncommentthecorrespondingmodprobeline,thensavethefile.Runningrc.modulesas rootshouldnowloadyournetworkdevicedriver(aswellasanyothermodulesthatarelistedand uncommented).Notethatsomemodules(suchasthene2000driver)requireparametersmakesure youselectthecorrectline.
5.2.2LAN(10/100/1000BaseTandBase2)cards
ThisheadingencompassesalloftheinternalPCIandISAnetworkingcards.Driversforthesecardsare providedvialoadablekernelmodulesascoveredinthepreviousparagraph./sbin/netconfigshould haveprobedforyourcardandsuccessfullysetupyourrc.netdevicefile.Ifthisdidnotoccur,the mostlikelyproblemwouldbethatthemodulethatyou'reattemptingtoloadforagivencardisincorrect (itisnotunheardoffordifferentgenerationsofthesamebrandofcardfromthesamemanufacturerto requiredifferentmodules).Ifyouarecertainthatthemodulethatyou'reattemptingtoloadisthecorrect one,yournextbestbetwouldbetorefertothedocumentationforthemoduleinanattempttodiscover whetherornotspecificparametersarerequiredduringwhenthemoduleisinitialized.
5.2.3Modems
LikeLANcards,modemscancomewithvariousbussupportoptions.Untilrecently,mostmodems were8or16bitISAcards.WiththeeffortsofIntelandmotherboardmanufacturerseverywhereto finallykillofftheISAbuscompletely,itiscommonnowtofindthatmostmodemsareeitherexternal modemsthatconnecttoaserialorUSBportorareinternalPCImodems.Ifyouwishforyourmodem toworkwithLinux,itisVITALLYimportanttoresearchyourprospectivemodempurchase,particularly
ifyouareconsideringpurchasingaPCImodem.Many,ifnotmost,PCImodemsavailableonstore shelvesthesedaysareWinModems.WinModemslacksomebasichardwareonthemodemcarditself: thefunctionsperformedbythishardwarearetypicallyoffloadedontotheCPUbythemodemdriver andtheWindowsoperatingsystem.Thismeansthattheydonothavethestandardserialinterfacethat PPPDwillbeexpectingtoseewhenyoutrytodialouttoyourInternetServiceProvider. Ifyouwanttobeabsolutelysurethatthemodemyou'repurchasingwillworkwithLinux,purchasean externalhardwaremodemthatconnectstotheserialportonyourPC.Theseareguaranteedtowork betterandbelesstroubletoinstallandmaintain,thoughtheyrequireexternalpowerandtendtocost more. ThereareseveralwebsitesthatprovidedriversandassistanceforconfiguringWinModembased devices.Someusershavereportedsuccessconfiguringandinstallingdriversforthevarious winmodems,includingLucent,Conexant,andRockwellchipsets.Astherequiredsoftwareforthese devicesisnotanincludedpartofSlackware,andvariesfromdrivertodriver,wewillnotgointodetail onthem.
5.2.4PCMCIA
AspartofyourSlackwareinstall,youaregiventheopportunitytoinstallthepcmciapackage(inthe Aseriesofpackages).Thispackagecontainstheapplicationsandsetupfilesrequiredtoworkwith PCMCIAcardsunderSlackware.Itisimportanttonotethatthepcmciapackageonlyinstallsthe genericsoftwarerequiredtoworkwithPCMCIAcardsunderSlackware.ItdoesNOTinstallany driversormodules.Theavailablemodulesanddriverswillbeinthe/lib/modules/`uname r`/pcmciadirectory.Youmayneedtodosomeexperimentationtofindamodulethatwillworkwith yournetworkcard. Youwillneedtoedit/etc/pcmcia/network.opts(foranEthernetcard)or /etc/pcmcia/wireless.opts(ifyouhaveawirelessnetworkingcard).LikemostSlackware configurationfiles,thesetwofilesareverywellcommentedanditshouldbeeasytodeterminewhich modificationsneedtobemade.
5.3TCP/IPConfiguration
Atthispoint,yournetworkcardshouldbephysicallyinstalledinyourcomputer,andtherelevantkernel modulesshouldbeloaded.Youwillnotyetbeabletocommunicateoveryournetworkcard,but informationaboutthenetworkdevicecanbeobtainedwithifconfiga.
#ifconfiga eth0Linkencap:EthernetHWaddr00:A0:CC:3C:60:A4 UPBROADCASTNOTRAILERSRUNNINGMULTICASTMTU:1500Metric:1 RXpackets:110081errors:1dropped:0overruns:0frame:0 TXpackets:84931errors:0dropped:0overruns:0carrier:0 collisions:0txqueuelen:100 RXbytes:114824506(109.5Mb)TXbytes:9337924(8.9Mb) Interrupt:5Baseaddress:0x8400 loLinkencap:LocalLoopback inetaddr:127.0.0.1Mask:255.0.0.0 UPLOOPBACKRUNNINGMTU:16436Metric:1 RXpackets:2234errors:0dropped:0overruns:0frame:0 TXpackets:2234errors:0dropped:0overruns:0carrier:0
collisions:0txqueuelen:0 RXbytes:168758(164.8Kb)TXbytes:168758(164.8Kb)
5.3.1DHCP
DHCP(orDynamicHostConfigurationProtocol),isameansbywhichanIPaddressmaybeassigned toacomputeronboot.WhentheDHCPclientboots,itputsoutarequestontheLocalAreaNetwork foraDHCPservertoassignitanIPaddress.TheDHCPserverhasapool(orscope)ofIPaddresses available.TheserverwillrespondtothisrequestwithanIPaddressfromthepool,alongwithalease time.OncetheleasetimeforagivenIPaddressleasehasexpired,theclientmustcontacttheserver againandrepeatthenegotiation. TheclientwillthenaccepttheIPaddressfromtheserverandwillconfiguretherequestedinterfacewith theIPaddress.ThereisonemorehandytrickthatDHCPclientsusefornegotiatingtheIPaddressthat theywillbeassigned,however.Theclientwillrememberit'slastassignedIPaddress,andwillrequest thattheserverreassignthatIPaddresstotheclientagainuponnextnegotiation.Ifpossible,theserver willdoso,butifnot,anewaddressisassigned.So,thenegotiationresemblesthefollowing: Client:IsthereaDHCPserveravailableontheLAN? Server:Yes,thereis.HereIam. Client:IneedanIPaddress. Server:Youmaytake192.168.10.10for19200seconds. Client:Thankyou. Client:IsthereaDHCPserveravailableontheLAN? Server:Yes,thereis.HereIam. Client:IneedanIPaddress.Thelasttimewe talked,Ihad192.168.10.10 MayIhaveitagain? Server:Yes,youmay(orNo,youmaynot:take192.168.10.12instead). Client:Thankyou. TheDHCPclientinLinuxis/sbin/dhcpcd.Ifyouload/etc/rc.d/rc.inet1inyourfavoritetext editor,youwillnoticethat/sbin/dhcpcdiscalledaboutmidwaythroughthescript.Thiswillforcethe conversationshownabove.dhcpcdwillalsotracktheamountoftimeleftontheleaseforthecurrentIP address,andwillautomaticallycontacttheDHCPserverwitharequesttorenewtheleasewhen necessary.DHCPcanalsocontrolrelatedinformation,suchaswhatntpservertouse,whatrouteto take,etc. SettingupDHCPonSlackwareissimple.JustrunnetconfigandselectDHCPwhenoffered.Ifyou havemorethanoneNICanddonotwisheth0tobeconfiguredbyDHCP,justeditthe /etc/rc.d/rc.inet1.conffileandchangetherelatedvariableforyourNICtoYES.
5.3.2StaticIP
StaticIPaddressesarefixedaddressesthatonlychangeifmanuallytoldto.Theseareusedinanycase whereanadministratordoesn'twanttheIPinformationtochange,suchforinternalserversonaLAN, anyserverconnectedtotheInternet,andnetworkedrouters.WithstaticIPaddressing,youassignan addressandleaveitatthat.OthermachinesknowthatyouarealwaysatthatcertainIPaddressand cancontactyouatthataddressalways.
5.3.3/etc/rc.d/rc.inet1.conf
IfyouplanonassigninganIPaddresstoyournewSlackwarebox,youmaydosoeitherthroughthe netconfigscript,oryoumayedit/etc/rc.d/rc.inet1.conf.In/etc/rc.d/rc.inet1.conf, youwillnotice:
#Primarynetworkinterfacecard(eth0) IPADDR[0]="" NETMASK[0]="" USE_DHCP[0]="" DHCP_HOSTNAME[0]=""
Thenfurtheratthebottom:
GATEWAY=""
5.3.4/etc/resolv.conf
Ok,soyou'vegotanIPaddress,you'vegotadefaultgateway,youmayevenhavetenmilliondollars (giveussome),butwhatgoodisthatifyoucan'tresolvenamestoIPaddresses?Noonewantstotype in72.9.234.112intotheirwebbrowsertoreachwww.slackbook.org.Afterall,whootherthanthe authorswouldmemorizethatIPaddress?WeneedtosetupDNS,buthow?That'swhere /etc/resolv.confcomesintoplay. Chancesareyoualreadyhavetheproperoptionsin/etc/resolv.conf.Ifyousetupyournetwork connectionusingDHCP,theDHCPservershouldhandleupdatingthisfileforyou.(Technicallythe DHCPserverjusttellsdhcpcdwhattoputhere,anditobeys.)Ifyouneedtomanuallyupdateyour DNSserverlistthough,you'llneedtohandedit/etc/resolv.conf.Belowisanexample:
#cat/etc/resolv.conf
nameserver192.168.1.254 searchlizella.net
5.3.5/etc/hosts
Nowthatwe'vegotDNSworkingfine,whatifwewanttobypassourDNSserver,oraddaDNS entryforamachinethatisn'tinDNS?Slackwareincludestheoftloved/etc/hostsfilewhichcontains alocallistofDNSnamesandIPaddressestheyshouldmatchto.
#cat/etc/hosts 127.0.0.1localhostlocahost.localdomain 192.168.1.101redtail 172.14.66.32foobar.slackware.com
HereyoucanseethatlocalhosthasanIPaddressof127.0.0.1(alwaysreservedforlocalhost), redtailcanbereachedat192.168.1.101,andfoobar.slackware.comis172.14.66.32.
5.4PPP
ManypeoplestillconnecttotheInternetthroughsomekindofdialupconnection.Themostcommon methodisPPP,thoughSLIPisstilloccasionallyused.SettingupyoursystemtospeakPPPtoaremote serverisprettyeasy.We'veincludedafewtoolstohelpyouinsettingitup.
5.4.1pppsetup
Slackwareincludesaprogramcalledpppsetuptoconfigureyoursystemtouseyourdialupaccount.It sharesalookandfeelsimilartoournetconfigprogram.Toruntheprogram,makesureyouare loggedinasroot.Thentypepppsetuptorunit.Youshouldseeascreenlikethis: Theprogramwillpresentaseriesofquestions,towhichyouwillfeeditappropriateanswers.Thingslike
5.4.2/etc/ppp
Formostusers,runningpppsetupwillbesufficient.However,theremaybeaninstancewhereyou wanttotweaksomeofthevaluesusedbythePPPdaemon.Alloftheconfigurationinformationiskept in/etc/ppp.Hereisalistofwhatthedifferentfilesarefor:
ipdown
ipup
options
options.demand
pppscript
pppsetup.txt
Mostofthesefileswon'tbethereuntilafteryourunpppsetup.
5.5Wireless
Wirelessnetworkingisstillarelativelynewthingintheworldofcomputers,yetisquicklycatchingonas morepeoplebegintopurchaselaptopsandwantnetworkingonthego,withouthavingtofoolwith someoldtwistedpaircable.Thistrenddoesn'tappeartobeslowingdown.Unfortunately,wireless networkingisn'tyetasstronglysupportedinLinuxastraditionalwirednetworking. Therearethreebasicstepstoconfiguringan802.11wirelessEthernetcard: 1. Hardwaresupportforthewirelesscard 2. Configurethecardtoconnecttoawirelessaccesspoint 3. Configurethenetwork
5.5.1HardwareSupport
Hardwaresupportforawirelesscardisprovidedthroughthekernel,eitherwithamoduleorbuiltinto thekernel.Generally,mostnewerEthernetcardsareprovidedthroughkernelmodules,soyou'llwantto determinetheappropriatekernelmoduleandloaditthrough/etc/rc.d/rc.modules.netconfig maynotdetectyourwirelesscard,soyou'llprobablyneedtodeterminethecardyourself.See http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/formoreinformationonkerneldriversfor variouswirelesscards.
5.5.2ConfiguretheWirelessSettings
Thevastmajorityofthisworkisdonebyiwconfig,soasalwaysreadthemanpageforiwconfigif youneedmoreinformation. First,you'llwanttoconfigureyourwirelessaccesspoint.Wirelessaccesspointsvaryquiteabitintheir terminology,andhowtoconfigurethem,soyoumayneedtoadjustabittoaccommodateyour hardware.Ingeneral,you'llneedatleastthefollowinginformation: ThedomainID,ornameofthenetwork(calledtheESSIDbyiwconfig) ThechanneltheWAPuses Theencryptionsettings,includinganykeysused(preferablyinhexadecimal) ANOTEABOUTWEP.WEPisquitflawed,butit'smuchbetterthannothing.Ifyouwisha greaterdegreeofsecurityonyourwirelessnetwork,youshouldinvestigateVPNsorIPSec, bothofwhicharebeyondthescopeofthisdocument.YoumightalsoconfigureyourWAPnot toadvertiseitsdomainID/ESSID.Athoroughdiscussionofwirelesspolicyisbeyondthescope ofthissection,butaquickGooglesearchwillturnupmorethanyoueverwantedtoknow. Onceyou'vegatheredtheaboveinformation,andassumingyou'veusedmodprobetoloadthe appropriatekerneldriver,youcaneditrc.wireless.confandaddyoursettings.The rc.wireless.conffileisabituntidy.Theleasteffortistomodifythegenericsectionwithyour ESSIDandKEY,andCHANNELifrequiredbyyourcard.(TrynotsettingCHANNEL,andifit works,greatifnot,settheCHANNELasappropriate.)Ifyou'redaring,youcanmodifythefilesothat onlythenecessaryvariablesareset.Thevariablenamesinrc.wireless.confcorrespondtothe iwconfigparameters,andarereadbyrc.wirelessandusedintheappropriateiwconfig commands. Ifyouhaveyourkeyinhexadecimal,that'sideal,sinceyoucanbefairlyconfidentthatyourWAPand iwconfigwillagreeonthekey.Ifyouonlyhaveastring,youcan'tbesurehowyourWAPwill translatethatintoahexadecimalkey,sosomeguessworkmaybeneeded(orgetyourWAP'skeyin hex). Onceyou'vemodifiedrc.wireless.conf,runrc.wirelessasroot,thenrunrc.inet1,againas root.Youcantestyourwirelessnetworkingwithstandardtestingtoolssuchasping,alongwith iwconfig.Ifyouhaveawiredinterfaceyoumaywishtouseifconfigtoturnthoseinterfacesoff whileyoutestyourwirelessnetworkingtoensurethere'snointerference.Youmayalsowanttotest yourchangesthroughareboot.
Thatshouldbeallonthewirelessendofthings.
5.5.3ConfiguretheNetwork
Thisisdoneintheexactsamewayaswirednetworks.Simplyrefertoearliersectionsofthischapter.
5.6NetworkFileSystems
Atthispoint,youshouldhaveaworkingTCP/IPconnectiontoyournetwork.Youshouldbeableto pingothercomputersonyourinternalnetworkand,ifyouhaveconfiguredanappropriategateway,you shouldalsobeabletopingcomputersontheInternetitself.Asweknow,thewholepointinbringinga computerontoanetworkistoaccessinformation.Whilesomepeoplemightbringacomputerupona networkjustforthefunofit,mostpeoplewishtobeabletosharefilesandprinters.Theywishtobe abletoaccessdocumentsontheInternetorplayanonlinegame.HavingTCP/IPinstalledandfunctional onyournewSlackwaresystemisameanstothatend,butwithjustTCP/IPinstalled,functionalitywill beveryrudimentary.Tosharefiles,wewillhavetotransferthembackandforthusingeitherFTPor SCP.WecannotbrowsefilesonournewSlackwarecomputerfromtheNetworkNeighborhoodor MyNetworkPlacesiconsonWindowscomputers.We'dliketobeabletoaccessfilesonotherUnix machinesseamlessly. Ideally,we'dliketobeabletouseanetworkfilesystemtoallowustransparentaccesstoourfileson othercomputers.Theprogramsthatweusetointeractwithinformationstoredonourcomputersreally donotneedtoknowonwhatcomputeragivenfileisstoredtheyjustneedtoknowthatitexistsand howtogettoit.Itisthentheresponsibilityoftheoperatingsystemtomanageaccesstothatfilethrough theavailablefilesystemsandnetworkfilesystems.Thetwomostcommonlyusednetworkfilesystems areSMB(asimplementedbySamba)andNFS.
5.6.1SMB/Samba/CIFS
SMB(forServerMessageBlock)isadescendantoftheolderNetBIOSprotocolthatwasinitiallyused byIBMintheirLANManagerproduct.MicrosofthasalwaysbeenfairlyinterestedinNetBIOSandit's successors(NetBEUI,SMBandCIFS).TheSambaprojecthasexistedsince1991,whenitwas originallywrittentolinkanIBMPCrunningNetBIOSwithaUnixserver.Thesedays,SMBisthe preferredmethodforsharingfileandprintservicesoveranetworkforvirtuallytheentirecivilizedworld
Changetheworkgroupnametoreflecttheworkgroupordomainnamethatyouareusinglocally.
#serverstringistheequivalentoftheNTDescriptionfield serverstring=SambaServer
ThiswillbethenameofyourSlackwarecomputerdisplayedintheNetworkNeighborhood(orMy NetworkPlaces)folder.
#Securitymode.Mostpeoplewillwantuserlevelsecurity.See #security_level.txtfordetails.NOTE:Togetthebehaviourof #Samba1.9.18,you'llneedtouse"security=share". security=user
You'llalmostcertainlywishtoimplementuserlevelsecurityonyourSlackwaresystem.
#Youmaywishtousepasswordencryption.Pleaseread #ENCRYPTION.txt,Win95.txtandWinNT.txtintheSamba #documentation. #Donotenablethisoptionunlessyouhavereadthosedocuments encryptpasswords=yes
5.6.2NetworkFileSystem(NFS)
NFS(orNetworkFileSystem)wasoriginallywrittenbySunfortheirSolarisimplementationofUnix. WhileitissignificantlyeasiertogetupandrunningwhencomparedtoSMB,itisalsosignificantlyless secure.TheprimaryinsecurityinNFSisthatitiseasytospoofuserandgroupid'sfromonemachineto another.NFSisanunauthenticatedprotocol.FutureversionsoftheNFSprotocolarebeingdevised thatenhancesecurity,butthesearenotcommonatthetimeofthiswriting. NFSconfigurationisgovernedbythe/etc/exportsfile.Whenyouloadthedefault/etc/exports fileintoaneditor,you'llseeablankfilewithatwolinecommentontop.We'llneedtoaddalinetothe exportsfileforeachdirectorythatwewishtoexport,withalistingofclientworkstationsthatwillbe allowedtoaccessthatfile.Forinstance,ifwewishedtoexportdirectory/home/footoworkstation Bar,wewouldsimplyaddtheline:
/home/fooBar(rw)
toour/etc/exports.Below,you'llfindtheexamplefromthemanpagefortheexportsfile:
#sample/etc/exportsfile /master(rw)trusty(rw,no_root_squash) /projectsproj*.local.domain(rw) /usr*.local.domain(ro)@trusted(rw) /home/joepc001(rw,all_squash,anonuid=150,anongid=100) /pub(ro,insecure,all_squash)
Chapter6XConfiguration
StartingwithSlackware10.0,theXWindowenvironmentinSlackwareisprovidedbyXorg.Xis responsibleforprovidingagraphicaluserinterface.Itisindependentfromtheoperatingsystem,unlike WindowsortheMacOS. TheXWindowSystemisimplementedthroughmanyprogramsthatruninuserland.Thetwomain componentsaretheserverandthewindowmanager.Theserverprovidesthelowlevelfunctionsfor interactingwithyourvideohardware,thusitissystemspecific.Thewindowmanagersitsontopofthe serverandprovidestheuserinterface.Theadvantagetothisisyoucanhavemanydifferentgraphical interfacesbysimplychangingthewindowmanageryouuse. ConfiguringXcanbeacomplextask.Thereasonforthisisthevastnumbersofvideocardsavailable forthePCarchitecture,mostofwhichusedifferentprogramminginterfaces.Luckily,mostcardstoday supportbasicvideostandardsknownasVESA,andifyourcardisamongthemyou'llbeabletostartX usingthestartxcommandrightoutofthebox. Ifthisdoesn'tworkwithyourcard,orifyou'dliketotakeadvantageofthehighperformancefeatures ofyourvideocardsuchashardwareaccelerationor3Dhardwarerendering,thenyou'llneedto reconfigureX. ToconfigureX,you'llneedtomakean/etc/X11/xorg.conffile.Thisfilecontainslotsofdetails aboutyourvideohardware,mouse,andmonitor.It'saverycomplexconfigurationfile,butfortunately thereareseveralprogramstohelpcreateoneforyou.We'llmentionafewofthemhere.
6.1xorgconfig
Thisisasimplemenudrivenfrontendthat'ssimilarinfeeltotheSlackwareinstaller.ItsimplytellstheX servertotakealookatthecard,andthensetupthebestinitialconfigurationfileitcanmakebasedon theinformationitgathers.Thegenerated/etc/X11/xorg.conffileshouldbeagoodstartingpointfor mostsystems(andshouldworkwithoutmodification). ThisisatextbasedXconfigurationprogramthat'sdesignedfortheadvancedsystemadministrator.
Here'sasamplewalkthroughusingxorgconfig.First,starttheprogram:
#xorgconfig
Selectyourmousefromthemenupresented.Ifyoudon'tseeyourserialmouselisted,pickthe Microsoftprotocolit'sthemostcommonandwillprobablywork.Nextxorgconfigwillaskyou aboutusingChordMiddleandEmulate3Buttons.You'llseetheseoptionsdescribedindetailonthe screen.Usethemifthemiddlebuttononyourmousedoesn'tworkunderX,orifyourmouseonlyhas twobuttons(Emulate3Buttonsletsyousimulatethemiddlebuttonbypressingbothbuttons simultaneously).Then,enterthenameofyourmousedevice.Thedefaultchoice,/dev/mouse,should worksincethelinkwasconfiguredduringSlackwaresetup.Ifyou'rerunningGPM(theLinuxmouse server)inrepeatermode,youcansetyourmousetypeto/dev/gpmdatatohaveXgetinformation aboutthemousethroughgpm.Insomecases(withbusmiceespecially)thiscanworkbetter,butmost usersshouldn'tdothis.
xorgconfigwillaskyouaboutenablingspecialkeybindings.Ifyouneedthissayy.Mostuserscan saynenterthisifyou'renotsure.
Figure62.xorgconfigHorizontalSync
Specifytheverticalsyncrangeforyourmonitor(youshouldfindthisinthemanualforthemonitor). xorgconfigwillaskyoutoenterstringstoidentifythemonitortypeinthexorg.conffile.Enteranything
youlikeonthese3lines(includingnothingatall). Figure64.xorgconfigVideoCard
Nowyouhavetheopportunitytolookatthedatabaseofvideocardtypes.You'llwanttodothis,so sayy,andselectacardfromthelistshown.Ifyoudon'tseeyourexactcard,tryselectingonethat usesthesamechipsetanditwillprobablyworkfine. Next,tellxorgconfighowmuchRAMyouhaveonyourvideocard.xorgconfigwillwantyouto entersomemoredescriptivetextaboutyourvideocard.Ifyoulike,youcanenterdescriptionsonthese threelines. You'llthenbeaskedwhichdisplayresolutionsyouwanttouse.Again,goingwiththeprovideddefaults shouldbefinetostartwith.Lateron,youcaneditthe/etc/X11/xorg.conffileandrearrangethe modesso1024x768(orwhatevermodeyoulike)isthedefault. Atthispoint,thexorgconfigprogramwillaskifyou'dliketosavethecurrentconfigurationfile. Answeryes,andtheXconfigurationfileissaved,completingthesetupprocess.YoucanstartXnow withthestartxcommand.
6.2xorgsetup
ThesecondwaytoconfigureXistousexorgsetup,anautomagicalconfigurationprogramthatcomes withSlackware. Torunxorgsetup,loginasrootandtype:
#xorgsetup
6.3xinitrc
xinit(1)istheprogramthatactuallystartsXitiscalledbystartx(1),soyoumaynothavenoticedit
#Startthewindowmanager: execstartkde
Notethatthereareseveralxinitrc.*filesin/var/X11R6/lib/xinitthatcorrespondtovarious windowmanagersandGUIs.Youcanuseanyofthose,ifyoulike.
6.4xwmconfig
Foryears,Unixwasusedalmostexclusivelyastheoperatingsystemforservers,withtheexceptionof highpoweredprofessionalworkstations.OnlythetechnicallyinclinedwerelikelytouseaUnixlike operatingsystem,andtheuserinterfacereflectedthisfact.GUIstendedtobefairlybarebones, designedtorunafewnecessarilygraphicalapplicationslikeCADprogramsandimagerenderers.Most fileandsystemmanagementwasconductedatthecommandline.Variousvendors(SunMicrosystems, SiliconGraphics,etc)weresellingworkstationswithanattempttoprovideacohesivelookandfeel, butthewidevarietyofGUItoolkitsinusebydevelopersledinevitablytothedissolutionofthe desktop'suniformity.Ascrollbarmightnotlookthesameintwodifferentapplications.Menusmight appearindifferentplaces.Programswouldhavedifferentbuttonsandcheckboxes.Colorsranged widely,andweregenerallyhardcodedineachtoolkit.Aslongastheuserswereprimarilytechnical professionals,noneofthismatteredmuch. WiththeadventoffreeUnixlikeoperatingsystemsandthegrowingnumberandvarietyofgraphical applications,Xhasrecentlygainedawidedesktopuserbase.Mostusers,ofcourse,areaccustomedto theconsistentlookandfeelprovidedbyMicrosoft'sWindowsorApple'sMacOSthelackofsuch consistencyinXbasedapplicationsbecameabarriertoitswideracceptance.Inresponse,twoopen sourceprojectshavebeenundertaken:TheKDesktopEnvironment,orKDE,andtheGNUNetwork ObjectModelEnvironment,knownasGNOME.Eachhasawidevarietyofapplications,from taskbarsandfilemanagerstogamesandofficesuites,writtenwiththesameGUItoolkitandtightly integratedtoprovideauniform,consistentdesktop. ThedifferencesinKDEandGNOMEaregenerallyfairlysubtle.Theyeachlookdifferentfromthe other,becauseeachusesadifferentGUItoolkit.KDEisbasedontheQtlibraryfromTrollTechAS, whileGNOMEusesGTK,atoolkitoriginallydevelopedforTheGNUImageManipulationProgram (orTheGIMP,forshort).Asseparateprojects,KDEandGNOMEeachhavetheirowndesignersand programmers,withdifferentdevelopmentstylesandphilosophies.Theresultineachcase,however,has beenfundamentallythesame:aconsistent,tightlyintegrateddesktopenvironmentandapplication collection.Thefunctionality,usability,andsheerprettinessofbothKDEandGNOMErivalanything availableonotheroperatingsystems. Thebestpart,though,isthattheseadvanceddesktopsarefree.Thismeansyoucanhaveeitherorboth (yes,atthesametime).Thechoiceisyours. InadditiontotheGNOMEandKDEdesktops,Slackwareincludesalargecollectionofwindow managers.Somearedesignedtoemulateotheroperatingsystems,someforcustomization,othersfor speed.There'squiteavariety.Ofcourseyoucaninstallasmanyasyouwant,playwiththemall,and decidewhichyoulikethemost. Tomakedesktopselectioneasy,Slackwarealsoincludesaprogramcalledxwmconfigthatcanbe usedtoselectadesktoporwindowmanager.Itisrunlikeso:
%xwmconfig
Figure65.DesktopConfigurationwithxorgconfig
6.5xdm
AsLinuxbecomesmoreandmoreusefulasadesktopoperatingsystem,manyusersfinditdesirablefor themachinetobootstraightintoagraphicalenvironment.Forthis,youwillneedtotellSlackwareto bootstraightintoX,andassignagraphicalloginmanager.Slackwareshipswiththreegraphicallogin tools,xdm(1),kdm,andgdm(1).
xdmisthegraphicalloginmanagershippedwiththeX.orgsystem.It'subiquitous,butnotasfully featuresasalternatives.kdmisthegraphicalloginmanagershippedwithKDE,TheKDesktop Environment.Finally,gdmistheloginmanagershippedwithGNOME.Anyofthechoiceswillallowyou
#ThesearethedefaultrunlevelsinSlackware: #0=halt #1=singleusermode #2=unused(butconfiguredthesameasrunlevel3) #3=multiusermode(defaultSlackwarerunlevel) #4=X11withKDM/GDM/XDM(sessionmanagers) #5=unused(butconfiguredthesameasrunlevel3) #6=reboot #Defaultrunlevel.(Donotsetto0or6) id:3:initdefault:
InordertomakeSlackwareboottoagraphicalenvironment,wejustchangethe3toa4.
#Defaultrunlevel.(Donotsetto0or6) id:4:initdefault:
Finally,youcanjustcommentoutthelinesfortheloginmanageryoudon'twanttouse.
#TrytouseGNOME'sgdmsessionmanager: #if[x/usr/bin/gdm]then #exec/usr/bin/gdmnodaemon #fi #Notthere?OK,trytouseKDE'skdmsessionmanager: if[x/opt/kde/bin/kdm]then
Anylinesprecededbythehashmark(#)areconsideredcommentsandtheshellsilentlypassesthem. Thus,evenifgdmisinstalledandexecutable,theshell(inthiscasebash)won'tbothercheckingforit.
Chapter7Booting
TheprocessofbootingyourLinuxsystemcansometimesbeeasyandsometimesbedifficult.Many usersinstallSlackwareontheircomputerandthat'sit.Theyjustturnitonandit'sreadytouse. Othertimes,simplybootingthemachinecanbeachore.Formostusers,LILOworksbest.Slackware includesLILOandLoadlinforbootingSlackwareLinux.LILOwillworkfromaharddrivepartition,a harddrive'smasterbootrecord,orafloppydisk,makingitaveryversatiletool.Loadlinworksfroma DOScommandline,killingDOSandinvokingLinux. AnotherpopularutilityforbootingLinuxisGRUB.GRUBisnotincludedorofficiallysupportedby Slackware.Slackwareholdstothetriedandtruestandardforwhatgetsincludedinsidethe distribution.WhileGRUBworkswellandincludessomefeaturesthatLILOdoesnot,LILOhandlesall theessentialtasksofabootloaderreliablywithaproventrackrecord.Beingyounger,GRUBhasn't quiteliveduptothatlegacyyet.AsitisnotincludedwithSlackware,wedonotdiscussithere.Ifyou wishtouseGRUB(perhapsitcamewithanotherLinuxOSandyouwanttouseittodualboot)consult GRUB'sdocumentation. ThissectioncoversusingLILOandLoadlin,thetwobootersincludedwithSlackware.Italsoexplains sometypicaldualbootingscenariosandhowyoucouldgoaboutsettingitup.
7.1LILO
TheLinuxLoader,orLILO,isthemostpopularbooterinuseonLinuxsystems.Itisquiteconfigurable andcaneasilybeusedtoboototheroperatingsystems. SlackwareLinuxcomeswithamenudrivenconfigurationutilitycalledliloconfig.Thisprogramis firstrunduringthesetupprocess,butyoucaninvokeitlaterbytypingliloconfigattheprompt. LILOreadsitssettingsfromthe/etc/lilo.conf(5)file.Itisnotreadeachtimeyoubootup,but insteadisreadeachtimeyouinstallLILO.LILOmustbereinstalledtothebootsectoreachtimeyou makeaconfigurationchange.ManyLILOerrorscomefrommakingchangestothelilo.conffile,but failingtorerunlilotoinstallthesechanges.liloconfigwillhelpyoubuildtheconfigurationfilesothat youcaninstallLILOforyoursystem.Ifyouprefertoedit/etc/lilo.confbyhand,thenreinstalling LILOjustinvolvestyping/sbin/lilo(asroot)attheprompt. Whenyoufirstinvokeliloconfig,itwilllooklikethis: Figure71.liloconfig
IfthisisyourfirsttimesettingupLILO,youshouldpicksimple.Otherwise,youmightfindexperttobe fasterifyouarefamiliarwithLILOandLinux.SelectingsimplewillbegintheLILOconfiguration. Ifkernelframebuffersupportiscompiledintoyourkernel,liloconfigwillaskwhichvideoresolution youwouldliketouse.ThisistheresolutionthatisalsousedbytheXFree86framebufferserver.Ifyou donotwanttheconsoletoruninaspecialvideomode,selectingnormalwillkeepthestandard80x25 textmodeinuse. ThenextpartoftheLILOconfigurationisselectingwhereyouwantitinstalled.Thisisprobablythe mostimportantstep.Thelistbelowexplainstheinstallationplaces: Root ThisoptioninstallsLILOtothebeginningofyourLinuxrootpartition.Thisisthesafestoptionif youhaveotheroperatingsystemsonyourcomputer.Itensuresthatanyotherbootersarenot overwritten.ThedisadvantageisthatLILOwillonlyloadfromhereifyourLinuxdriveisthefirst driveonyoursystem.Thisiswhymanypeoplechosetocreateaverysmall/bootpartitionas thefirstdriveontheirsystem.ThisallowsthekernelandLILOtobeinstalledatthebeginningof thedrivewhereLILOcanfindthem.PreviousversionsofLILOcontainedaninfamousflaw knownasthe1024cylinderlimit.LILOwasunabletobootkernelsonpartitionspastthe 1024thcylinder.RecenteditionsofLILOhaveeliminatedthisproblem. Floppy Thismethodisevensaferthanthepreviousone.Itcreatesabootfloppythatyoucanusetoboot yourLinuxsystem.Thiskeepsthebooterofftheharddiskentirely,soyouonlybootthisfloppy whenyouwanttouseSlackware.Theflawswiththismethodareobvious.Floppiesare notoriouslyfickle,pronetofailures.Secondly,thebootloaderisnolongerselfcontainedwithin thecomputer.Ifyoulooseyourfloppydisk,you'llhavetomakeanothertobootyoursystem. MBR
Whateveryoursystemconfigurationis,settingupaworkingbootloaderiseasy.liloconfigmakes settingitupacinch.
7.2LOADLIN
TheotherbootingoptionthatcomeswithSlackwareLinuxisLOADLIN.LOADLINisaDOS executablethatcanbeusedtostartLinuxfromarunningDOSsystem.ItrequirestheLinuxkerneltobe ontheDOSpartitionsothatLOADLINcanloaditandproperlybootthesystem. Duringtheinstallationprocess,LOADLINwillbecopiedtoroot'shomedirectoryasa.ZIPfile.There isnoautomaticsetupprocessforLOADLIN.YouwillneedtocopytheLinuxkernel(typically /boot/vmlinuz)andtheLOADLINfilefromroot'shomedirectorytotheDOSpartition. LOADLINisusefulifyouwouldliketomakeabootmenuonyourDOSpartition.Amenucouldbe
7.3DualBooting
ManyuserssetuptheircomputerstobootSlackwareLinuxandanotheroperatingsystem.We've describedseveraltypicaldualbootscenariosbelow,incaseyouarehavingdifficultysettingupyour system.
7.3.1Windows
SettingupacomputerwithbothMSWindowsandLinuxisprobablythemostcommondualboot scenario.Therearenumerouswaysyoucansetupthebooting,butthissectionwillcovertwo. Oftentimeswhensettingupadualbootsystem,apersonwilldeviseaperfectplanforwhereeverything shouldgobutmessuptheinstallationorder.Itisveryimportanttounderstandthatoperatingsystems needtobeinstalledinacertainorderforadualbootsetuptowork.Linuxalwaysofferscontrolover what,ifanything,getswrittentotheMasterBootRecord.Therefore,it'salwaysadvisabletoinstall Linuxlast.Windowsshouldbeinstalledfirst,sinceitwillalwayswriteitsbootertotheMasterBoot Record,overwritinganyentryLinuxmayhaveputthere. 7.3.1.1UsingLILO
YouwouldalsowanttosetasideanadequateamountofspaceforaLinuxswappartition.The unwrittenruleistousetwicetheamountofRAMyouhaveindiskspace.A64MBsystemwouldhave 128MBofswap,andsoon.AdequateswapspaceisthediscussionofmanyflamesonIRCand Usenet.There'snotrulyrightwaytodoit,butstickingwiththeruleaboveshouldbesufficient. Withyourpartitionslaidout,youshouldproceedtoinstallWindows.Afterthatissetupandworking, youshouldinstallLinux.TheLILOinstallationneedsspecialattention.Youwillwanttoselecttheexpert modeforinstallingLILO. BeginanewLILOconfiguration.YouwillwanttoinstallittoMasterBootRecordsothatitcanbe usedtochoosebetweenthetwooperatingsystems.Fromthemenu,addyourLinuxpartitionandadd yourWindows(orDOS)partition.Oncethat'scomplete,youcaninstallLILO. Rebootthecomputer.LILOshouldloadandwilldisplayamenulettingyouselectbetweenthe operatingsystemsyouhaveinstalled.SelectthenameoftheOSyouwishtoload(thesenameswere selectedwhenyousetupLILO). LILOisquiteaconfigurablebootloader.It'snotjustlimitedtobootingLinuxorDOS.Itcanbootjust aboutanything.Themanpagesforlilo(8)andlilo.conf(5)providemoredetailedinformation. WhatifLILOdoesn'twork?ThereareinstanceswhereLILOjustwon'tworkonaparticularmachine. Fortunately,thereisanotherwaytodualbootLinuxandWindows. 7.3.1.2UsingLOADLIN ThismethodcanbeusedifLILOdoesn'tworkonyoursystem,orifyoujustdon'twanttosetup LILO.ThismethodisalsoidealfortheuserthatreinstallsWindowsoften.Eachtimeyoureinstall Windows,itwilloverwritetheMasterBootRecord,thusdestroyinganyLILOinstallation.With LOADLIN,youarenotsubjecttothatproblem.Thebiggestdisadvantageisthatyoucanonlyuse LOADLINtobootLinux. WithLOADLIN,youcaninstalltheoperatingsystemsinanyorderdesired.Becarefulaboutinstalling thingstotheMasterBootRecord,youdonotwanttodothat.LOADLINreliesontheWindows partitionbeingbootable.SoduringtheSlackwareinstallation,makesureyouskiptheLILOsetup. Afterinstallingtheoperatingsystems,copytheloadlinX.zip(whereXisaversionnumber,suchas 16a)filefromroot'shomedirectorytoyourWindowspartition.Alsocopyyourkernelimagetothe Windowspartition.YouwillneedtobeinLinuxforthistowork.Thisexampleshowshowtodothis:
#mkdir/win
Addthislinetothefile:
BootGUI=0
Nowsavethefileandexittheeditor.NoweditC:\AUTOEXEC.BATsowecanaddabootmenu.The followingprovidesanexampleofwhatabootmenublockinAUTOEXEC.BATwouldlooklike:
cls echoSystemBootMenu echo. echo1Linux echo2Windows echo. choice/c:12"Selection?>" iferrorlevel2gotoWIN iferrorlevel1gotoLINUX :LINUX cls echo"StartingLinux..." cd\linux loadlinc:\linux\vmlinuzroot=/dev/hda2ro gotoEND :WIN cls echo"StartingWindows..." win gotoEND :END
7.3.1.3DeprecatedWindowsNTHack Thisistheleastcommondualbootingsituation.Inthedaysofold,LILOwasunabletobootWindows NT,requiringLinuxuserstohackNTLDR,whichpresentedseveralmoreproblemsthandualbooting betweenWindows9xandLinux.Understandthatthefollowinginstructionsaredeprecated.LILOhas beenabletobootWindowsNT/2000/XP/2003formanyyearsnow.Ifyouareusingalegacymachine though,youmayneedtousejustsuchahack. 1. InstallWindowsNT 2. InstallLinux,makingsureLILOisinstalledtothesuperblockoftheLinuxpartition 3. Getthefirst512bytesoftheLinuxrootpartitionandstoreitontheWindowsNTpartition 4. EditC:\BOOT.INIunderWindowsNTtoaddaLinuxoption InstallingWindowsNTshouldbefairlystraightforward,asshouldinstallingLinux.Fromthere,itgetsa littlemoretricky.Grabbingthefirst512bytesoftheLinuxpartitioniseasierthanitsounds.Youwill needtobeinLinuxtoaccomplishthis.AssumingyourLinuxpartitionis/dev/hda2,issuethis command:
#ddif=/dev/hda2of=/tmp/bootsect.lnxbs=1count=512
Addthislinetotheendofthefile:
C:\bootsect.lnx="SlackwareLinux"
Savethechangesandexittheeditor.WhenyourebootWindowsNT,youwillhaveaLinuxoptionon themenu.ChoosingitwillbootintoLinux.
7.3.2Linux
Yes,peoplereallydothis.Thisisdefinitelytheeasiestdualbootscenario.YoucansimplyuseLILO andaddmoreentriestothe/etc/lilo.conffile.That'sallthereistoit.
Chapter8TheShell
Inagraphicalenvironment,theinterfaceisprovidedbyaprogramthatcreateswindows,scrollbars, menus,etc.Inacommandlineenvironment,theuserinterfaceisprovidedbyashell,whichinterprets commandsandgenerallymakesthingsuseable.Immediatelyafterloggingin(whichiscoveredinthis chapter),usersareputintoashellandallowedtogoabouttheirbusiness.Thischapterservesasan introductiontotheshell,andtothemostcommonshellamongLinuxuserstheBourneAgainShell (bash).Formoredetailedinformationonanythinginthischapter,checkoutthebash(1)manpage.
8.1Users
8.1.1LoggingIn
Soyou'vebooted,andyou'relookingatsomethingthatlookslikethis:
WelcometoLinux2.4.18 Lastlogin:WedJan115:59:1405002005ontty6. darkstarlogin:
8.1.2Root:TheSuperuser
Okay,whoorwhatisroot?Andwhat'sitdoingwithanaccountonyoursystem? Well,intheworldofUnixandsimilaroperatingsystems(likeLinux),thereareusersandthenthereare users.We'llgointothisinmoredetaillater,buttheimportantthingtoknownowisthatrootistheuser aboveallusersrootisallpowerfulandallknowing,andnobodydisobeysroot.Itjustisn'tallowed. rootiswhatwecallasuperuser,andrightlyso.Andbestofall,rootisyou. Cool,huh? Ifyou'renotsure:yes,that'sverycool.Thecatchis,though,thatrootisinherentlyallowedtobreak anythingitsodesires.YoumightwanttoskipaheadtoSection12.1.1andseeaboutaddingauser thenloginasthatuserandworkfromthere.Thetraditionalwisdomisthatit'sbesttoonlybecomethe superuserwhenabsolutelynecessary,soastominimizethepossibilityofaccidentallybreaking something. Bytheway,ifyoudecideyouwanttoberootwhileyou'reloggedinassomeoneelse,noproblem.Just
8.2TheCommandLine
8.2.1RunningPrograms
It'shardtogetmuchaccomplishedwithoutrunningaprogramyoumightbeabletopropsomethingup withyourcomputerorholdadooropen,andsomewillmakethemostlovelyhummingnoisewhen running,butthat'sreallyaboutit.AndIthinkwecanallagreethatitsuseasahummingdoorstopisn't whatbroughtthepersonalcomputerthepopularityitnowenjoys. So,rememberhowalmosteverythinginLinuxisafile?Well,thatgoesforprograms,too.Every commandyourun(thatisn'tbuiltintotheshell)residesasafilesomewhere.Yourunaprogramsimply byspecifyingthefullpathtoit. Forinstance,rememberthatsucommandfromthelastsection?Well,it'sactuallyinthe/bindirectory: /bin/suwouldrunitnicely. Sowhy,then,doesjusttypingsuwork?Afterall,youdidn'tsayitwasin/bin.Itcouldjustaseasily havebeenin/usr/local/share,right?Howdiditknow?TheanswertothatliesinthePATH environmentvariablemostshellshaveeitherPATHorsomethingverymuchlikePATH.Itbasically containsalistofdirectoriestolookinforprogramsyoutrytorun.Sowhenyouransu,yourshellran throughitslistofdirectories,checkingeachoneforanexecutablefilecalledsuthatitcouldrunthefirst oneitcameto,itran.Thishappenswheneveryourunaprogramwithoutspecifyingafullpathtoitif yougetaCommandnotfounderror,thatonlymeansthattheprogramyoutriedtorunisn'tin yourPATH.(Ofcourse,thiswouldbetrueiftheprogramdoesn'texistatall...)We'lldiscuss environmentvariablesinmoredepthinSection8.3.1. Rememberalsothat.isshorthandforthecurrentdirectory,soifyouhappenedtobein/bin,./su wouldhaveworkedasanexplicitfullpath.
8.2.2WildcardMatching
Nearlyeveryshellrecognizessomecharactersasbeingsubstitutesorabbreviationsthatmeananything goeshere.Suchcharactersareaptlynamedwildcardsthemostcommonare*and?.Byconvention,? usuallymatchesanysinglecharacter.Forinstance,supposeyou'reinadirectorywiththreefiles: ex1.txt,ex2.txt,andex3.txt.Youwanttocopyallofthosefiles(usingthecpcommandwe coverinSection10.5.1)toanotherdirectory,say/tmp.Well,typingcpex1.txtex2.txt ex3.txt/tmpisentirelytoomuchwork.It'smucheasiertotypecpex?.txt/tmpthe?will matcheachofthecharacters1,2,and3,andeachinturnwillbesubstitutedin. What'sthatyousay?That'sstilltoomuchwork?You'reright.It'sappallingwehavelaborlawsto protectusfromthatsortofthing.Fortunately,wealsohave*.Aswasalreadymentioned,*matches anynumberofcharacters,including0.Soifthosethreefilesweretheonlyonesinthedirectory,we couldhavesimplysaidcp*/tmpandgottenthemallinonefellswoop.Suppose,though,thatthereis
alsoafilecalledex.txtandonecalledhejaz.txt.Wewanttocopyex.txtbutnothejaz.txt cpex*/tmpwilldothatforus.
cpex?.txt/tmp,would,ofcourse,onlygetouroriginalthreefilesthere'snocharacterinex.txtto
Butwhatwereallywantisjusta1,a2,anda4?Inthepreviousexampleweusedtomeanallvalues between1and4.Wecanalsoseparateindividualentrieswithcommas.
%lsa[1,2,4] a1a2a4
Note,thatifwehadincludedahypheninsteadofacomma,wewouldhavegottenincorrectresults.
%ls[Aa]1 A1B1C1D1a1
Youcanalsocombinehyphenandcommastrings.
%ls[A,ad] A1a1b1c1d1
8.2.3Input/OutputRedirectionandPiping
(Herecomessomethingcool.)
%ps>blargh
Y'knowwhatthatis?That'smerunningpstoseewhichprocessesarerunningpsiscoveredinSection
11.3.That'snotthecoolpart.Thecoolpartis>blargh,whichmeans,roughly,taketheoutputfrom psandwriteittoafilecalledblargh.Butwait,itgetscooler.
%ps|less
Thatonetakestheoutputfrompsandpipesitthroughless,soIcanscrollthroughitatmyleisure.
%ps>>blargh
Redirectiongetsreallyfunwhenyoustartpilingitup:
%ps|tac>>blargh
8.3TheBourneAgainShell(bash)
8.3.1EnvironmentVariables
ALinuxsystemisacomplexbeast,andthere'salottokeeptrackof,alotoflittledetailsthatcomeinto playinyournormalinteractionswithvariousprograms(someofwhichyoumightnotevenneedtobe awareof).Nobodywantstopassabunchofoptionstoeveryprogramthatgetsrun,tellingitwhatkind ofterminalisbeingused,thehostnameofthecomputer,howtheirpromptshouldlook... Soasacopingmechanism,usershavewhat'scalledanenvironment.Theenvironmentdefinesthe conditionsinwhichprogramsrun,andsomeofthisdefinitionisvariabletheusercanalterandplaywith it,asisonlyrightinaLinuxsystem.Prettymuchanyshellwillhaveenvironmentvariables(ifnot,it's probablynotaveryuseableshell).Herewewillgiveanoverviewofthecommandsbashprovidesfor manipulatingitsenvironmentvariables.
setbyitselfwillshowyoualloftheenvironmentvariablesthatarecurrentlydefined,aswellastheir values.Likemostbashbuiltins,itcanalsodoseveralotherthings(withparameters)we'llleaveitto thebash(1)manpagetocoverthat,though.Example81showsanexcerptfromasetcommandrun ononeoftheauthor'scomputers.NoticeinthisexamplethePATHvariablethatwasdiscussedearlier.
Programsinanyofthosedirectoriescanberunsimplybytypingthebasefilename. Example81.ListingEnvironmentVariableswithset
%set PATH=/usr/local/lib/qt/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin: /usr/openwin/bin:/usr/games:.:/usr/local/ssh2/bin:/usr/local/ssh1/bin: /usr/share/texmf/bin:/usr/local/sbin:/usr/sbin:/home/logan/bin PIPESTATUS=([0]="0") PPID=4978 PS1='\h:\w\$' PS2='>' PS4='+' PWD=/home/logan QTDIR=/usr/local/lib/qt REMOTEHOST=ninja.tdn SHELL=/bin/bash %unsetVARIABLE unsetwillremoveanyvariablesthatyougiveit,wipingoutboththevariableanditsvaluebashwill
forgetthatvariableeverexisted.(Don'tworry.Unlessit'ssomethingyouexplicitlydefinedinthatshell session,it'llprobablygetredefinedinanyothersession.)
%exportVARIABLE=some_value
8.3.2TabCompletion
(Herecomessomethingcoolagain.) 1. Acommandlineinterfacemeanslotsoftyping. 2. Typingiswork.
3. Nobodylikeswork. From3and2,wecandeterminethat(4)nobodylikestyping.Fortunately,bashsavesusfrom(5) (nobodylikesacommandlineinterface). Howdoesbashaccomplishthiswonderfulfeat,youask?Inadditiontothewildcardexpansionwe discussedbefore,bashfeaturestabcompletion. Tabcompletionworkssomethinglikethis:You'retypingthenameofafile.Maybeit'sinyourPATH, maybeyou'retypingitoutexplicitly.Allyouhavetodoistypeenoughofthefilenametouniquely identifyit.Thenhitthetabkey.bashwillfigureoutwhatyouwantandfinishtypingitforyou! Exampletime./usr/srccontainstwosubdirectories:/usr/src/linuxand/usr/src/sendmail.I wanttoseewhat'sin/usr/src/linux.SoIjusttypels/usr/src/l,hittheTABkey,andbash givesmels/usr/src/linux. Now,supposetherearetwodirectories/usr/src/linuxand/usr/src/linuxoldIfItype /usr/src/landhitTAB,bashwillfillinasmuchasitcan,andI'llget/usr/src/linux.Icanstop there,orIcanhitTABagain,andbashwillshowalistofdirectoriesthatmatchwhatI'vetypedsofar. Hence,lesstyping(andhence,peoplecanlikecommandlineinterfaces).Itoldyouitwascool.
8.4VirtualTerminals
Soyou'reinthemiddleofworkingonsomethingandyoudecideyouneedtodosomethingelse.You couldjustdropwhatyou'redoingandswitchtasks,butthisisamultiusersystem,right?Andyoucan loginasmanytimessimultaneouslyasyouwant,right?Sowhyshouldyouhavetodoonethingata time? Youdon't.Wecan'tallhavemultiplekeyboards,mice,andmonitorsforonemachinechancesaremost ofusdon'twantthem.Clearly,hardwareisn'tthesolution.Thatleavessoftware,andLinuxstepsupon thisone,providingvirtualterminals,orVTs. BypressingAltandafunctionkey,youcanswitchbetweenvirtualterminalseachfunctionkey correspondstoone.Slackwarehasloginson6VTsbydefault.Alt+F2willtakeyoutothesecondone, Alt+F3tothethird,etc. TherestofthefunctionkeysarereservedforXsessions.EachXsessionusesitsownVT,beginning withtheseventh(Alt+F7)andgoingup.WheninX,theAlt+Functionkeycombinationisreplaced withCtrl+Alt+FunctionsoifyouareinXandwanttogetbacktoatextlogin(withoutexitingyourX session),Ctrl+Alt+F3willtakeyoutothethird.(Alt+F7willtakeyouback,assumingyou'reusingthe firstXsession.)
8.4.1Screen
Butwhataboutsituationswheretherearenovirtualterminals?Whatthen?Fortunately,slackware includesabeautifulscreenmanageraptlynamedscreen.screenisaterminalemulatorthathasvirtual terminallikecapabilities.Executingscreenflashesabriefintroduction,thendumpstoaterminal.Unlike thestandardvirtualterminals,screenhasitsowncommands.Allscreencommandsareprefixedwith aCrtl+Akeystroke.Forexample,Ctrl+A+Cwillcreateanewterminalsession.Ctrl+A+Nwillswitch tothenextterminal.Ctrl+A+Pswitchestothepreviousterminal.
Chapter9FilesystemStructure
WehavealreadydiscussedthedirectorystructureinSlackwareLinux.Bythispoint,youshouldbeable tofindfilesanddirectoriesthatyouneed.Butthereismoretothefilesystemthanjustthedirectory structure. Linuxisamultiuseroperatingsystem.Everyaspectofthesystemismultiuser,eventhefilesystem.The systemstoresinformationlikewhoownsafileandwhocanreadit.Thereareotheruniquepartsabout thefilesystems,suchaslinksandNFSmounts.Thissectionexplainsthese,aswellasthemultiuser aspectsofthefilesystem.
9.1Ownership
Thefilesystemstoresownershipinformationforeachfileanddirectoryonthesystem.Thisincludeswhat userandgroupownaparticularfile.Theeasiestwaytoseethisinformationiswiththelscommand:
%lsl/usr/bin/wc rwxrxrx1rootbin7368Jul301999/usr/bin/wc
Tochangethegroupownertoroot,wewouldusechgrp:
#chgrproot/usr/bin/wc
Wecanalsousechowntospecifytheuserandgroupownersforafile:
#chowndaemon:root/usr/bin/wc
9.2Permissions
Permissionsaretheotherimportantpartofthemultiuseraspectsofthefilesystem.Withthese,youcan changewhocanread,write,andexecutefiles. Thepermissioninformationisstoredasfouroctaldigits,eachspecifyingadifferentsetofpermissions. Thereareownerpermissions,grouppermissions,andworldpermissions.Thefourthoctaldigitisused tostorespecialinformationsuchassetuserID,setgroupID,andthestickybit.Theoctalvalues assignedtothepermissionmodesare(theyalsohavelettersassociatedwiththemthataredisplayedby programssuchaslsandcanbeusedbychmod): Table91.OctalPermissionValues PermissionType OctalValue LetterValue stickybit setuserID setgroupID read write execute 1 4 2 4 2 1 t s s r w x
Youaddtheoctalvaluesforeachpermissiongroup.Forexample,ifyouwantthegrouppermissionsto bereadandwrite,youwoulduse6inthegroupportionofthepermissioninformation.
bash'sdefaultpermissionsare:
%lsl/bin/bash rwxrxrx1rootbin477692Mar2119:57/bin/bash
Alloftheabove a Todotheabove,wewouldhavetouseseveralcommandlines:
%chmoda+rx/tmp/example %chmodu+w/tmp/example %chmodug+s/tmp/example
WementionedsetuserIDandsetgroupIDpermissionsinseveralplacesabove.Youmaybe wonderingwhatthisis.Normallywhenyourunaprogram,itisoperatingunderyouruseraccount.That is,ithasallthepermissionsthatyouasauserhave.Thesameistrueforthegroup.Whenyouruna program,itexecutesunderyourcurrentgroup.WithsetuserIDpermissions,youcanforcetheprogram toalwaysrunastheprogramowner(suchasroot).SetgroupIDisthesame,butforthegroup. Becarefulwiththis,setuserIDandsetgroupIDprogramscanopenmajorsecurityholesonyour system.IfyoufrequentlysetuserIDprogramsthatareownedbyroot,youareallowinganyonetorun thatprogramandrunitasroot.Sinceroothasnorestrictionsonthesystem,youcanseehowthis wouldposeamajorsecurityproblem.Inshort,it'snotbadtousesetuserIDandsetgroupID permissions,justusecommonsense.
9.3Links
Linksarepointersbetweenfiles.Withlinks,youcanhavefilesexistinmanylocationsandbeaccessible bymanynames.Therearetwotypesoflinks:hardandsoft. Hardlinksarenamesforaparticularfile.Theycanonlyexistwithinasinglefilesystemandareonly removedwhentherealnameisremovedfromthesystem.Theseareusefulinsomecases,butmany usersfindthesoftlinktobemoreversatile. Thesoftlink,alsocalledasymboliclink,canpointtoafileoutsideofitsfilesystem.Itisactuallyasmall filecontainingtheinformationitneeds.Youcanaddandremovesoftlinkswithoutaffectingtheactual file.Andsinceasymboliclinkisactuallyasmallfilecontainingitsowninformation,theycanevenpoint atadirectory.It'srathercommontohave/var/tmpactuallybeasymboliclinkto/tmpforexample.
Linksdonothavetheirownsetofpermissionsorownerships,butinsteadreflectthoseofthefilethey pointto.Slackwareusesmostlysoftlinks.Hereisacommonexample:
%lsl/bin/sh lrwxrwxrwx1rootroot4Apr612:34/bin/sh>bash
9.4MountingDevices
AswaspreviouslydiscussedinSection4.1.1,allthedrivesanddevicesinyourcomputerareonebig filesystem.Variousharddrivepartitions,CDROMs,andfloppiesareallplacedinthesametree.In ordertoattachthesedrivestothefilesystemsothatyoucanaccessthem,youhavetousethemount(1) andumount(1)commands. Somedevicesareautomaticallymountedwhenyoubootupyourcomputer.Thesearelistedinthe /etc/fstabfile.Anythingthatyouwanttobemountedautomaticallygetsanentryinthatfile.For otherdevices,you'llhavetoissueacommandeverytimeyouwanttousethedevice.
9.4.1fstab
Let'slookatanexampleofthe/etc/fstabfile:
%cat/etc/fstab /dev/sda1/ext2defaults11 /dev/sda2/usr/localext2defaults11 /dev/sda4/homeext2defaults11 /dev/sdb1swapswapdefaults00 /dev/sdb3/exportext2defaults11 none/dev/ptsdevptsgid=5,mode=62000 none/procprocdefaults00 /dev/fd0/mntext2defaults00 /dev/cdrom/mnt/cdromiso9660ro00
9.4.2mountandumount
Attachinganotherdevicetoyourfilesystemiseasy.Allyouhavetodoisusethemountcommand, alongwithafewoptions.Usingmountcansimplifiedifthedevicehasanentryinthe/etc/fstabfile. Forexample,let'ssaythatIwantedtomountmyCDROMdriveandthatmyfstabfilelookedlike theexamplefromtheprevioussection.Iwouldcallmountlikeso:
%mount/cdrom
Sincethereisanentryinfstabforthatmountpoint,mountknowswhatoptionstouse.Iftherewasn't anentryforthatdevice,Iwouldhavetouseseveraloptionsformount:
%mounttiso9660oro/dev/cdrom/cdrom
Thatcommandlineincludesthesameinformationastheexamplefstabdid,butwe'llgooverallthe partsanyways.Thetiso9660isthefilesystemtypeofthedevicetomount.Inthiscase,itwouldbethe iso9660filesystemwhichiswhatCDROMdrivesmostcommonlyuse.Theorotellsmounttomount thedevicereadonly.The/dev/cdromisthenameofthedevicetomount,and/cdromisthelocation onthefilesystemtomountthedrive. Beforeyoucanremoveafloppy,CDROM,orotherremovabledevicethatiscurrentlymounted,you'll havetounmountit.Thatisdoneusingtheumountcommand.Don'taskwherethenwentbecausewe couldn'ttellyou.Youcanuseeitherthemounteddeviceorthemountpointastheargumenttoumount. Forexample,ifyouwantedtounmounttheCDROMfromthepreviousexample,eitherofthese commandswouldwork:
#umount/dev/cdrom #umount/cdrom
9.5NFSMounts
NFSstandsfortheNetworkFilesystem.Itisnotreallypartoftherealfilesystem,butcanbeusedto addpartstothemountedfilesystem. LargeUnixenvironmentsoftentimessharethesameprograms,setsofhomedirectories,andmailspool. TheproblemofgettingthesamecopytoeachmachineissolvedwithNFS.WecanuseNFStoshare onesetofhomedirectoriesbetweenalloftheworkstations.TheworkstationsthenmountthatNFS shareasifitwereontheirownmachines. SeeSection5.6.2andthemanpagesforexports(5),nfsd(8),andmountd(8)formoreinformation.
Chapter10HandlingFilesandDirectories
LinuxaimstothemostUnixlikeitcanbe.Traditionally,Unixoperatingsystemshavebeencommand lineoriented.WedohaveagraphicaluserinterfaceinSlackware,butthecommandlineisstillthemain levelofcontrolforthesystem.Therefore,itisimportanttounderstandsomeofthebasicfile managementcommands. Thefollowingsectionsexplainthecommonfilemanagementcommandsandprovideexamplesofhow theyareused.Therearemanyothercommands,butthesewillhelpyougetstarted.Also,the commandsareonlybrieflydiscussedhere.Youwillfindmoredetailintheaccompanyingmanpagesfor eachcommand.
10.1Navigation:ls,cd,andpwd
10.1.1ls
Thiscommandlistsfilesinadirectory.WindowsandDOSuserswillnoticeitssimilaritytothedir command.Byitself,ls(1)willlistthefilesinthecurrentdirectory.Toseewhat'sinyourrootdirectory, youcouldissuethesecommands:
%cd/ %ls bincdrdevhomelost+foundprocsbintmpvar bootcdrometclibmntrootsuncdusrvmlinuz
Theproblemalotofpeoplehavewiththatoutputisthatyoucannoteasilytellwhatisadirectoryand whatisafile.Someuserspreferthatlsaddatypeidentifiertoeachlisting,likethis:
%lsFC bin/cdr/dev/home/lost+found/proc/sbin/tmp/var/ boot/cdrom/etc/lib/mnt/root/suncd/usr/vmlinuz
Directoriesgetaslashattheendofthename,executablefilesgetanasteriskattheendofthename, andsoon.
lscanalsobeusedtogetotherstatisticsonfiles.Forexample,toseethecreationdates,owners,and
permissions,youwouldlookatalonglisting:
%lsl drwxrxrx2rootbin4096May709:11bin/ drwxrxrx2rootroot4096Feb2403:55boot/ drwxrxrx2rootroot4096Feb1801:10cdr/ drwxrxrx14rootroot6144Oct2318:37cdrom/ drwxrxrx4rootroot28672Mar518:01dev/ drwxrxrx10rootroot4096Mar803:32etc/ drwxrxrx8rootroot4096Mar803:31home/ drwxrxrx3rootroot4096Jan2321:29lib/ drwxrxrx2rootroot16384Nov108:53lost+found/ drwxrxrx2rootroot4096Oct612:47mnt/ drxrxrx62rootroot0Mar415:32proc/
Supposeyouwanttogetalistingofthehiddenfilesinthecurrentdirectory.Thiscommandwilldojust that:
%lsa .bincdromhomemntsbinusr ..bootdevlibprocsuncdvar .pwrchute_tmpcdretclost+foundroottmpvmlinuz
10.1.2cd
Thecdcommandisusedtochangeworkingdirectories.Yousimplytypecdfollowedbythepathname tochangeto.Herearesomeexamples:
darkstar:~$cd/bin darkstar:/bin$cdusr bash:cd:usr:Nosuchfileordirectory darkstar:/bin$cd/usr darkstar:/usr$ls bin darkstar:/usr$cdbin darkstar:/usr/bin$
Itwilldisplaytheoptionsforcdandhowtousethem.
10.1.3pwd
Thepwdcommandisusedtoshowyourcurrentlocation.Tousethepwdcommandjusttypepwd.For
example:
%cd/bin %pwd /bin %cd/usr %cdbin %pwd /usr/bin
10.2Pagers:more,less,andmost
10.2.1more
more(1)iswhatwecallapagerutility.Oftentimestheoutputofaparticularcommandistoobigtofiton
Thatshouldscrollforawhile.Tobreakuptheoutputscreenbyscreen,justpipeitthroughmore:
%lsl|more
10.2.2less
Themorecommandisquitehandy,butoftenyouwillfindthatyouhaveadvancedpastthescreenyou wanted.moredoesnotprovideawaytogoback.Theless(1)commandprovidesthisfunctionality.It isusedinthesamewayasthemorecommand,sothepreviousexamplesapplyheretoo.So,lessis morethanmore.JoostKremersputsitthisway:
lessismore,butmoremorethanmoreis,somoreislessless,sousemorelessifyou
wantlessmore.
10.2.3most
Wheremoreandlessleaveoff,most(1)picksbackup.Iflessismorethanmore,mostismorethan less.Whereastheotherpagerscanonlydisplayonefileatatime,mostiscapableofviewingany
numberoffiles,aslongaseachfile'swindowisatleast2lineslong.mosthasalotofoptions,checkthe manpageforfulldetails.
10.3SimpleOutput:catandecho
10.3.1cat
cat(1)isshortforconcatenate.Itwasoriginallydesignedtomergetextfilesintoone,butcanbeused
The/bin/bashprogramiscopiedtoyourhomedirectoryandnamedmybash.
cathasmanyusesandtheonesdiscussedherearejustafew.Sincecatmakesextensiveuseof
standardinputandstandardoutput,itisidealforuseinshellscriptsorpartofothercomplex commands.
10.3.2echo
Theecho(1)commanddisplaysthespecifiedtextonthescreen.Youspecifythestringtodisplayafter theechocommand.Bydefaultechowilldisplaythestringandprintanewlinecharacterafterit.You canpassthenoptiontosuppresstheprintingofthenewline.Theeoptionwillcauseechotosearch forescapecharactersinthestringandexecutethem.
10.4Creation:touchandmkdir
10.4.1touch
touch(1)isusedtochangethetimestamponafile.Youcanchangeaccesstimestampsand modificationtimestampswiththiscommand.Ifthefilespecifieddoesnotexist,touchwillcreateazero
lengthfilewiththenamespecified.Tomarkafilewiththecurrentsystemtime,youwouldissuethis command:
%lsalfile1 rwrr1rootroot9779Feb721:41file1 %touchfile1 %lsalfile1 rwrr1rootroot9779Feb809:17file1
Thereareseveraloptionsfortouch,includingoptionstospecifywhichtimestamptomodify,thetimeto use,andmanymore.Theonlinemanualpagediscussestheseindetail.
10.4.2mkdir
mkdir(1)willcreateanewdirectory.Yousimplyspecifythedirectorytocreatewhenyourunmkdir. Thisexamplecreatesthehejazdirectoryinthecurrentdirectory:
%mkdirhejaz
Youcanalsospecifyapath,likethis:
%mkdir/usr/local/hejaz
Thepoptionwilltellmkdirtomakeanyparentdirectories.Theaboveexamplewillfailif/usr/local doesnotexist.Thepoptionwillcreate/usr/localand/usr/local/hejaz:
%mkdirp/usr/local/hejaz
10.5CopyandMove
10.5.1cp
cp(1)copiesfiles.DOSuserswillnoticeitssimilaritytothecopycommand.Therearemanyoptionsfor cp,soyoushouldhavealookatthemanpagebeforeusingit.
Acommonuseistousecptocopyafilefromonelocationtoanother.Forexample:
%cphejaz/tmp
Thiscopiesthehejazfilefromthecurrentdirectorytothe/tmpdirectory.
Manyusersprefertokeepthetimestampspreserved,asinthisexample:
%cpahejaz/tmp
Thisensuresthatthetimestampsarenotmodifiedinthecopy. Torecursivelycopythecontentsofadirectorytoanotherdirectory,youwouldissuethiscommand:
%cpRmydir/tmp
10.5.2mv
mv(1)movesfilesfromoneplacetoanother.Soundssimpleenoughdoesn'tit?
%mvoldfile/tmp/newfile mvhasafewusefulcommandlineoptionsthataredetailedinthemanpage.Inpractice,mvisalmost
neverusedwithcommandlineoptions.
10.6Deletion:rmandrmdir
10.6.1rm
rm(1)removesfilesanddirectorytrees.DOSuserswillnoticethesimilaritytoboththedeland deltreecommands.rmcanbeverydangerousifyoudonotwatchyourself.Whileitissometimes
Ifthefilehaswritepermissionsremoved,youmaygetapermissiondeniederrormessage.Toforce removalofthefilenomatterwhat,passthefoption,likethis:
%rmffile1
Beverycarefulwithrmyoucanshootyourselfinthefoot.Thereareseveralcommandlineoptions, whicharediscussedindetailintheonlinemanualpage.
10.6.2rmdir
rmdir(1)removesdirectoriesfromthefilesystem.Thedirectorymustbeemptybeforeitcanbe
removed.Thesyntaxissimply:
%rmdir<directory>
Thisexamplewillremovethehejazsubdirectoryinthecurrentworkingdirectory:
%rmdirhejaz
Ifthatdirectorydoesnotexist,rmdirwilltellyou.Youcanalsospecifyafullpathtoadirectoryto remove,asthisexampleshows:
%rmdir/tmp/hejaz
Thatexamplewilltrytoremovethehejazdirectoryinsidethe/tmpdirectory. Youcanalsoremoveadirectoryandallofitsparentdirectoriesbypassingthepoption.
%rmdirp/tmp/hejaz
Thiswillfirsttrytoremovethehejazdirectoryinside/tmp.Ifthatissuccessful,itwilltrytoremove /tmp.rmdirwillcontinuethisuntilanerrorisencounteredortheentiretreespecifiedisremoved.
10.7Aliasingfileswithln
ln(1)isusedtocreatelinksbetweenfiles.Theselinkscanbeeitherhardlinksorsoft(symbolic)links.
ThedifferencesbetweenthetwokindsoflinkswerediscussedinSection9.3.Ifyouwantedtomakea
symboliclinktothedirectory/var/media/mp3andplacethelinkinyourhomedirectory,youwould dothis:
%lns/var/media/mp3~/mp3
Chapter11ProcessControl
Everyprogramthatisrunningiscalledaprocess.TheseprocessesrangefromthingsliketheXWindow Systemtosystemprograms(daemons)thatarestartedwhenthecomputerboots.Everyprocessruns asaparticularuser.Processesthatarestartedatboottimeusuallyrunasrootornobody.Processes thatyoustartwillrunasyou.Processesstartedasotheruserswillrunasthoseusers. Youhavecontroloveralltheprocessesthatyoustart.Additionally,roothascontroloverallprocesses onthesystem,includingthosestartedbyotherusers.Processescanbecontrolledandmonitored throughseveralprograms,aswellassomeshellcommands.
11.1Backgrounding
Programsstartedfromthecommandlinestartupintheforeground.Thisallowsyoutoseealltheoutput oftheprogramandinteractwithit.However,thereareseveraloccasionswhenyou'dliketheprogram torunwithouttakingupyourterminal.Thisiscalledrunningtheprograminthebackground,andthere areafewwaystodoit. Thefirstwaytobackgroundaprocessisbyaddinganampersandtothecommandlinewhenyoustart theprogram.Forexample,assumeyouwantedtousethecommandlinemp3playeramptoplaya directoryfullofmp3s,butyouneededtodosomethingelseonthesameterminal.Thefollowing commandlinewouldstartupampinthebackground:
%amp*.mp3&
momentarilystopsrunning,butcanbestartedupagainatanytime.Onceyouhavesuspendeda process,youarereturnedtoaprompt.Youcanbackgroundtheprocessbytyping:
%bg
Nowthesuspendedprocessisrunninginthebackground.
11.2Foregrounding
Ifyouneedtointeractwithabackgroundedprocess,youcanbringitbackintotheforeground.If you'veonlygotonebackgroundedprocess,youcanbringitbackbytyping:
%fg
11.3ps
Sonowyouknowhowtoswitchbackandforthbetweenseveralprocessesthatyou'vestartedfromthe commandline.Andyoualsoknowthattherearelotsofprocessesrunningallthetime.Sohowdoyou listalloftheseprograms?Well,youmakeuseoftheps(1)command.Thiscommandhasalotof options,sowe'llonlycoverthemostimportantoneshere.Foracompletelisting,seethemanpagefor ps.ManpagesarecoveredindepthinSection2.1.1. Simplytypingpswillgetyoualistingoftheprogramsrunningonyourterminal.Thisincudesthe foregroundprocesses(whichincludewhatevershellyouareusing,andofcourse,psitself).Alsolisted arebackgroundedprocessesyoumayhaverunning.Manytimes,thatwillbeaveryshortlisting: Figure111.Basicpsoutput
%ps PIDTTYTIMECMD 7923ttyp000:00:00bash 8059ttyp000:00:00ps
Eventhoughthisisnotalotofprocesses,theinformationisverytypical.You'llgetthesamecolumns usingregularpsnomatterhowmanyprocessesarerunning.Sowhatdoesitallmean? Well,thePIDistheprocessID.Allrunningprocessesaregivenauniqueidentifierwhichranges between1and32767.EachprocessisassignedthenextfreePID.Whenaprocessquits(oriskilled, asyouwillseeinthenextsection),itgivesupitsPID.WhenthemaxPIDisreached,thenextfreeone willwrapbackaroundtothelowestfreeone. TheTTYcolumnindicateswhichterminaltheprocessisrunningon.Doingaplainpswillonlylistallthe programsrunningonthecurrentterminal,soalltheprocessesgivethesameinformationintheTTY column.Asyoucansee,bothprocesseslistedarerunningonttyp0.Thisindicatesthattheyareeither runningremotelyorfromanXterminalofsomevariety. TheTIMEcolumnindicatedhowmuchCPUtimetheprocesshasbeenrunning.Thisisdifferentfrom theactualamountoftimethataprocessruns.RememberthatLinuxisamultitaskingoperatingsystem. Therearemanyprocessesrunningallthetime,andtheseprocesseseachgetasmallportionofthe processor'stime.So,theTIMEcolumnshouldshowmuchlesstimeforeachprocessthanitactually takestorun.IfyouseemorethanseveralminutesintheTIMEcolumn,itcouldmeanthatsomethingis wrong. Finally,theCMDcolumnshowswhattheprogramactuallyis.Itonlyliststhebasenameoftheprogram, notanycommandlineoptionsorsimilarinformation.Togetthatinformation,you'llneedtouseoneof themanyoptionstops.We'lldiscussthatshortly. Youcangetacompletelistingoftheprocessesrunningonyoursystemusingtherightcombinationof options.Thiswillprobablyresultinalonglistingofprocesses(fiftyfiveonmylaptopasIwritethis sentence),soI'llabbreviatetheoutput:
%psax PIDTTYSTATTIMECOMMAND 1?S0:03init[3] 2?SW0:13[kflushd] 3?SW0:14[kupdate]
4?SW0:00[kpiod] 5?SW0:17[kswapd] 11?S0:00/sbin/kerneld 30?SW0:01[cardmgr] 50?S0:00/sbin/rpc.portmap 54?S0:00/usr/sbin/syslogd 57?S0:00/usr/sbin/klogdc3 59?S0:00/usr/sbin/inetd 61?S0:04/usr/local/sbin/sshd 63?S0:00/usr/sbin/rpc.mountd 65?S0:00/usr/sbin/rpc.nfsd 67?S0:00/usr/sbin/crondl10 69?S0:00/usr/sbin/atdb15l1 77?S0:00/usr/sbin/apmd 79?S0:01gpmm/dev/mousetps2 94?S0:00/usr/sbin/automount/autofile/etc/auto.misc 106tty1S0:08bash 108tty3SW0:00[agetty] 109tty4SW0:00[agetty] 110tty5SW0:00[agetty] 111tty6SW0:00[agetty] [outputcut]
Mostoftheseprocessesarestartedatboottimeonmostsystems.I'vemadeafewmodificationstomy system,soyourmileagewillmostlikelyvary.However,youwillseemostoftheseprocessesonyour systemtoo.Asyoucansee,theseoptionsdisplaycommandlineoptionstotherunningprocesses. Recently,akernelvulnerabilityinptracefacilitatedafixwhichnolongershowscommandlineoptions formanyrunningprocesses.ThesearenowlistedinbracketslikePIDs108through110.Italsobrings upafewmorecolumnsandsomeotherinterestingoutput. First,you'llnoticethatmostoftheseprocessesarelistedasrunningontty?.Thosearenotattached toanyparticularterminal.Thisismostcommonwithdaemons,whichareprocesseswhichrunwithout attachingtoanyparticularterminal.Commondaemonsaresendmail,BIND,apache,andNFS.They typicallylistenforsomerequestfromaclient,andreturninformationtoituponrequest. Second,thereisanewcolumn:STAT.Itshowsthestatusoftheprocess.Sstandsforsleeping:the processiswaitingforsomethingtohappen.Zstandsforazombiedprocess.Azombiedprocessesis onewhoseparenthasdied,leavingthechildprocessesbehind.Thisisnotagoodthing.Dstandsfora processthathasenteredanuninterruptiblesleep.Often,theseprocessesrefusetodieevenwhen passedaSIGKILL.YoucanreadmoreaboutSIGKILLlaterinthenextsectiononkill.Wstands forpaging.AdeadprocessismarkedwithanX.AprocessmarkedTistraced,orstopped.Rmeans thattheprocessisrunable. Ifyouwanttoseeevenmoreinformationabouttherunningprocesses,trythisout:
%psaux USERPID%CPU%MEMVSZRSSTTYSTATSTARTTIMECOMMAND root10.00.034480?SMar020:03init[3] root20.00.000?SWMar020:13[kflushd] root30.00.000?SWMar020:14[kupdate] root40.00.000?SWMar020:00[kpiod] root50.00.000?SWMar020:17[kswapd] root110.00.0104444?SMar020:00/sbin/kerneld root300.00.011600?SWMar020:01[cardmgr] bin500.00.01076120?SMar020:00/sbin/rpc.port root540.00.11360192?SMar020:00/usr/sbin/sysl root570.00.11276152?SMar020:00/usr/sbin/klog root590.00.0133260?SMar020:00/usr/sbin/inet
root610.00.21540312?SMar020:04/usr/local/sbi root630.00.0179672?SMar020:00/usr/sbin/rpc. root650.00.0181268?SMar020:00/usr/sbin/rpc. root670.00.21172260?SMar020:00/usr/sbin/cron root770.00.21048316?SMar020:00/usr/sbin/apmd root790.00.11100152?SMar020:01gpm root940.00.21396280?SMar020:00/usr/sbin/auto chris1060.00.51820680tty1SMar020:08bash root1080.00.010480tty3SWMar020:00[agetty] root1090.00.010480tty4SWMar020:00[agetty] root1100.00.010480tty5SWMar020:00[agetty] root1110.00.010480tty6SWMar020:00[agetty] [outputcut]
11.4kill
Onoccasion,programsmisbehaveandyou'llneedtoputthembackinline.Theprogramforthiskindof administrationiscalledkill(1),anditcanbeusedformanipulatingprocessesinseveralways.The mostobvioususeofkillistokilloffaprocess.You'llneedtodothisifaprogramhasrunawayandis usinguplotsofsystemresources,orifyou'rejustsickofitrunning. Inordertokilloffaprocess,you'llneedtoknowitsPIDoritsname.TogetthePID,usetheps commandaswasdiscussedinthelastsection.Forexample,tokilloffprocess4747,you'dissuethe following:
%kill4747
Anyandallvimprocessesyouhaverunningwilldieoff.Doingthisasrootwouldkilloffallthevim processesrunningforallusers.Thisbringsupaninterestingwaytokickeveryone(includingyourself)
offthesystem:
#killallbash
Thenumbermustbeusedforkill,whilethenameminustheleadingSIGcanbeusedwith killall.Here'sanotherexample:
%killallKILLvim
11.5top
Finally,there'sacommandyoucanusetodisplayupdatinginformationabouttheprocessesrunningon thesystem.Thiscommandiscalledtop(1),andisstartedlikeso:
%top
usageinformation,runningtime,andprogramname.
6:47pmup1day,18:01,1user,loadaverage:0.02,0.07,0.02 61processes:59sleeping,2running,0zombie,0stopped CPUstates:2.8%user,3.1%system,0.0%nice,93.9%idle Mem:257992Kav,249672Kused,8320Kfree,51628Kshrd,78248Kbuff Swap:32764Kav,136Kused,32628Kfree,82600Kcached PIDUSERPRINISIZERSSSHARESTATLIB%CPU%MEMTIMECOMMAND 112root1201937618M2468R03.77.555:53X 4947david150213621361748S02.30.80:00screenshot 3398david702054420M3000S01.57.90:14gimp 4946root12010401040836R01.50.40:00top 121david40796796644S01.10.325:37wmSMPmon 115david30218021801452S00.30.81:35wmaker 4948david160776776648S00.30.30:00xwd 1root10176176148S00.10.00:13init 189david10625661564352S00.12.43:16licq 4734david0011641164916S00.10.40:00rxvt 2root00000SW00.00.00:08kflushd 3root00000SW00.00.00:06kupdate 4root00000SW00.00.00:00kpiod 5root00000SW00.00.00:04kswapd 31root00340340248S00.00.10:00kerneld 51root00484832S00.00.00:00dhcpcd 53bin00316316236S00.00.10:00rpc.portmap 57root00588588488S00.00.20:01syslogd
Asyoucansee,I'mcurrentlyrunningX,top,agnometerminal(inwhichI'mwritingthis)andmany
otherXrelatedprocesseswhichtakeupthemostCPUtimeforme.Thisisagoodwaytomonitorhow hardyourusersareworkingyoursystem.
topalsosupportsmonitoringprocessesbytheirPID,ignoringidleandzombiedprocesses,andmany otheroptions.Thebestplacetogetahandleontheseoptionsisthemanpagefortop.
Chapter12EssentialSystemAdministration
Whoawhoawhoawhoawhoa....Iknowwhatyou'rethinking.I'mnotasystemadministrator!Idon't evenwanttobeasystemadministrator! Factis,youaretheadministratorofanycomputersforwhichyouhavetherootpassword.Thismight beyourdesktopboxwithoneortwousers,oritmightbeabigserverwithseveralhundred. Regardless,you'llneedtoknowhowtomanageusers,andhowtoshutdownthesystemsafely.These tasksseemsimple,buttheyhavesomequirkstokeepinmind.
12.1UsersandGroups
AsmentionedinChapter8,youshouldn'tnormallyuseyoursystemloggedinasroot.Instead,you shouldcreateanormaluseraccountforeverydayuse,andusetherootaccountonlyforsystem administrationtasks.Tocreateauser,youcaneitherusethetoolssuppliedwithSlackware,oryoucan editthepasswordfilesbyhand.
12.1.1SuppliedScripts
Theeasiestwaytomanageusersandgroupsiswiththesuppliedscriptsandprograms.Slackware includestheprogramsadduser,userdel(8),chfn(1),chsh(1),andpasswd(1)fordealingwithusers. Thecommandsgroupadd(8),groupdel(8),andgroupmod(8)arefordealingwithgroups.Withthe exceptionofchfn,chsh,andpasswd,theseprogramsaregenerallyonlyrunasroot,andare thereforelocatedin/usr/sbin.chfn,chsh,andpasswdcanberunbyanyone,andarelocatedin /usr/bin. Userscanbeaddedwiththeadduserprogram.We'llstartoutbygoingthroughthewholeprocedure, showingallthequestionsthatareaskedandabriefdescriptionofwhateverythingmeans.Thedefault answerisinthebrackets,andcanbechosenforalmostallthequestions,unlessyoureallywantto changesomething.
#adduser Loginnamefornewuser[]:jellyd
#adduserjellyd
Ineithercase,afterprovidingtheloginname,adduserwillpromptfortheuserID:
UserID('UID')[defaultstonextavailable]:
Allusersareplacedintotheusersgroupbydefault.Youmightwanttoplacethenewuserintoa differentgroup,butitisnotrecommendedunlessyouknowwhatyou'redoing.
Additionalgroups(commaseparated)[]:
fromaUnixbackground,theymaybefamiliarwithadifferentshell.Youcanchangetheirshellnow,or theycanchangeitthemselveslaterusingthechshcommand.
Expirydate(YYYYMMDD)[]:
You'llhavetoenterapasswordforthenewuser.Generally,ifthenewuserisnotphysicallypresentat thispoint,you'lljustpicksomedefaultpasswordandtelltheusertochangeittosomethingmoresecure. ChoosingaPassword:Havingasecurepasswordisthefirstlineofdefenseagainstgetting cracked.Youdonotwanttohaveaneasilyguessedpassword,becausethatmakesiteasierfor someonetobreakintoyoursystem.Ideally,asecurepasswordwouldbearandomstringof characters,includingupperandlowercaseletters,numbers,andrandomcharacters.(Atab charactermightnotbeawisechoice,dependingonwhatkindsofcomputersyou'llbeloggingin from.)Therearemanysoftwarepackagesthatcangeneraterandompasswordsforyousearch theInternetfortheseutilities. Ingeneral,justusecommonsense:don'tpickapasswordthatissomeone'sbirthday,acommon phrase,somethingfoundonyourdesk,oranythingthatiseasilyassociatedwithyou.A passwordlikesecure1oranyotherpasswordyouseeinprintoronlineisalsobad.
Andtoremoveit:
#groupdelcvs
12.1.2ChangingPasswords
Thepasswdprogramchangespasswordsbymodifyingthe/etc/shadowfile.Thisfileholdsallthe passwordsforthesysteminanencryptedformat.Inordertochangeyourownpassword,youwould type:
%passwd Changingpasswordforchris Oldpassword: Enterthenewpassword(minumumof5,maximumof127characters) Pleaseuseacombinationofupperandlowercaselettersandnumbers. Newpassword:
Ifyouareroot,youcanalsochangeanotheruser'spassword:
#passwdted
Thiswillchangedavid'spasswordtosomethingthatcannevermatchanyencryptedvalue.Youwould reenabletheaccountbyusing:
#passwdudavid
12.1.3ChangingUserInformation
Therearetwopiecesofinformationthatuserscanchangeatanytime:theirshellandtheirfinger information.SlackwareLinuxuseschsh(changeshell)andchfn(changefinger)tomodifythesevalues. Ausercanpickanyshellthatislistedinthe/etc/shellsfile.Formostpeople,/bin/bashwilldo justfine.Othersmightbefamiliarwithashellfoundontheirsystematworkorschoolandwanttouse whattheyalreadyknow.Tochangeyourshell,usechsh:
%chsh Password: Changingtheloginshellforchris Enterthenewvalue,orpressreturnforthedefault LoginShell[/bin/bash]:
12.2UsersandGroups,theHardWay
Ofcourse,itispossibletoadd,modify,andremoveusersandgroupswithoutusingthescriptsand programsthatcomewithSlackware.It'snotreallydifficult,althoughafterreadingthisprocess,you'll probablyfinditmucheasiertousethescripts.However,it'simportanttoknowhowyourpassword informationisactuallystored,incaseyoueverneedtorecoverthisinformationanddon'thavethe Slackwaretoolsavailable. First,we'lladdanewusertothe/etc/passwd(5),/etc/shadow(5),and/etc/group(5)files.The passwdfileholdssomeinformationabouttheusersonyoursystem,but(strangelyenough)nottheir passwords.Thiswasoncethecase,butwashaltedlongagoforsecurityreasons.Thepasswdfilemust bereadablebyallusers,butyoudon'twantencryptedpasswordsworldreadable,aswouldbe intruderscanusetheencryptedpasswordsasastartingpointfordecryptingauser'spassword.Instead, theencryptedpasswordsarekeptintheshadowfile,whichisonlyreadablebyroot,andeveryone's passwordisenteredintothepasswdfilesimplyasx.Thegroupfilelistsallthegroupsandwhoisin each. Youcanusethevipwcommandtoeditthe/etc/passwdfilesafely,andthevigrcommandtoedit the/etc/groupfilesafely.Usevipwstoeditthe/etc/shadowfilesafely.(Safelyinthiscontext meanssomeoneelsewon'tbeabletomodifythefileyou'reeditingatthemoment.Ifyou'retheonly administratorofyoursystem,you'reprobablysafe,butit'sbesttogetintogoodhabitsfromthestart.) Let'sexaminethe/etc/passwdfileandlookathowtoaddanewuser.Atypicalentryinpasswd lookslikethis:
chris:x:1000:100:ChrisLumens,Room2,,:/home/chris:/bin/bash
Eachlineisanentryforoneuser,andfieldsoneachlineareseparatedbyacolon.Thefieldsarethe loginname,encryptedpassword(xforeveryoneonaSlackwaresystem,sinceSlackwareuses shadowpasswords),userID,groupID,theoptionalfingerinformation(separatedbycommas),home directory,andshell.Toaddanewuserbyhand,addanewlineattheendofthefile,fillinginthe appropriateinformation. Theinformationyouaddneedstomeetsomerequirements,oryournewusermayhaveproblems loggingin.First,makesurethatthepasswordfieldisanx,andthatboththeusernameanduserIDis unique.Assigntheuseragroup,either100(theusersgroupinSlackware)oryourdefaultgroup(use itsnumber,notitsname).Givetheuseravalidhomedirectory(whichyou'llcreatelater)andshell (remember,validshellsarelistedin/etc/shells). Next,we'llneedtoaddanentryinthe/etc/shadowfile,whichholdstheencryptedpasswords.Atypical entrylookslikethis:
chris:$1$w9bsw/N9$uwLr2bRER6YyBS.CAEp7R.:11055:0:99999:7:::
somecalculationsanddecisionmakingbeforeyoucanfillthosefieldsin.Foranewuser,justputsome randomgarbageinthepasswordfield.Don'tworryaboutwhatthepasswordisrightnow,because you'regoingtochangeitinaminute.Theonlycharacteryoucannotincludeinthepasswordfieldisa colon.Leavethedayssincepasswordwaschangedfieldblankaswell.Fillin0,99999,and7justas youseeintheexampleentry,andleavetheotherfieldsblank. (Forthoseofyouwhothinkyouseemyencryptedpasswordaboveandbelieveyou'vegotalegupon breakingintomysystem,gorightahead.Ifyoucancrackthatpassword,you'llknowthepasswordtoa firewalledtestsystem.Nowthat'suseful:)) AllnormalusersaremembersoftheusersgrouponatypicalSlackwaresystem.However,ifyou wanttocreateanewgroup,oraddthenewusertoadditionalgroups,you'llneedtomodifythe /etc/groupfile.Hereisatypicalentry:
cvs::102:chris,logan,david,root
Thefieldsaregroupname,grouppassword,groupID,andgroupmembers,separatedbycommas. CreatinganewgroupisasimplematterofaddinganewlinewithauniquegroupID,andlistingallthe usersyouwanttobeinthegroup.Anyusersthatareinthisnewgroupandareloggedinwillhavetolog outandlogbackinforthosechangestotakeeffect. Atthispoint,itmightbeagoodideatousethepwckandgrpckcommandstoverifythatthechanges you'vemadeareconsistent.First,usepwckrandgrpckr:therswitchmakesnochanges,but liststhechangesyouwouldbeaskedtomakeifyouranthecommandwithouttheswitch.Youcanuse thisoutputtodecidewhetheryouneedtofurthermodifyanyfiles,torunpwckorgrpckwithoutther switch,ortosimplyleaveyourchangesastheyare. Atthispoint,youshouldusethepasswdcommandtocreateaproperpasswordfortheuser.Then,use mkdirtocreatethenewuser'shomedirectoryinthelocationyouenteredintothe/etc/passwdfile, andusechowntochangetheownerofthenewdirectorytothenewuser. Removingauserisasimplematterofdeletingalloftheentriesthatexistforthatuser.Removetheuser's entryfrom/etc/passwdand/etc/shadow,andremovetheloginnamefromanygroupsinthe /etc/groupfile.Ifyouwish,deletetheuser'shomedirectory,themailspoolfile,andhiscrontabentry (iftheyexist). Removinggroupsissimilar:removethegroup'sentryfrom/etc/group.
12.3ShuttingDownProperly
Itisveryimportantthatyoushutdownyoursystemproperly.Simplyturningthepoweroffwiththe powerswitchcancauseseriousfilesystemdamage.Whilethesystemison,filesareinuseevenifyou aren'tdoinganything.Rememberthattherearemanyprocessesrunninginthebackgroundallthetime. Theseprocessesaremanagingthesystemandkeepalotoffilesopen.Whenthesystem'spoweris switchedoff,thesefilesarenotclosedproperlyandmaybecomecorrupted.Dependingonwhatfiles becomedamaged,thesystemmightberenderedcompletelyunusable!Inanycase,you'llhavetogo throughalongfilesystemcheckprocedureonthenextreboot. Ifyouconfiguredyoursystemwithajournallingfilesystem,likeext3orreiserfs,you'llbepartially
protectedfromfilesystemdamage,andyourfilesystemcheckonrebootwillbeshorterthanif youhadusedafilesystemwithoutjournalling,likeext2.However,thissafetynetisnoexcusefor improperlyshuttingdownyoursystem!AjournallingFSismeanttoprotectyourfilesfrom eventsbeyondyourcontrol,notfromyourownlaziness. Inanycase,whenyouwanttorebootorpowerdownyourcomputer,itisimportanttodosoproperly. Thereareseveralwaysofdoingsoyoucanpickwhicheveroneyouthinkisthemostfun(orleast amountofwork).Sinceashutdownandarebootaresimilarprocedures,mostofthewaysforpowering offthesystemcanalsobeappliedtorebooting. Thefirstmethodisthroughtheshutdown(8)program,anditisprobablythemostpopular.shutdown canbeusedtorebootorturnoffthesystematagiventime,andcandisplayamessagetoallthe loggedinusersofthesystemtellingthemthatthesystemisgoingdown. Themostbasicuseofshutdowntopowerdownthecomputeris:
#shutdownhnow
Alowerlevelwaytorebootorshutdownthesystemistotalkdirectlytoinit.Alltheothermethods aresimplyconvenientwaystotalktoinit,butyoucandirectlytellitwhattodousingtelinit(8)
Runlevel6isrebootmode.Allprocesseswillbekilledoff,thefilesystemswillbeunmounted,andthe machinewillberebooted.Thisisaperfectlyacceptablemethodofrebootingthesystem. Forthecurious,whenswitchingtorunlevel0or6,whetherbyusingshutdown,halt,orreboot,the script/etc/rc.d/rc.6isrun.(Thescript/etc/rc.d/rc.0isanothersymboliclink,to /etc/rc.d/rc.6.)Youcancustomizethisfiletoyourtastesbutbesuretotestyourchanges carefully! Thereisonelastmethodofrebootingthesystem.Alltheothermethodsrequireyoutobeloggedinas root.However,itispossibletorebootthemachineevenifyouaren'troot,providedthatyouhave physicalaccesstothekeyboard.UsingControl+Alt+Delete(the"threefingeredsalute")willcausethe machinetoimmediatelyreboot.(Behindthescenes,theshutdowncommandiscalledforyouwhenyou useControl+Alt+Delete.)Thesalutedoesn'talwaysworkwhenusingXWindowsyoumayneedto useControl+Alt+F1(oranotherFunctionkey)toswitchtoanonXWindowsterminalbeforeusingit. Finally,thefilethatultimatelycontrolseveryaspectofstartupandshutdownisthe/etc/inittab(5) file.Ingeneral,youshouldnotneedtomodifythisfile,butitmaygiveyouinsightintowhysomethings workthewaytheydo.Asalways,seethemanpagesforfurtherdetails.
Chapter13BasicNetworkCommands
Anetworkconsistsofseveralcomputersconnectedtogether.Thenetworkcanbeassimpleasafew computersconnectedinyourhomeoroffice,orascomplicatedasalargeuniversitynetworkoreven theentireInternet.Whenyourcomputerispartofanetwork,youhaveaccesstothosesystemseither directlyorthroughserviceslikemailandtheweb. Thereareavarietyofnetworkingprogramsthatyoucanuse.Somearehandyforperforming diagnosticstoseeifeverythingisworkingproperly.Others(likemailreadersandwebbrowsers)are usefulforgettingyourworkdoneandstayingincontactwithotherpeople.
13.1ping
ping(8)sendsanICMPECHO_REQUESTpackettothespecifiedhost.Ifthehostresponds,youget
Thereare,ofcourse,severaloptionsthatcanbespecified.Checktheping(1)manpageformore information.
13.2traceroute
Slackware'straceroute(8)commandisaveryusefulnetworkdiagnostictool.traceroutedisplays eachhostthatapackettravelsthroughasittriestoreachitsdestination.Youcanseehowmanyhops fromtheSlackwarewebsiteyouarewiththiscommand:
%traceroutewww.slackware.com
Eachhostwillbedisplayed,alongwiththeresponsetimesateachhost.Hereisanexampleoutput:
%traceroutewww.slackware.com traceroutetowww.slackware.com(204.216.27.13),30hopsmax,40bytepackets 1zuul.tdn(192.168.1.1)0.409ms1.032ms0.303ms 2207.171.227.254(207.171.227.254)18.218ms32.873ms32.433ms 3bordersf204.sirius.com(205.134.230.254)15.662ms15.731ms16.142ms 4pbnap.crl.net(198.32.128.20)20.741ms23.672ms21.378ms 5E0CRLSFO03E0X0.US.CRL.NET(165.113.55.3)22.293ms21.532ms21.29ms 6T1CDROM00EX.US.CRL.NET(165.113.118.2)24.544ms42.955ms58.443ms 7www.slackware.com(204.216.27.13)38.115ms53.033ms48.328ms tracerouteissimilartopinginthatitusesICMPpackets.Thereareseveraloptionsthatyoucan specifywithtraceroute.Theseoptionsareexplainedindetailinthemanpage.
13.3DNSTools
DomainNameService(DNSforshort)isthatmagicalprotocolthatallowsyourcomputertoturn meaninglessdomainnameslikewww.slackware.comintomeaningfulIPaddresslike64.57.102.34. Computerscan'troutepacketstowww.slackware.com,buttheycanroutepacketstothatdomain name'sIPaddress.Thisgivesusaconvenientwaytoremembermachines.WithoutDNSwe'dhaveto keepamentaldatabaseofjustwhatIPaddressbelongstowhatcomputer,andthat'sassumingtheIP
addressdoesn'tchange.Clearlyusingnamesforcomputersisbetter,buthowdowemapnamestoIP addresses?
13.3.1host
host(1)candothisforus.hostisusedtomapnamestoIPaddresses.Itisaveryquickandsimple
utilitywithoutalotoffunctions.
%hostwww.slackware.com www.slackware.comisanaliasforslackware.com. slackware.comhasaddress64.57.102.34
Butlet'ssayforsomereasonwewanttomapanIPaddresstoadomainnamewhatthen?
13.3.2nslookup
nslookupisatriedandtrueprogramthathasweatheredtheages.nslookuphasbeendeprecatedand
mayberemovedfromfuturereleases.Thereisnotevenamanpageforthisprogram.
%nslookup64.57.102.34 Note:nslookupisdeprecatedandmayberemovedfromfuturereleases. Considerusingthe`dig'or`host'programsinstead.Runnslookupwith the`sil[ent]'optiontopreventthismessagefromappearing. Server:192.168.1.254 Address:192.168.1.254#53 Nonauthoritativeanswer: www.slackware.comcanonicalname=slackware.com. Name:slackware.com Address:64.57.102.34
13.3.3dig
Themeanestdoginthepound,thedomaininformationgroper,dig(1)forshort,isthegotoprogram forfindingDNSinformation.digcangrabjustaboutanythingfromaDNSserverincludingreverse lookups,A,CNAME,MX,SP,andTXTrecords.dighasmanycommandlineoptionsandifyou're notfamiliarwithityoushouldreadthroughit'sextensivemanpage.
%[email protected] <<>>DiG9.2.2<<>>@192.168.1.254www.slackware.commx globaloptions:printcmd Gotanswer: >>HEADER<<opcode:QUERY,status:NOERROR,id:26362 flags:qrrdraQUERY:1,ANSWER:2,AUTHORITY:2,ADDITIONAL:2 QUESTIONSECTION: www.slackware.com.INMX ANSWERSECTION: www.slackware.com.76634INCNAMEslackware.com. slackware.com.86400INMX1mail.slackware.com.
AUTHORITYSECTION: slackware.com.86400INNSns1.cwo.com. slackware.com.86400INNSns2.cwo.com. ADDITIONALSECTION: ns1.cwo.com.163033INA64.57.100.2 ns2.cwo.com.163033INA64.57.100.3 Querytime:149msec SERVER:192.168.1.254#53(192.168.1.254) WHEN:SatNov616:59:312004 MSGSIZErcvd:159
13.4finger
finger(1)willretrieveinformationaboutthespecifieduser.Yougivefingerausernameoranemail
addressanditwilltrytocontactthenecessaryserverandretrievetheusername,office,telephone number,andotherpiecesofinformation.Hereisanexample:
%[email protected] fingercanreturntheusername,mailstatus,phonenumbers,andfilesreferredtoasdotplanand dotproject.Ofcourse,theinformationreturnedvarieswitheachfingerserver.Theoneincluded
withSlackwarereturnsthefollowinginformationbydefault: Username Roomnumber Homephonenumber Workphonenumber Loginstatus Emailstatus Contentsofthe.planfileintheuser'shomedirectory Contentsofthe.projectfileintheuser'shomedirectory Thefirstfouritemscanbesetwiththechfncommand.Itstoresthosevaluesinthe/etc/passwdfile. Tochangetheinformationinyour.planor.projectfile,justeditthemwithyourfavoritetexteditor. Theymustresideinyourhomedirectoryandmustbecalled.planand.project. Manyusersfingertheirownaccountfromaremotemachinetoquicklyseeiftheyhavenewemail. Or,youcanseeauser'splanorcurrentproject.
Likemanycommands,fingerhasoptions.Checkthemanpageformoreinformationonwhatspecial optionsyoucanuse.
13.5telnet
Someoneoncestatedthattelnet(1)wasthecoolestthinghehadeverseenoncomputers.Theability toremotelyloginanddostuffonanothercomputeriswhatseparatesUnixandUnixlikeoperating systemsfromotheroperatingsystems.
telnetallowsyoutologintoacomputer,justasifyouweresittingattheterminal.Onceyour
13.5.1Theotheruseoftelnet
Nowthatwehaveconvincedyounottousethetelnetprotocolanymoretologintoaremotemachine, we'llshowyouacoupleofusefulwaystousetelnet. Youcanalsousethetelnetcommandtoconnecttoahostonacertainport.
%telnet<hostname>[port]
Trying69.50.233.153... Connectedtostore.slackware.com. Escapecharacteris'^]'. HEAD/HTTP/1.0 HTTP/1.1200OK Date:Mon,25Apr200520:47:01GMT Server:Apache/1.3.33(Unix)mod_ssl/2.8.22OpenSSL/0.9.7d LastModified:Fri,18Apr200310:58:54GMT ETag:"193424c03e9fda6e" AcceptRanges:bytes ContentLength:192 Connection:close ContentType:text/html Connectionclosedbyforeignhost. %
Youcandothesameforotherplaintextprotocols,aslongasyouknowwhatporttoconnectto,and whatthecommandsare.
13.6TheSecureshell
Today,secureshellbasksintheadorationthattelnetonceenjoyed.ssh(1)allowsonetomakea connectiontoaremotemachineandexecuteprogramsasifonewerephysicallypresenthowever,ssh encryptsallthedatatravellingbetweenthetwocomputerssoevenifothersintercepttheconversation, theyareunabletounderstandit.Atypicalsecureshellconnectionfollows.
%sshcarrier.lizella.netlalan Theauthenticityofhost'carrier.lizella.net(192.168.1.253)'can'tbe established. RSAkeyfingerprintis0b:e2:5d:43:4c:39:4f:8c:b9:85:db:b2:fa:25:e9:9d. Areyousureyouwanttocontinueconnecting(yes/no)?yes Warning:Permanentlyadded'carrier.lizella.net'(RSA)tothelistof knownhosts. Password:password Lastlogin:SatNov616:32:192004from192.168.1.102 Linux2.4.26smp. alan@carrier:~$lslMANIFEST rwrr1alanusers235452762004102820:04MANIFEST alan@carrier:~$exit logout Connectiontocarrier.lizella.netclosed.
Thereyouseememakingansshconnectiontocarrier.lizella.net,andcheckingthepermissions ontheMANIFESTfile.
13.7email
ElectronicmailisoneofthemostpopularthingsonecandoontheInternet.In1998,itwasreported thatmoreelectronicmailwassentthanregularmail.Itisindeedcommonanduseful. UnderSlackware,weprovideastandardmailserver,andseveralmailclients.Alloftheclients discussedbelowaretextbased.AlotofWindowsusersmaybeagainstthis,butyouwillfindthatatext
basedclientisveryconvenient,especiallywhencheckingmailremotely.Fearnot,therearemany graphicalemailclientssuchasKDE'sKmail.Ifyouwishtouseoneofthosecheckitshelpmenu.
13.7.1pine
pine(1)isnotelm.Orsothesayinggoes.TheUniversityofWashingtoncreatedtheirprogramfor Internetnewsandemailoutofaneedforaneasymailreaderfortheirstudents.pineisoneofthemost
popularemailclientsinusetodayandisavailablefornearlyeveryflavorofUnixandevenWindows. Figure132.ThePinemainmenu
Youwillseeamenuofcommandsandarowofcommandkeysatthebottom.pineisindeeda complexprogram,sowewillnotdiscusseveryfeatureaboutithere. Toseewhat'sinyourinbox,typei.Yourmessagesarelistedwiththeirdate,author,andsubject. Highlightthemessageyouwantandpressentertoviewit.Pressingrwillstartareplytothemessage. Onceyouhavewrittentheresponse,typeCtrl+Xtosendit.Youcanpressitogetbacktothe messagelisting. Ifyouwanttodeleteamessage,pressd.Itwillmarkthehighlightedmessagefordeletion.pinedeletes themailwhenyouexittheprogram.pinealsoletsyoustoreyourmailinfolders.Youcangetalisting offoldersbypressingl.Atthemessagelisting,pressstosaveittoanotherfolder.Itwillaskforthe foldernametowritethemessageto.
pineoffersmany,manyfeaturesyoushoulddefinitelyhavealookatthemanpageformore
information.Itwillcontainthelatestinformationabouttheprogram.
13.7.2elm
elm(1)isanotherpopulartextbasedemailclient.Thoughnotquiteasuserfriendlyaspine,it's
definitelybeenaroundalotlonger. Figure133.Elmmainscreen
13.7.3mutt
Allmailclientssuck.Thisonejustsucksless.mutt'soriginalinterfacewasbasedonelmwithadded featuresfoundinotherpopularmailclients,resultinginahybridmutt. Someofmutt'sfeaturesinclude: colorsupport messagethreading MIMEandPGP/MIMEsupport pop3andimapsupport
13.7.4nail
nail(1)isacommandlinedrivenmailclient.Itisveryprimitiveandoffersprettymuchnothinginthe
oryoucanjusttypetextandhitCtrl+Dwhenfinishedwiththemessage. Hereisanexampleofmailingaprogramsourcefiletoanotherperson.
%catrandomfunc.c|mails"Here'sthatfunction"[email protected]
Themanpageexplainsmoreofwhatnailcando,soyouwillprobablywanttohavealookatthat beforeusingit.
13.8Browsers
ThefirstthingthatpeoplethinkaboutwhentheyhearthewordInternetissurfingthenet.Orlooking atwebsitesusingawebbrowser.ThisisprobablybyfarthemostpopularuseoftheInternetforthe averageuser. SlackwareprovidespopulargraphicalwebbrowsersintheXAPseries,aswellastextmode browsersintheNseries.We'lltakeaquicklookatsomeofthemostcommonoptionsbelow.
13.8.1lynx
lynx(1)isatextbasedwebbrowser.ItisaveryquickwayoflookingupsomethingontheInternet.
Sometimesgraphicsjustgetinthewayifyouknowexactlywhatyou'reafter. Tostartlynx,justtypelynxattheprompt:
%lynx
Figure135.Lynxdefaultstartpage
Youmaywanttospecifyasiteforlynxtoopento:
%lynxhttp://www.slackware.com lynxprintsthecommandkeysandwhattheydoatthebottomofthescreen.Theupanddownarrow keysmovearoundthedocument,Enterselectsthehighlightedlink,andtheleftarrowgoesbackto thepreviouspage.Typingdwilldownloadthecurrentlyselectedfile.ThegcommandbringsuptheGo prompt,whereyoucangivelynxaURLtoopen.
Therearemanyothercommandsinlynx.Youcaneitherconsultthemanpage,ortypehtogetthe helpscreenformoreinformation.
13.8.2links
Justlikelynx,linksisatextmodewebbrowser,whereyoudoallthenavigationusingthekeyboard. However,whenyoupresstheEsckey,itwillactivateaveryconvenientpulldownmenuonthetopof thescreen.Thismakesitveryeasytouse,withouthavingtolearnallthekeyboardshortcuts.People whodonotuseatextbrowsereverydaywillappreciatethisfeature.
linksseemstohavebettersupportforbothframesandtables,whencomparedtolynx.
Figure136.Links,withthefilemenuopen
13.8.3wget
wget(1)isacommandlineutilitythatwilldownloadfilesfromaspecifiedURL.Whilenotanactual webbrowser,wgetisusedprimarilytograbwholeorpartialwebsitesforofflineviewing,orforfast
downloadofsinglefilesfromHTTPorFTPserversinstead.Thebasicsyntaxis:
%wget<url>
Youcanalsopassoptions.Forexample,thiswilldownloadtheSlackwarewebsite:
%wgetrecursivehttp://www.slackware.com wgetwillcreateawww.slackware.comdirectoryandstorethefilesinthere,justasthesitedoes. wgetcanalsodownloadfilesfromFTPsitesjustspecifyanFTPURLinsteadofanHTTPone.
%wgetftp://ftp.gnu.org/gnu/wget/wget1.8.2.tar.gz 12:18:16ftp://ftp.gnu.org/gnu/wget/wget1.8.2.tar.gz =>`wget1.8.2.tar.gz' Resolvingftp.gnu.org...done. Connectingtoftp.gnu.org[199.232.41.7]:21...connected. Logginginasanonymous...Loggedin! ==>SYST...done.==>PWD...done. ==>TYPEI...done.==>CWD/gnu/wget...done. ==>PORT...done.==>RETRwget1.8.2.tar.gz...done. Length:1,154,648(unauthoritative) 100%[==================================>]1,154,648209.55K/sETA00:00 12:18:23(209.55KB/s)`wget1.8.2.tar.gz'saved[1154648]
wgethasmanymoreoptions,whichmakeitniceforsitespecificscripts(websitemirroringandso
forth).Themanpageshouldbeconsultedformoreinformation.
13.9FTPClients
FTPstandsfortheFileTransferProtocol.Itallowsyoutosendandreceivefilesbetweentwo computers.ThereistheFTPserverandtheFTPclient.Wediscusstheclientinthissection. Forthecurious,theclientisyou.TheserveristhecomputerthatanswersyourFTPrequestandlets youlogin.Youwilldownloadfilesfromanduploadfilestotheserver.TheclientcannotacceptFTP connections,itcanonlyconnecttoservers.
13.9.1ftp
ToconnecttoanFTPserver,simplyruntheftp(1)commandandspecifythehost:
%ftp<hostname>[port]
IfthehostisrunninganFTPserver,itwillaskforausernameandpassword.Youcanloginasyourself orasanonymous.AnonymousFTPsitesareverypopularforsoftwarearchives.Forexample,toget
Purpose
13.9.2ncftp
ncftp(1)(pronounced"NikFTP")isanalternativetothetraditionalftpclientthatcomeswith Slackware.Itisstillatextbasedprogram,butoffersmanyadvantagesoverftp,including:
13.10TalkingtoOtherPeople
13.10.1wall
wall(1)isaquickwaytowriteamessagetotheusersonasystem.Thebasicsyntaxis:
%wall[file]
seriousmaintenancetothesystem,orevenrebootit,sotheyhavetimetosavetheirworkandlogoff:)
13.10.2talk
talk(1)allowstwouserstochat.Itsplitsthescreeninhalf,horizontally.Torequestachatwithanother
user,usethiscommand:
%talk<person>[ttyname]
Figure137.Twousersinatalksession
willtrytocontactthatremoteuseronthathost.
talkissomewhatlimited.Itonlysupportstwousersandishalfduplex.
13.10.3ytalk
ytalk(1)isabackwardscompatiblereplacementfortalk.ItcomeswithSlackwareastheytalk
command.Thesyntaxissimilar,buthasafewdifferences:
%ytalk<username>[#ttyname]
Figure138.Twousersinaytalksession
Chapter14Security
Securityonanysystemisimportantitcanpreventpeoplelaunchingattacksfromyourmachine,aswell asprotectsensitivedata.ThischapterisallabouthowtostartsecuringyourSlackwareboxagainst scriptkiddies,crackersandroguehamstersalike.Bearinmindthatthisisonlythestartofsecuringa systemsecurityisaprocess,notastate.
14.1DisablingServices
ThefirststepafterinstallingSlackwareshouldbetodisableanyservicesyoudon'tneed.Anyservices couldpotentiallyposeasecurityrisk,soitisimportanttorunasfewservicesaspossible(i.e.onlythose
thatareneeded).Servicesarestartedfromtwomainplacesinetdandinitscripts.
14.1.1Servicesstartedfrominetd
AlotofthedaemonsthatcomewithSlackwarearerunfrominetd(8).inetdisadaemonthatlistens onalloftheportsusedbyservicesconfiguredtobestartedbyitandspawnsaninstanceoftherelevant daemonwhenaconnectionattemptismade.Daemonsstartedfrominetdcanbedisabledby commentingouttherelevantlinesin/etc/inetd.conf.Todothis,openthisfileinyourfavoriteeditor (e.g.vi)andyoushouldseelinessimilartothis:
telnetstreamtcpnowaitroot/usr/sbin/tcpdin.telnetd
Youcandisablethisservice,andanyothersyoudon'tneed,bycommentingthemout(i.e.addinga# (hash)symboltothebeginningoftheline).Theabovelinewouldthenbecome:
#telnetstreamtcpnowaitroot/usr/sbin/tcpdin.telnetd
Afterinetdhasbeenrestarted,thisservicewillbedisabled.Youcanrestartinetdwiththecommand:
#killHUP$(cat/var/run/inetd.pid)
14.1.2Servicesstartedfrominitscripts
Therestoftheservicesstartedwhenthemachinestartsarestartedfromtheinitscriptsin/etc/rc.d/. Thesecanbedisabledintwodifferentways,thefirstbeingtoremovetheexecutepermissionsonthe relevantinitscriptandthesecondbeingtocommentouttherelevantlinesintheinitscripts. Forexample,SSHisstartedbyitsowninitscriptat/etc/rc.d/rc.sshd.Youcandisablethisusing:
#chmodx/etc/rc.d/rc.sshd
Thiscanbedisabledbyadding#symbolstothebeginningsofthelinesthatdon'talreadystartwith them,likeso:
14.2HostAccessControl
14.2.1iptables
iptablesisthepacketfilteringconfigurationprogramforLinux2.4andabove.The2.4kernel(2.4.5,
Wheneverythingisdenied,youcanstartallowingthings.Thefirstthingtoallowisanytrafficfor sessionswhicharealreadyestablished:
#iptablesAINPUTmstatestateESTABLISHED,RELATEDjACCEPT
Soasnottobreakanyapplicationsthatcommunicateusingtheloopbackaddress,itisusuallywiseto addarulelikethis:
#iptablesAINPUTs127.0.0.0/8d127.0.0.0/8ilojACCEPT
Thenextthingtodowouldbetoallowaccesstospecificservicesrunningonyourmachine.If,for example,youwantedtorunawebserveronyourmachine,youwouldusearulesimilartothis:
#iptablesAINPUTptcpdport80ippp0jACCEPT
AllowingICMPtrafficcanbeusefulfordiagnosticpurposes.Todothis,youwouldusearulelikethis:
#iptablesAINPUTpicmpjACCEPT
YouwillalsoneedtoenableIPforwarding.Youcandothistemporarily,usingthefollowingcommand:
#echo1>/proc/sys/net/ipv4/ip_forward
ToenableIPforwardingonamorepermanentbasis(i.e.sothatthechangeiskeptafterareboot),you willneedtoopenthefile/etc/rc.d/rc.inet2inyourfavoriteeditorandchangethefollowingline:
IPV4_FORWARD=0
...tothis:
IPV4_FORWARD=1
FormoreinformationonNAT,seetheNATHOWTO.
14.2.2tcpwrappers
tcpwrapperscontrolsaccesstodaemonsattheapplicationlevel,ratherthanattheIPlevel.Thiscan
ToallowaccesstoSSHdfrom192.168.0.0/24,youcoulduseeitherofthefollowingrules:
sshd:192.168.0.0/24 sshd:192.168.0.
14.3KeepingCurrent
14.3.1slackwaresecuritymailinglist
WheneverasecurityproblemaffectsSlackware,anemailissenttoallsubscriberstotheslackware security@slackware.commailinglist.ReportsaresentoutforvulnerabilitiesofanypartofSlackware, apartfromthesoftwarein/extraor/pasture.Thesesecurityannouncementemailsincludedetailson obtainingupdatedversionsofSlackwarepackagesorworkarounds,ifany. SubscribingtoSlackwaremailinglistsiscoveredinSection2.2.2.
14.3.2The/patchesdirectory
WheneverupdatedpackagesarereleasedforaversionofSlackware(usuallyonlytofixasecurity problem,inthecaseofalreadyreleasedSlackwareversions),theyareplacedinthe/patches directory.Thefullpathtothesepatcheswilldependonthemirroryouareusing,butwilltaketheform /path/to/slackwarex.x/patches/. Beforeinstallingthesepackages,itisagoodideatoverifythemd5sumofthepackage.md5sum(1)isa commandlineutilitythatcreatesauniquemathematicalhashofthefile.Ifasinglebitofthefilehas
beenchanged,itwillgenerateadifferentmd5sumvalue.
%md5sumpackage<ver><arch><rev>.tgz 6341417aa1c025448b53073a1f1d287dpackage<ver><arch><rev>.tgz
Asyoucansee,anyfilesthatmd5sumevaluatesascorrectarelistedOKwhilefilesthatfailare labelledFAILED.(Yes,thiswasaninsulttoyourintelligence.Whydoyouputupwithme?)
Chapter15ArchiveFiles
15.1gzip
gzip(1)istheGNUcompressionprogram.Ittakesasinglefileandcompressesit.Thebasicusageis
asfollows:
%gzipfilename
following:.gz,gz,.z,z,.Z,orZ.Thefirstmethodistocallgunzip(1)onafile,likeso:
%gunzipfilename.gz
15.2bzip2
bzip2(1)isanalternativecompressionprograminstalledonSlackwareLinux.Itusesadifferent compressionalgorithmfromgzip,whichresultsinsomeadvantagesandsomedisadvantages.Themain advantageforbzip2isthecompressedfilesize.bzip2willalmostalwayscompressbetterthangzip.
Insomeinstances,thiscanresultindramaticallysmallerfiles.Thiscanbeagreatadvantageforpeople onslowermodemconnections.Alsoremember,whendownloadingsoftwarefromapublicftpserver, it'sgenerallygoodnetiquettetodownloadthe.bz2filesinsteadofthe.gzfiles,asthisresultsinless overheadforthegenerouspeoplehostingtheserver. Thedisadvantagetobzip2isthatitismoreCPUintensivethangzip.Thismeansthatbzippingafile willgenerallytakelongerandwillusemoreoftheCPUthangzippingthefilewould.Whenconsidering whichcompressionprogramtouse,youmustweighthisspeedvs.compressedsizeanddetermine whichismoreimportant. Theusageofbzip2isnearlyidenticaltogzip,sonotmuchtimewillbespentdiscussingit.Like gunzip,bunzip2isidenticaltobzip2d.Theprimarydifferenceinpracticalusageisthatbzip2 usesthe.bz2extension.
%bzip2filename %bunzip2filename.bz2 %bzip29filename
15.3tar
tar(1)istheGNUtapearchiver.Ittakesseveralfilesordirectoriesandcreatesonelargefile.This allowsyoutocompressanentiredirectorytree,whichisimpossiblebyjustusinggziporbzip2.tar
hasmanycommandlineoptions,whichareexplainedinitsmanpage.Thissectionwilljustcoverthe mostcommonusesoftar. Themostcommonusefortaristodecompressandunarchiveapackagethatyou'vedownloadedfrom awebsiteorftpsite.Mostfileswillcomewitha.tar.gzextension.Thisiscommonlyknownasa tarball.Itmeansthatseveralfileswerearchivedusingtarandthencompressedusinggzip.You mightalsoseethislistedasa.tar.Zfile.Itmeansthesamething,butthisisusuallyencounteredon olderUnixsystems. Alternatively,youmightfinda.tar.bz2filesomewhere.Kernelsourceisdistributedassuchbecause itisasmallerdownload.Asyoumighthaveguessed,thisisseveralfilesarchivedwithtarandthen bzipped.
Youmightalsoencounterabzippedarchive.TheversionoftarthatcomeswithSlackwareLinuxcan handlethesethesameasgzippedarchives.Insteadofthezcommandlineoption,you'dusej:
%tarxvjffilename.tar.bz2
15.4zip
Finally,therearetwoutilitiesthatcanbeusedonzipfiles.TheseareverycommonintheWindows world,soLinuxhasprogramstodealwiththem.Thecompressionprogramiscalledzip(1),andthe decompressionprogramiscalledunzip(1).
%zipfoo*
Decompressingfilesiseasy,aswell.
%unzipfoo.zip
Chapter16Vi
vi(1)isthestandardUnixtexteditingprogram,andwhilemasteringitisnotasessentialasitoncewas, isstillaveryrewardinggoal.Thereareseveralversions(orclones)ofviavailable,includingvi,elvis, vile,andvim.OneoftheseisavailableonjustaboutanyversionofUnix,aswellasonLinux.Allof
16.1Startingvi
vicanbestartedfromthecommandlineinavarietyofways.Thesimplestformisjust:
%vi
Figure161.Avisession.
viwilldisplaythegivenfileandwillplacethecursoratthespecifiedline.Inthecasewhereyouspecify alinethatisaftertheendofthefile,viwillplacethecursoronthelastline.Thisisespeciallyhelpfulfor
programmers,astheycanjumpstraighttothelocationinthefilethatanerroroccurred,withouthaving tosearchforit.
16.2Modes
vioperatesinvariousmodes,whichareusedtoaccomplishvarioustasks.Whenyoufirststartvi,you
16.2.1CommandMode
Youarefirstplacedintocommandmode.Fromthismode,youcannotdirectlyentertextoreditwhatis alreadythere.However,youcanmanipulatethetext,search,quit,save,loadnewfiles,andmore.This isintendedonlytobeanintroductiontothecommandmode.Foradescriptionofthevarious commands,seeSection16.7. Probablythemostoftenusedcommandincommandmodeischangingtoinsertmode.Thisis accomplishedbyhittingtheikey.Thecursorchangesshapes,andINSERTisdisplayedatthe bottomofthescreen(notethatthisdoesnothappeninallclonesofvi).Fromthere,allyourkeystrokes areenteredintothecurrentbufferandaredisplayedtothescreen.Togetbackintocommandmode,hit theESCAPEkey. Commandmodeisalsowhereyoumovearoundinthefile.Onsomesystems,youcanusethearrow keystomovearound.Onothersystems,youmayneedtousethemoretraditionalkeysofhjkl.Here isasimplelistingofhowthesekeysareusedtomovearound: h j k l moveleftonecharacter movedownonecharacter moveuponecharacter moverightonecharacter
Simplypressakeytomove.Asyouwillseelater,thesekeyscanbecombinedwithanumbertomove muchmoreefficiently. Manyofthecommandsthatyouwilluseincommandmodebeginwithacolon.Forexample,quittingis :q,asdiscussedearlier.Thecolonsimplyindicatesthatitisacommand,whiletheqtellsvitoquit. Othercommandsareanoptionalnumber,followedbyaletter.Thesecommandsdonothaveacolon beforethem,andaregenerallyusedtomanipulatethetext. Forexample,deletingonelinefromafileisaccomplishedbyhittingdd.Thiswillremovethelinethatthe cursorison.Issuingthecommand4ddwouldtellvitoremovethelinethatthecursorisonandthe threeafterthat.Ingeneral,thenumbertellsvihowmanytimestoperformthecommand. Youcancombineanumberwiththemovementkeystomovearoundseveralcharactersatatime.For example,10kwouldmoveuptenlinesonthescreen. Commandmodecanalsobeusedtocutandpaste,inserttext,andreadotherfilesintothecurrent
buffer.Copyingtextisaccomplishedwiththeykey(ystandsforyank).Copyingthecurrentlineisdone bytypingyy,andthiscanbeprefixedwithanumbertoyankmorelines.Then,movetothelocationfor thecopyandhitp.Thetextispastedonthelineafterthecurrentone. Cuttingtextisdonebytypingdd,andpcanbeusedtopastethecuttextbackintothefile.Readingin textfromanotherfileisasimpleprocedure.Justtype:r,followedbyaspaceandthefilenamethat containsthetexttobeinserted.Thefile'scontentswillbepastedintothecurrentbufferonthelineafter thecursor.Moresophisticatedviclonesevencontainfilenamecompletionsimilartotheshell's. Thefinalusethatwillbecoveredissearching.Commandmodeallowsforsimplesearching,aswellas complicatedsearchandreplacecommandsthatmakeuseofapowerfulversionofregularexpressions. Acompletediscussionofregularexpressionsisbeyondthescopeofthischapter,sothissectionwill onlycoversimplemeansofsearching. Asimplesearchisaccomplishedbyhittingthe/key,followedbythetextthatyouaresearchingfor.vi willsearchforwardfromthecursortotheendofthefileforamatch,stoppingwhenitfindsone.Note thatinexactmatcheswillcausevitostopaswell.Forexample,asearchforthewillcausevitostop onthen,therefore,andsoon.Thisisbecauseallofthosewordsdomatchthe. Aftervihasfoundthefirstmatch,youcancontinueontothenextmatchsimplybyhittingthe/key followedbyenter.Youcanalsosearchbackwardsthroughthefilebyreplacingtheslashwiththe?key. Forexample,searchingbackwardsthroughthefileforthewouldbeaccomplishedbytyping?the.
16.2.2InsertMode
Insertingandreplacingtextisaccomplishedininsertmode.Aspreviouslydiscussed,youcangetinto insertmodebyhittingifromcommandmode.Then,alltextthatyoutypeisenteredintothecurrent buffer.HittingtheESCAPEkeytakesyoubackintocommandmode. Replacingtextisaccomplishedinseveralways.Fromcommandmode,hittingrwillallowyoutoreplace theonecharacterunderneaththecursor.Justtypethenewcharacteranditwillreplacetheoneunder thecursor.Youwillthenbeimmediatelyplacedbackintocommandmode.HittingRallowsyouto replaceasmanycharactersasyou'dlike.Togetoutofthisreplacementmode,justhitESCAPEtogo backintocommandmode. Thereisyetanotherwaytotogglebetweeninsertionandreplacement.HittingtheINSERTkeyfrom commandmodewilltakeyouintoinsertmode.Onceyouareininsertmode,thekeyboard'sINSERT keyservesasatogglebetweeninsertandreplace.Hittingitoncewillallowyoutoreplace.Hittingit oncemorewillonceagainallowyoutoinserttext.
16.3OpeningFiles
viallowsyoutoopenfilesfromcommandmodeaswellasspecifyingafileonthecommandlineto open.Toopenthefile/etc/lilo.conf:
:e/etc/lilo.conf
Ifyouhavemadechangestothecurrentbufferwithoutsaving,viwillcomplain.Youcanstillopenthe filewithoutsavingthecurrentbufferbytyping:e!,followedbyaspaceandthefilename.Ingeneral,vi's
16.4SavingFiles
Thereareseveralwaystosavefilesinvi.Ifyouwanttosavethecurrentbuffertothefilerandomness, youwouldtype:
:wrandomness
16.5Quittingvi
Onewaytoquitviisthrough:wq,whichwillsavethecurrentbufferbeforequitting.Youcanalsoquit withoutsavingwith:qor(morecommonly):q!.Thelatterisusedwhenyou'vemodifiedthefilebutdo notwishtosaveanychangestoit. Onoccasion,yourmachinemightcrashorvimightcrash.However,bothelvisandvimwilltake stepstominimizethedamagetoanyopenbuffers.Botheditorssavetheopenbufferstoatemporaryfile
16.6viConfiguration
Yourvicloneofchoicecanbeconfiguredinseveralways. Avarietyofcommandscanbeenteredwhileincommandmodetosetupvijusthowyoulikeit. Dependingonyoureditor,youcanenablefeaturestomakeprogrammingeasier(likesyntaxhilighting, autoindenting,andmore),setupmacrostoautomaketasks,enabletextualsubstitutions,andmore. Almostallofthesecommandscanbeputintoaconfigurationfileinyourhomedirectory.elvisexpects a.exrcfile,whilevimexpectsa.vimrcfile.Mostofthesetupcommandsthatcanbeenteredin commandmodecanbeplacedintheconfigurationfile.Thisincludessetupinformation,textual substitutions,macros,andmore. Discussingalltheseoptionsandthedifferencesbetweentheeditorsisquiteaninvolvedsubject.For moreinformation,checkoutthemanpageorwebsiteforyourpreferredvieditor.Someeditors(like vim)haveextensivehelpwithintheeditorthatcanbeaccessedwiththe:helpcommand,orsomething similar.YoucanalsocheckouttheO'ReillybookLearningtheviEditorbyLambandRobbins. ManycommonprogramsinLinuxwillloadupatextfileinvibydefault.Forexample,editingyour crontabswillstartupvibydefault.Ifyoudonotlikeviandwouldlikeanothereditortobestarted instead,allyouneedtodoissettheVISUALenvironmentvariabletotheeditoryouprefer.For informationonsettingenvironmentvariables,seethesectioncalledEnvironmentVariablesinChapter8. Ifyouwanttomakesurethatyoureditorwillbethedefaulteverytimeyoulogin,addtheVISUAL settingtoyour.bash_profileor.bashrcfiles.
16.7ViKeys
Thissectionisaquickreferenceofmanycommonvicommands.Someofthesewerediscussedearlier inthechapter,whilemanywillbenew. Table161.Movement Operation Key
Table162.Editing Operation Removingaline Removingfivelines Replacingacharacter Removingacharacter Removingtencharacters Key dd 5dd r x 10x
Searchforasdf /asdf Searchbackwardsforasdf ?asdf Repeatlastsearchforwards / Repeatlastsearchbackwards ? Repeatlastsearch,samedirection n Repeatlastsearch,oppositedirection N Table164.SavingandQuitting Operation Key
Quit :q Quitwithoutsaving :q! Writeandquit :wq Write,withoutquitting :w Reloadcurrentlyopenfile :e! Writebuffertofileasdf :wasdf Openfilehejaz :ehejaz Readfileasdfintobuffer :rasdf Readoutputoflsintobuffer :r!ls
Chapter17Emacs
Whilevi(withitsclones)iswithoutadoubtthemostubiquitouseditoronUnixlikesystems,Emacs comesinagoodsecond.Insteadofusingdifferentmodes,likevidoes,itusesControlandAltkey combinationstoentercommands,inmuchthesamewaythatyoucanuseControlandAltkey combinationsinawordprocessorandindeedinmanyotherapplicationstoexecutecertainfunctions. (Thoughitshouldbenotedthatthecommandsrarelycorrespondsowhilemanymodernapplications useCtrlC/X/Vforcopying,cuttingandpasting,Emacsusesdifferentkeysandactuallyasomewhat differentmechanismforthis.)
Alsounlikevi,whichisan(excellent)editorandnothingmore,Emacsisaprogramwithnearendless capabilities.Emacsis(forthemostpart)writteninLisp,whichisaverypowerfulprogramminglanguage thathasthepeculiarpropertythateveryprogramwritteninitisautomaticallyaLispcompilerofitsown. ThismeansthattheusercanextendEmacs,andinfactwritecompletelynewprogramsinEmacs. Asaresult,Emacsisnotjustaneditoranymore.TherearemanyaddonpackagesforEmacsavailable (manycomewiththeprogram'ssource)thatprovideallsortsoffunctionality.Manyofthesearerelated totextediting,whichisafterallEmacs'basictask,butitdoesn'tstopthere.Thereareforexample severalspreadsheetprogramsforEmacs,therearedatabases,games,mailandnewsclients(thetop onebeingGnus),etc. TherearetwomainversionsofEmacs:GNUEmacs(whichistheversionthatcomeswithSlackware) andXEmacs.ThelatterisnotaversionforEmacsrunningunderX.Infact,bothEmacsandXEmacs runontheconsoleaswellasunderX.XEmacswasoncestartedasaprojecttotidyuptheEmacs code.Currently,bothversionsarebeingactivelydeveloped,andthereisinfactmuchinteraction betweenthetwodevelopmentteams.Forthepresentchapter,itisimmaterialwhetheryouuseEmacs orXEmacs,thedifferencesbetweenthemarenotrelevanttothenormaluser.
17.1Startingemacs
Emacscanbestartedfromtheshellbysimplytypingemacs.WhenyouarerunningX,Emacswill (normally)comeupwithitsownXwindow,usuallywithamenubaratthetop,whereyoucanfindthe mostimportantfunctions.Onstartup,Emacswillfirstshowawelcomemessage,andthenafterafew secondswilldropyouinthe*scratch*buffer.(SeeSection17.2.)
YoucanalsostartEmacsonanexistingfilebytyping
%emacs/etc/resolv.conf
ThiswillcauseEmacstoloadthespecifiedfilewhenitstartsup,skippingthewelcomemessage.
17.1.1CommandKeys
Asmentionedabove,EmacsusesControlandAltcombinationsforcommands.Theusualconvention istowritethesewithCletterandMletter,respectively.SoCxmeansControl+x,andMxmeans Alt+x.(TheletterMisusedinsteadofAbecauseoriginallythekeywasnottheAltkeybuttheMeta key.TheMetakeyhasallbutdisappearedfromcomputerkeyboards,andinEmacstheAltkeyhas takenoveritsfunction.) ManyEmacscommandsconsistofsequencesofkeysandkeycombinations.Forexample,CxCc (thatisControlxfollowedbyControlc)quitsEmacs,CxCssavesthecurrentfile.Keepinmind thatCxCbisnotthesameasCxb.TheformermeansControlxfollowedbyControlb,whilethe lattermeansControlxfollowedbyjust'b'.
17.2Buffers
InEmacs,theconceptofbuffersisessential.Everyfilethatyouopenisloadedintoitsownbuffer. Furthermore,Emacshasseveralspecialbuffers,whichdonotcontainafilebutareusedforotherthings. Suchspecialbuffersusuallyhaveanamethatstartsandendswithanasterisk.Forexample,thebuffer thatEmacsshowswhenitisfirststarted,isthesocalled*scratch*buffer.Inthe*scratch*buffer,you cantypetextinthenormalway,buttextthatistypedthereisnotsavedwhenEmacsisclosed. Thereisoneotherspecialbufferyouneedtoknowabout,andthatistheminibuffer.Thisbufferconsists ofonlyoneline,andisalwaysonthescreen:itistheverylastlineoftheEmacswindow,belowthe statusbarforthecurrentbuffer.TheminibufferiswhereEmacsshowsmessagesfortheuser,anditis alsotheplacewherecommandsthatrequiresomeuserinputareexecuted.Forexample,whenyou openafile,Emacswillaskforitsnameintheminibuffer. SwitchingfromonebuffertoanothercanbedonewiththecommandCxb.Thiswillpromptyoufor thenameofabuffer(abuffer'snameisusuallythenameofthefileyouareeditinginit),anditgivesa defaultchoice,whichisnormallythebufferthatyouwereinbeforeyouswitchedtoorcreatedthe currentbuffer.JusthittingEnterwillswitchtothatdefaultbuffer. IfyouwanttoswitchtoanotherbufferthanthedefaultofferedbyEmacs,justtypeitsname.Notethat youcanusesocalledTabcompletionhere:typethefirstfewlettersofthebuffer'snameandhitTab Emacswillthencompletethenameofthebuffer.TabcompletionworkseverywhereinEmacswhereit makessense. YoucangetalistofopenbuffersbyhittingCxCb.Thiscommandwillusuallysplitthescreenintwo, displayingthebufferyouwereworkingininthetophalf,andanewbuffercalled*BufferList*inthe bottomhalf.Thisbuffercontainsalistofallthebuffers,theirsizesandmodes,andthefiles,ifany,that thosebuffersarevisiting(asitiscalledinEmacs).YoucangetridofthissplitscreenbytypingCx1. UnderX,thelistofbuffersisalsoavailableintheBuffermenuinthemenubar.
17.3Modes
EverybufferinEmacshasanassociatedmode.Thismodeisverydifferentfromtheideaofmodesin vi:amodetellsyouwhatkindofbufferyouarein.Forexample,thereistextmodefornormaltext files,buttherearealsomodessuchascmodeforeditingCprograms,shmodeforeditingshellscripts, latexmodeforeditingLaTeXfiles,mailmodeforeditingemailandnewsmessages,etc.Amode providesspecialcustomizationsandfunctionalitythatisusefulforthekindoffileyouareediting.Itis evenpossibleforamodetoredefinekeysandkeycommands.Forexample,inTextmode,theTabkey simplyjumpstothenexttabstop,butinmanyprogramminglanguagemodes,theTabkeyindentsthe currentlineaccordingtothedepthoftheblockthatlineisin. Themodesmentionedabovearecalledmajormodes.Eachbufferhasexactlyonemajormode. Additionally,abuffercanhaveoneormoreminormodes.Aminormodeprovidesadditionalfeatures thatmaybeusefulforcertaineditingtasks.Forexample,ifyouhittheINSERTkey,youinvoke overwritemode,whichdoeswhatyou'dexpect.Thereisalsoanautofillmode,whichishandyin combinationwithtextmodeorlatexmode:itcauseseachlinethatyoutypetobeautomatically wrappedoncethelinereachesacertainnumberofcharacters.Withoutautofillmode,youhavetotype Mqtofilloutaparagraph.(Whichyoucanalsousetoreformataparagraphafteryou'veeditedsome textinitanditisnolongernicelyfilledout.)
17.3.1Openingfiles
ToopenafileinEmacs,type
CxCf
Emacswillaskyouforthenameofthefile,fillinginsomedefaultpathforyou(whichisusually~/). Afteryoutypethefilename(youcanuseTabcompletion)andhitENTER,Emacswillopenthefilein anewbufferanddisplaythatbufferonthescreen. Emacswillautomaticallycreateanewbuffer,itwillnotloadthefileintothecurrentbuffer. Inordertocreateanewfileinemacs,youcannotjustgotypingrightaway.Youfirsthavetocreatea bufferforit,andcomeupwithafilename.YoudothisbytypingCxCfandtypingafilename,justas ifyouwereopeninganexistingfile.Emacswillnoticethatthefileyoutypeddoesn'texist,andwillcreate anewbufferandreport(Newfile)intheminibuffer. WhenyoutypeCxCfandthenenteradirectorynameinsteadofafilename,Emacswillcreateanew bufferinwhichyouwillfindalistofallthefilesinthatdirectory.Youcanmovethecursortothefilethat youarelookingforandtype,andEmacswillopenit.(Thereareinfactalotmoreactionsyoucan performhere,suchasdeleting,renamingandmovingfiles,etc.Emacsisnowindiredmode,whichis basicallyasimplefilemanager.) WhenyouhavetypedCxCfandsuddenlychangeyourmind,youcantypeCgtocanceltheaction. Cgworksalmosteverywherewhereyouwanttocancelanactionorcommandthatyou'vestartedbut don'twanttofinish.
17.4BasicEditing
Whenyouhaveopenedafile,youcanofcoursemovearoundinitwiththecursor.Thecursorkeys andPgUp,PgDndowhatyou'dexpect.HomeandEndjumptothebeginningandendoftheline.(In olderversions,theywouldactuallyjumptothebeginningandendofthebuffer.)However,thereare alsoControlandMeta(Alt)keycombosthatmovethecursoraround.Becauseyoudonotneedto moveyourhandstoanotherpartofthekeyboardforthese,theyaremuchquickeronceyougetusedto them.ThemostimportantsuchcommandsarelistedinTable171. Table171.BasicEmacsEditingCommands Command Cb Cf Cn Cp Ca Ce Mb Mf M} M{ Ma Me Cd Md Cv Mv M< M> C_ Ck Cs Cr Result goonecharacterback goonecharacterforward goonelinedown goonelineup gotothebeginningoftheline gototheendoftheline goonewordback goonewordforward gooneparagraphforward gooneparagraphbackward goonesentencebackward goonesentenceforward deletethecharacterunderthecursor deleteuntiltheendofthecurrentword godownonescreen(i.e.,PgDn) gouponescreen(i.e.,PgUp) gotothebeginningofthebuffer gototheendofthebuffer undothelastchange(canberepeated)notethatyouactuallyhavetotype Shift+Control+hyphenforthis. deletetoendofline forwardsearch backwardsearch
deletethelineitself.
17.5SavingFiles
Inordertosaveafile,youtype
CxCs
Emacswillnotaskyouforafilename,thebufferwilljustbesavedtothefileitwasloadedfrom.Ifyou wanttosaveyourtexttoanotherfile,type
CxCw
17.5.1QuittingEmacs
WhenyouaredonewithEmacsaltogether,youcantype
CxCc
ThisquitsEmacs.Ifyouhaveanyunsavedfiles,Emacswilltellyouso,andaskifyouwanttosavethem eachinturn.Ifyouanswernotoanyofthese,Emacswillaskforonefinalconfirmationandthenquit.
Chapter18SlackwarePackageManagement
Asoftwarepackageisabundleofrelatedprogramsthatarereadyforyoutoinstall.Whenyou downloadasourcecodearchive,youhavetoconfigure,compile,andinstallitbyhand.Withasoftware package,thishasalreadybeendoneforyou.Allthatyouhavetodoisinstallthepackage.Another
handyfeatureofusingsoftwarepackagesisthatitisveryeasytoremoveandupgradethem,ifyouso desire.Slackwarecomeswithprogramsforallyourpackagemanagementneeds.Youcaninstall, remove,upgrade,make,andexaminepackagesveryeasily. There'samyththat'sbeengoingaroundeversinceRedHatdebutedRedHatPackageManager,that Slackwarehasnopackagemanagementtool.Thissimplycouldn'tbefurtherfromthetruth.Slackware hasalwaysincludedapackagemanager,evenbeforeRedHatexisted.Whilenotasfullfeaturedoras ubiquitousasrpm(orforthatmatterdeb),pkgtoolanditsassociatedprogramsareeverybitasgood atinstallingpackagesasrpm.Thetruthaboutpkgtoolisnotthatitdoesn'texist,butthatitdoesn'tdo anydependencychecking. ApparentlymanypeopleintheLinuxcommunitythinkthatapackagermanagermustbydefinition includedependencychecking.Well,thatsimplyisn'tthecase,asSlackwaremostcertainlydoesnot. ThisisnottosaythatSlackwarepackagesdon'thavedependencies,butratherthatitspackage managerdoesn'tcheckforthem.Dependencymanagementisleftuptothesysadmin,andthat'stheway welikeit.
18.1OverviewofPackageFormat
Beforelearningtheutilities,youshouldbecomefamiliarwiththeformatofaSlackwarepackage.In Slackware,apackageissimplyatararchivefilethathasbeencompressedwithgzip.Packagesare builttobeextractedintherootdirectory. Hereisafictitiousprogramanditsexamplepackage:
./ usr/ usr/bin/ usr/bin/makehejaz usr/doc/ usr/doc/makehejaz1.0/ usr/doc/makehejaz1.0/COPYING usr/doc/makehejaz1.0/README usr/man/ usr/man/man1 usr/man/man1/makehejaz.1.gz install/ install/doinst.sh
18.2PackageUtilities
Therearefourmainutilitiesforpackagemanagement.Theyperforminstallation,removal,andupgrades ofpackages.
18.2.1pkgtool
pkgtool(8)isamenudrivenprogramthatallowsinstallationandremovalofpackages.Themainmenu
isshowninFigure181. Figure181.Pkgtool'smainmenu.
18.2.2installpkg
installpkg(8)handlesinstallationofnewpackagesonthesystem.Thesyntaxisasfollows:
#installpkgoptionpackage_name
Threeoptionsareprovidedforinstallpkg.Onlyoneoptioncanbeusedatatime. Table181.installpkgOptions Option Effects m Performsamakepkgoperationonthecurrentdirectory. Showswhatwouldhappenifyouinstalledthespecifiedpackage.Thisisusefulforproduction warn systemssoyoucanseeexactlywhatwouldhappenbeforeinstallingsomething. Recursivelyinstallallpackagesinthecurrentdirectoryanddown.Thepackagenamecanuse r wildcards,whichwouldbeusedasthesearchmaskwhenrecursivelyinstalling. IfyoupasstheROOTenvironmentvariablebeforeinstallpkg,thatpathwillbeusedfortheroot directory.Thisisusefulforsettingupnewdrivesforyourrootdirectory.Theywilltypicallybemounted
18.2.3removepkg
removepkg(8)handlesremovinginstalledpackagesfromthesystem.Thesyntaxisasfollows:
#removepkgoptionpackage_name
18.2.4upgradepkg
upgradepkg(8)willupgradeaninstalledSlackwarepackage.Thesyntaxisasfollows:
#upgradepkgpackage_name
or
#upgradepkgold_package_name%new_package_name upgradepkgworksbyfirstinstallingthenewpackageandthenremovingtheoldpackagesothatold
18.2.5rpm2tgz/rpm2targz
TheRedHatPackageManagerisapopularpackagingsystemavailabletoday.Manysoftware distributorsareofferingtheirproductsinRPMformat.Sincethisisnotournativeformat,wedonot recommendpeoplerelyonthem.However,somethingsareonlyavailableasanRPM(eventhe source). WeprovideaprogramthatwillconvertRPMpackagestoournative.tgzformat.Thiswillallowyou toextractthepackage(perhapswithexplodepkg)toatemporarydirectoryandexamineitscontents. Therpm2tgzprogramwillcreateaSlackwarepackagewitha.tgzextension,whilerpm2targz createsanarchivewitha.tar.gzextension.
18.3MakingPackages
MakingSlackwarepackagescanbeeithereasyordifficult.Thereisnospecificmethodforbuildinga package.Theonlyrequirementisthatthepackagebeatargzippedfileandifthereisapostinstallation script,itmustbe/install/doinst.sh. Ifyouareinterestedinmakingpackagesforyoursystemorforanetworkthatyoumanage,youshould havealookatthevariousbuildscriptsintheSlackwaresourcetree.Thereareseveralmethodsweuse formakingpackages.
18.3.1explodepkg
explodepkg(8)willdothesamethingthatinstallpkgdoestoextractthepackage,butitdoesn't
actuallyinstallitanditdoesn'trecorditinthepackagesdatabase.Itsimplyextractsittothecurrent directory.
18.3.2makepkg
makepkg(8)willpackageupthecurrentdirectoryintoavalidSlackwarepackage.Itwillsearchthetree
18.3.3SlackBuildScripts
Slackwarepackagesarebuiltinmanydifferentwaysbynecessity.Notallsoftwarepackagesare writtenbytheirprogrammerstocompilethesameway.Manyhavecompiletimeoptionsthatarenotall includedinthepackagesSlackwareuses.Perhapsyouneedsomeofthisfunctionalityyou'llneedto compileyourownpackagethen.FortunatelyformanySlackwarepackages,youcanfindSlackBuild scriptsinthepackage'ssourcecode. SowhatisaSlackBuildscript?SlackBuildscriptsareexecutableshellscriptsthatyourunasrootto configure,compile,andcreateSlackwarepackages.Youcanfreelymodifythesescriptsinthesource directoryandrunthemtocreateyourownversionsofthedefaultSlackwarepackages.
18.4MakingTagsandTagfiles(forsetup)
TheSlackwaresetupprogramhandlesinstallationofthesoftwarepackagesonyoursystem.Thereare filesthattellthesetupprogramwhichpackagesmustbeinstalled,whichonesareoptional,andwhich onesareselectedbydefaultbythesetupprogram. Atagfileisinthefirstsoftwareseriesdirectoryandiscalledtagfile.Itliststhepackagesinthatparticular disksetandtheirstatus.Thestatuscanbe: Table183.TagfileStatusOptions Option ADD SKP REC OPT Theformatissimply:
package_name:status
Onepackageperline.Theoriginaltagfilesforeachsoftwareseriesarestoredastagfile.org.Soifyou
Chapter19ZipSlack
19.1WhatisZipSlack?
ZipSlackisaspecialversionofSlackwareLinux.It'sanalreadyinstalledcopyofSlackwarethat's readytorunfromyourDOSorWindowspartition.It'sabasicinstallation,youdonotgeteverything thatcomeswithSlackware. ZipSlackgetsitsnamefromtheformit'sdistributedin,abig.ZIPfile.UsersofDOSandWindowswill probablybefamiliarwiththesefiles.Theyarecompressedarchives.TheZipSlackarchivecontains everythingyouneedtogetupandrunningwithSlackware. ItisimportanttonotethatZipSlackissignificantlydifferentfromaregularinstallation.Eventhoughthey functionthesameandcontainthesameprograms,theirintendedaudiencesandfunctionsdiffer.Several advantagesanddisadvantagesofZipSlackarediscussedbelow. Onelastthing,youshouldalwaysreviewthedocumentationincludedintheactualZipSlackdirectory.It containsthelatestinformationregardinginstallation,booting,andgeneraluseoftheproduct.
19.1.1Advantages
Doesnotrequirerepartitioningofyourharddisk. GreatwaytolearnSlackwareLinuxwithoutstumblingthroughtheinstallationprocess.
19.1.2Disadvantages
UsestheDOSfilesystem,whichisslowerthananativeLinuxfilesystem. WillnotworkwithWindowsNT.
19.2GettingZipSlack
ObtainingZipSlackiseasy.IfyouhavepurchasedtheofficialSlackwareLinuxCDset,thenyou alreadyhaveZipSlack.JustfindtheCDthatcontainsthezipslackdirectoryandplaceitinyourCD ROMdrive.It'susuallythethirdorfourthdisc,butalwaystrustthelabelsoverthisdocumentationas
thediskitresidesonispronetochange. IfyouwanttodownloadZipSlack,youshouldfirstvisitourGetSlackwebpageforthelatest downloadinformation: http://www.slackware.com/getslack/ ZipSlackispartofeachSlackwarerelease.Locatethereleaseyouwant,andgotothatdirectoryonthe FTPsite.Thelatestreleasedirectorycanbefoundatthislocation: ftp://ftp.slackware.com/pub/slackware/slackware/ You'llfindZipSlackinthe/zipslacksubdirectory.ZipSlackisofferedasonebig.ZIPfileorfloppy sizedchunks.Thechunksareinthe/zipslack/splitdirectory. Don'tstopatjustthe.ZIPfiles.Youshouldalsodownloadthedocumentationfilesandanyboot imagesthatappearinthedirectory.
19.2.1Installation
Onceyou'vedownloadedthenecessarycomponents,you'llneedtoextractthe.ZIPfile.Besuretouse a32bitunzipper.Thesizeandfilenamesinthearchivearetoomuchfora16bitunzipper.Examplesof 32bitunzippersincludeWinZipandPKZIPforWindows. ZipSlackisdesignedtobeextracteddirectlytotherootdirectoryofadrive(suchasC:orD:).A \LINUXdirectorywillbecreatedthatcontainstheactualSlackwareinstallation.You'llalsofindthefiles necessarytobootingthesysteminthatdirectoryaswell. Afteryou'veextractedthefiles,youshouldhavea\LINUXdirectoryonthedriveofyourchoosing(we'll useC:fromhereon).
19.3BootingZipSlack
ThereareseveralwaystobootZipSlack.ThemostcommonistousetheincludedLINUX.BATto bootthesystemfromDOS(orfromDOSmodeunderWindows9x).Thisfilemustbeeditedtomatch yoursystembeforeitwillwork. StartbyopeningtheC:\LINUX\LINUX.BATfileinyourfavoritetexteditor.Atthetopofthefileyou willnoticealargecomment.Itexplainswhatyouneedtoeditinthisfile(andalsowhattodoifyouare bootingfromanexternalZipdrive).Don'tworryifyoudon'tunderstandtheroot=setting.Thereare severalexamples,sofeelfreetopickoneandtryit.Ifitdoesn'twork,youcaneditthefileagain, commentoutthelineyouuncommented,andpickanotherone. Afteryouuncommentthelineyouwantbyremovingtherematthebeginningoftheline,savethefile andexittheeditor.BringyourmachineintoDOSmode. ADOSpromptwindowinWindows9xwillNOTwork. TypeC:\LINUX\LINUX.BATtobootthesystem.Ifallgoeswell,youshouldbepresentedwithalogin prompt.
Glossary
Account Alloftheinformationaboutauser,includingusername,password,fingerinformation,UIDand GID,andhomedirectory.Tocreateanaccountistoaddanddefineauser. Background Anyprocessthatisrunningwithoutacceptingorcontrollingtheinputofaterminalissaidtobe runninginthebackground. Bootdisk Afloppydiskcontaininganoperatingsystem(inourcase,theLinuxkernel)fromwhicha computercanbestarted. Compile Toconvertsourcecodetomachinereadablebinarycode. Daemon Aprogramdesignedtoruninthebackgroundand,withoutuserintervention,performaspecific task(usuallyprovidingaservice). Darkstar ThedefaulthostnameinSlackwareyourcomputerwillbecalleddarkstarifyoudonotspecify someothername. OneofPatrickVolkerding'sdevelopmentmachines,namedafterDarkStar,asongbythe GratefulDead. DesktopEnvironment Agraphicaluserinterface(GUI)thatrunsatoptheXWindowSystemandprovidessuch featuresasintegratedapplications,cohesivelookandfeelbetweenprogramsandcomponents, fileandwindowmanagementcapabilities,etc.Astepbeyondthesimplewindowmanager. Devicedriver Achunkofcodeinthekernelthatdirectlycontrolsapieceofhardware. Devicenode
Aspecialtypeoffileinthe/devfilesystemthatrepresentsahardwarecomponenttothe operatingsystem. DNS DomainNameService.Asysteminwhichnetworkedcomputersaregivennameswhichtranslate tonumericaladdresses. Domainname Acomputer'sDNSname,excludingitshostname. Dotfile InLinux,fileswhicharetobehiddenhavefilenamesbeginningwithadot('.'). Dottedquad TheformatofIPaddresses,socalledbecauseitconsistsoffournumbers(range0255decimal) separatedbyperiods. Dynamicloader WhenprogramsarecompiledunderLinux,theyusuallyusepiecesofcode(functions)from externallibraries.Whensuchprogramsarerun,thoselibrariesmustbefoundandtherequired functionsloadedintomemory.Thisisthejobofthedynamicloader. Environmentvariable Avariablesetintheuser'sshellwhichcanbereferencedbythatuserorprogramsrunbythat userwithinthatshell.Environmentvariablesaregenerallyusedtostorepreferencesanddefault parameters. Epoch AperiodofhistoryinUnix,TheEpochbeginsat00:00:00UTCJanuary1,1970.Thisis consideredthedawnoftimebyUnixandUnixlikeoperatingsystems,andallothertimeis calculatedrelativetothisdate. Filesystem Arepresentationofstoreddatainwhichfilesofdataarekeptorganizedindirectories.The filesystemisthenearlyuniversalformofrepresentationfordatastoredtodisks(bothfixedand removable). Foreground Aprogramthatisacceptingorcontrollingaterminal'sinputissaidtoberunninginthe foreground. Framebuffer AtypeofgraphicsdeviceinLinux,thismostoftenreferstothesoftwareframebuffer,which providesastandardframebufferinterfacetoprogramswhilekeepingspecifichardwaredrivers hiddenfromthem.Thislayerofabstractionfreesprogramsoftheneedtospeaktovarious
hardwaredrivers. FTP TheFileTransferProtocol.FTPisaverypopularmethodoftransferringdatabetween computers. Gateway Acomputerthroughwhichdataonanetworkistransferredtoanothernetwork. GID GroupIdentifier.TheGIDisauniquenumberattributedtoagroupofusers. Group UsersinUnixbelongtogroups,whichcancontainmanyotherusersandareusedformore generalaccesscontrolthantheexistenceofusersalonecaneasilyallow. GUI GraphicalUserInterface.Asoftwareinterfacethatusesrenderedgraphicalelementssuchas buttons,scrollbars,windows,etc.ratherthansolelytextbasedinputandoutput Homedirectory Auser'shomedirectoryisthedirectorytheuserisplacedinimmediatelyuponloggingin.Users havefullpermissionsandmoreorlessfreereignwithintheirhomedirectories. HOWTO Adocumentdescribinghowtodosomething,suchasconfigureafirewallormanageusersand groups.ThereisalargecollectionofthesedocumentsavailablefromtheLinuxDocumentation Project. HTTP TheHypertextTransferProtocol.HTTPistheprimaryprotocolonwhichtheWorldWideWeb operates. ICMP InternetControlMessageProtocol.Averybasicnetworkingprotocol,usedmostlyforpings. Kernel Theheartofanoperatingsystem.Thekernelisthepartthatprovidesbasicprocesscontroland interfaceswiththecomputer'shardware. Kernelmodule Apieceofkernelcode,usuallyadriverofsomesort,thatcanbeloadedandunloadedfrom memoryseparatelyfromthemainbodyofthekernel.Modulesarehandywhenupgradingdrivers ortestingkernelsettings,becausetheycanbeloadedandunloadedwithoutrebooting.
Library Acollectionoffunctionswhichcanbesharedbetweenprograms. LILO TheLInuxLOader.LILOisthemostwidelyusedLinuxbootmanager. LOADLIN LOADLINisaprogramthatrunsunderMSDOSorWindowsandbootsaLinuxsystem.Itis mostcommonlyusedoncomputerswithmultipleoperatingsystems(includingLinuxand DOS/Windows,ofcourse). Mansection PagesinthestandardUnixonlinemanual("man")aregroupedintosectionsforeasyreference. AllCprogrammingpagesareinsection3,systemadministrationpagesinsection5,etc. MBR TheMasterBootRecord.Areservedspaceonaharddrivewhereinformationonwhattodo whenbootingisstored.LILOorotherbootmanagerscanbewrittenhere. Motif ApopularprogrammingtoolkitusedinmanyolderXprograms. MOTD MessageoftheDay.Themotd(storedinLinuxin/etc/motdisatextfilethatisdisplayedtoall usersuponloggingin.Traditionally,itisusedbythesystemadministratorasasortofbulletin boardforcommunicatingwithusers. Mountpoint Anemptydirectoryinafilesystemwhereanotherfilesystemistobemounted,orgraftedon. Nameserver ADNSinformationserver.NameserverstranslateDNSnamestonumericalIPaddresses. Networkinterface Avirtualrepresentationofanetworkdeviceprovidedbythekernel.Networkinterfacesallow usersandprogramstotalktonetworkdevices. NFS TheNetworkFilesystem.NFSallowsthemountingofremotefilesystemsasiftheywerelocalto yourcomputerandthusprovidesatransparentmethodoffilesharing. Octal Base8numbersystem,withdigits07.
Pager AnXprogramthatallowstheusertoseeandswitchbetweenmultipledesktops. Partition Adivisionofaharddrive.Filesystemsexistontopofpartitions. PPP PointtoPointProtocol.PPPisusedmainlyforconnectingviamodemtoanInternetService Provider. Process Arunningprogram. Rootdirectory Representedas/,therootdirectoryexistsatthetopofthefilesystem,withallotherdirectories branchingoutbeneathitinafiletree. Rootdisk Thedisk(usuallyfixed)onwhichtherootdirectoryisstored. Routingtable Thesetofinformationthekernelusesinroutingnetworkdataaround.Itcontainssuchtidbitsas whereyourdefaultgatewayis,whichnetworkinterfaceisconnectedtowhichnetwork,etc. Runlevel Theoverallsystemstateasdefinedbyinit.Runlevel6isrebooting,runlevel1issingleuser mode,runlevel4isanXlogin,etc.Thereare6availablerunlevelsonaSlackwaresystem. Secureshell Anencrypted(thussecure)methodoflogginginremotelytoacomputer.Manysecureshell programsareavailablebothaclientandserverareneeded. Service Thesharingofinformationand/ordatabetweenprogramsandcomputersfromasingleserver tomultipleclients.HTTP,FTP,NFS,etc.areservices. Shadowpasswordsuite Theshadowpasswordsuiteallowsencryptedpasswordstobehiddenfromusers,whiletherest oftheinformationinthe/etc/passwdfileremainsvisibletoall.Thishelpspreventbruteforce attemptsatcrackingpasswords. Shell Shellsprovideacommandlineinterfacetotheuser.Whenyou'relookingatatextprompt,you're
inashell. Shellbuiltin Acommandbuiltintotheshell,asopposedtobeingprovidedbyanexternalprogram.For instance,bashhasacdbuiltin. Signal Unixprogramscancommunicatebetweeneachotherusingsimplesignals,whichare enumeratedandusuallyhavespecificmeanings.killlwilllisttheavailablesignals. SLIP SerialLineInterfaceProtocol.SLIPisasimilarprotocoltoPPP,inthatit'susedforconnecting twomachinesviaaserialinterface. Softwarepackage Aprogramanditsassociatedfiles,archivedandcompressedintoasinglefilealongwithany necessaryscriptsorinformationtoaidinmanagingtheinstallation,upgrade,andremovalofthose files. Softwareseries AcollectionofrelatedsoftwarepackagesinSlackware.AllKDEpackagesareinthekde series,networkingpackagesinthenseries,etc. Sourcecode The(moreorless)humanreadablecodeinwhichmostprogramsarewritten.Sourcecodeis compiledintobinarycode. StandardError(stderr) TheUnixstandardoutputstreamforerrors.Programswriteanyerrormessagesonstderr,so thattheycanbeseparatedfromnormaloutput. StandardInput(stdin) TheUnixstandardinputstream.Datacanberedirectedorpipedintoaprogram'sstdinfromany source. StandardOutput(stdout) TheUnixstandardoutputstream.Normaltextoutputfromaprogramiswrittentostdout,which isseparatefromtheerrormessagesreportedonstderrandcanbepipedorredirectedintoother programs'stdinortoafile. Subnet AnIPaddressrangethatispartofalargerrange.Forinstance,192.168.1.0isasubnetof 192.168.0.0(where0isamaskmeaningundefined)itis,infact,the.1subnet. Superblock
InLinux,partitionsarediscussedintermsofblocks.Ablockis512bytes.Thesuperblockisthe first512bytesofapartition. Supplementaldisk InSlackware,afloppydiskusedduringinstallationthatcontainsneitherthekernel(whichison thebootdisk)northerootfilesystem(whichisontherootdisk),butadditionalneededfilessuch asnetworkmodulesorPCMCIAsupport. Suspendedprocess Aprocesswhichhasbeenfrozenuntilkilledorresumed. Swapspace DiskspaceusedbythekernelasvirtualRAM.ItisslowerthanRAM,butbecausediskspace ischeaper,swapisusuallymoreplentiful.Swapspaceisusefultothekernelforholdinglesser useddataandasafallbackwhenphysicalRAMisexhausted. Symboliclink Aspecialfilethatsimplypointstothelocationofanotherfile.Symboliclinksareusedtoavoid dataduplicationwhenafileisneededinmultiplelocations. Tagfile AfileusedbytheSlackwaresetupprogramduringinstallation,whichdescribesasetof packagestobeinstalled. Terminal Ahumancomputerinterfaceconsistingofatleastascreen(orvirtualscreen)andsomemethod ofinput(almostalwaysatleastakeyboard). Toolkit,GUI AGUItoolkitisacollectionoflibrariesthatprovideaprogrammerwithcodetodrawwidgets suchasscrollbars,checkboxes,etc.andconstructagraphicalinterface.TheGUItoolkitusedby aprogramoftendefinesitslookandfeel. UID UserIdentifier.Auniquenumberthatidentifiesausertothesystem.UIDsareusedbymost programsinsteadofusernamesbecauseanumberiseasiertodealwithusernamesaregenerally onlyusedwhentheuserhastoseethingshappen. VESA VideoElectronicsStandardsAssociation.ThetermVESAisoftenusedtodenoteastandard specifiedbysaidAssociation.NearlyallmodernvideoadaptersareVESAcompliant. Virtualterminal Theuseofsoftwaretosimulatemultipleterminalswhileusingonlyasinglesetofinput/output devices(keyboard,monitor,mouse).Specialkeystrokesswitchbetweenvirtualterminalsata
singlephysicalterminal. Windowmanager AnXprogramwhosepurposeistoprovideagraphicalinterfacebeyondthesimplerectangle drawingoftheXWindowSystem.Windowmanagersgenerallyprovidetitlebars,menusfor runningprograms,etc. Workingdirectory Thedirectoryinwhichaprogramconsidersitselftobewhilerunning. Wrapperprogram Aprogramwhosesolepurposeistorunotherprograms,butchangetheirbehaviorinsomeway byalteringtheirenvironmentsorfilteringtheirinput. Xserver TheprogramintheXWindowSystemwhichinterfaceswithgraphicshardwareandhandlesthe actualrunningofXprograms. XWindowSystem NetworkorientedgraphicalinterfacesystemusedonmostUnixlikeoperatingsystems,including Linux.
AppendixA.TheGNUGeneralPublic License
GNUGENERALPUBLICLICENSE Version2,June1991 Copyright(C)1989,1991FreeSoftwareFoundation,Inc. 59TemplePlace,Suite330,Boston,MA021111307USA Everyoneispermittedtocopyanddistributeverbatimcopiesofthis licensedocument,butchangingitisnotallowed. A.1.Preamble Thelicensesformostsoftwarearedesignedtotakeawayyourfreedomtoshareandchangeit.By contrast,theGNUGeneralPublicLicenseisintendedtoguaranteeyourfreedomtoshareandchange freesoftwaretomakesurethesoftwareisfreeforallitsusers.ThisGeneralPublicLicenseappliesto mostoftheFreeSoftwareFoundation'ssoftwareandtoanyotherprogramwhoseauthorscommitto usingit.(SomeotherFreeSoftwareFoundationsoftwareiscoveredbytheGNULibraryGeneral PublicLicenseinstead.)Youcanapplyittoyourprograms,too. Whenwespeakoffreesoftware,wearereferringtofreedom,notprice.OurGeneralPublicLicenses aredesignedtomakesurethatyouhavethefreedomtodistributecopiesoffreesoftware(andcharge
forthisserviceifyouwish),thatyoureceivesourcecodeorcangetitifyouwantit,thatyoucanchange thesoftwareorusepiecesofitinnewfreeprogramsandthatyouknowyoucandothesethings. Toprotectyourrights,weneedtomakerestrictionsthatforbidanyonetodenyyoutheserightsorto askyoutosurrendertherights.Theserestrictionstranslatetocertainresponsibilitiesforyouifyou distributecopiesofthesoftware,orifyoumodifyit. Forexample,ifyoudistributecopiesofsuchaprogram,whethergratisorforafee,youmustgivethe recipientsalltherightsthatyouhave.Youmustmakesurethatthey,too,receiveorcangetthesource code.Andyoumustshowthemthesetermssotheyknowtheirrights. Weprotectyourrightswithtwosteps:(1)copyrightthesoftware,and(2)offeryouthislicensewhich givesyoulegalpermissiontocopy,distributeand/ormodifythesoftware. Also,foreachauthor'sprotectionandours,wewanttomakecertainthateveryoneunderstandsthat thereisnowarrantyforthisfreesoftware.Ifthesoftwareismodifiedbysomeoneelseandpassedon, wewantitsrecipientstoknowthatwhattheyhaveisnottheoriginal,sothatanyproblemsintroduced byotherswillnotreflectontheoriginalauthors'reputations. Finally,anyfreeprogramisthreatenedconstantlybysoftwarepatents.Wewishtoavoidthedangerthat redistributorsofafreeprogramwillindividuallyobtainpatentlicenses,ineffectmakingtheprogram proprietary.Topreventthis,wehavemadeitclearthatanypatentmustbelicensedforeveryone'sfree useornotlicensedatall. Theprecisetermsandconditionsforcopying,distributionandmodificationfollow. A.2.TERMSANDCONDITIONS TERMSANDCONDITIONSFORCOPYING,DISTRIBUTIONANDMODIFICATION 1. ThisLicenseappliestoanyprogramorotherworkwhichcontainsanoticeplacedbythe copyrightholdersayingitmaybedistributedunderthetermsofthisGeneralPublicLicense. TheProgram,below,referstoanysuchprogramorwork,andaworkbasedonthe ProgrammeanseithertheProgramoranyderivativeworkundercopyrightlaw:thatisto say,aworkcontainingtheProgramoraportionofit,eitherverbatimorwithmodifications and/ortranslatedintoanotherlanguage.(Hereinafter,translationisincludedwithoutlimitation inthetermmodification.)Eachlicenseeisaddressedasyou. Activitiesotherthancopying,distributionandmodificationarenotcoveredbythisLicense theyareoutsideitsscope.TheactofrunningtheProgramisnotrestricted,andtheoutput fromtheProgramiscoveredonlyifitscontentsconstituteaworkbasedontheProgram (independentofhavingbeenmadebyrunningtheProgram).Whetherthatistruedepends onwhattheProgramdoes. 2. YoumaycopyanddistributeverbatimcopiesoftheProgram'ssourcecodeasyoureceive it,inanymedium,providedthatyouconspicuouslyandappropriatelypublishoneachcopy anappropriatecopyrightnoticeanddisclaimerofwarrantykeepintactallthenoticesthat refertothisLicenseandtotheabsenceofanywarrantyandgiveanyotherrecipientsofthe ProgramacopyofthisLicensealongwiththeProgram. Youmaychargeafeeforthephysicalactoftransferringacopy,andyoumayatyour optionofferwarrantyprotectioninexchangeforafee.
3. YoumaymodifyyourcopyorcopiesoftheProgramoranyportionofit,thusforminga workbasedontheProgram,andcopyanddistributesuchmodificationsorworkunderthe termsofSection1above,providedthatyoualsomeetalloftheseconditions: a. Youmustcausethemodifiedfilestocarryprominentnoticesstatingthatyou changedthefilesandthedateofanychange. b. Youmustcauseanyworkthatyoudistributeorpublish,thatinwholeorinpart containsorisderivedfromtheProgramoranypartthereof,tobelicensedasa wholeatnochargetoallthirdpartiesunderthetermsofthisLicense. c. Ifthemodifiedprogramnormallyreadscommandsinteractivelywhenrun,you mustcauseit,whenstartedrunningforsuchinteractiveuseinthemostordinary way,toprintordisplayanannouncementincludinganappropriatecopyright noticeandanoticethatthereisnowarranty(orelse,sayingthatyouprovidea warranty)andthatusersmayredistributetheprogramundertheseconditions, andtellingtheuserhowtoviewacopyofthisLicense.(Exception:ifthe Programitselfisinteractivebutdoesnotnormallyprintsuchanannouncement, yourworkbasedontheProgramisnotrequiredtoprintanannouncement.) Theserequirementsapplytothemodifiedworkasawhole.Ifidentifiablesectionsofthat workarenotderivedfromtheProgram,andcanbereasonablyconsideredindependentand separateworksinthemselves,thenthisLicense,anditsterms,donotapplytothose sectionswhenyoudistributethemasseparateworks.Butwhenyoudistributethesame sectionsaspartofawholewhichisaworkbasedontheProgram,thedistributionofthe wholemustbeonthetermsofthisLicense,whosepermissionsforotherlicenseesextendto theentirewhole,andthustoeachandeverypartregardlessofwhowroteit. Thus,itisnottheintentofthissectiontoclaimrightsorcontestyourrightstoworkwritten entirelybyyourather,theintentistoexercisetherighttocontrolthedistributionof derivativeorcollectiveworksbasedontheProgram. Inaddition,mereaggregationofanotherworknotbasedontheProgramwiththeProgram (orwithaworkbasedontheProgram)onavolumeofastorageordistributionmedium doesnotbringtheotherworkunderthescopeofthisLicense. 4. YoumaycopyanddistributetheProgram(oraworkbasedonit,underSection2)in objectcodeorexecutableformunderthetermsofSections1and2aboveprovidedthat youalsodooneofthefollowing: a. Accompanyitwiththecompletecorrespondingmachinereadablesourcecode, whichmustbedistributedunderthetermsofSections1and2aboveona mediumcustomarilyusedforsoftwareinterchangeor, b. Accompanyitwithawrittenoffer,validforatleastthreeyears,togiveanythird party,forachargenomorethanyourcostofphysicallyperformingsource distribution,acompletemachinereadablecopyofthecorrespondingsource code,tobedistributedunderthetermsofSections1and2aboveonamedium customarilyusedforsoftwareinterchangeor, c. Accompanyitwiththeinformationyoureceivedastotheoffertodistribute correspondingsourcecode.(Thisalternativeisallowedonlyfornoncommercial distributionandonlyifyoureceivedtheprograminobjectcodeorexecutable
formwithsuchanoffer,inaccordwithSubsectionbabove.) Thesourcecodeforaworkmeansthepreferredformoftheworkformakingmodifications toit.Foranexecutablework,completesourcecodemeansallthesourcecodeforall modulesitcontains,plusanyassociatedinterfacedefinitionfiles,plusthescriptsusedto controlcompilationandinstallationoftheexecutable.However,asaspecialexception,the sourcecodedistributedneednotincludeanythingthatisnormallydistributed(ineither sourceorbinaryform)withthemajorcomponents(compiler,kernel,andsoon)ofthe operatingsystemonwhichtheexecutableruns,unlessthatcomponentitselfaccompanies theexecutable. Ifdistributionofexecutableorobjectcodeismadebyofferingaccesstocopyfroma designatedplace,thenofferingequivalentaccesstocopythesourcecodefromthesame placecountsasdistributionofthesourcecode,eventhoughthirdpartiesarenotcompelled tocopythesourcealongwiththeobjectcode. 5. Youmaynotcopy,modify,sublicense,ordistributetheProgramexceptasexpressly providedunderthisLicense.Anyattemptotherwisetocopy,modify,sublicenseor distributetheProgramisvoid,andwillautomaticallyterminateyourrightsunderthis License.However,partieswhohavereceivedcopies,orrights,fromyouunderthisLicense willnothavetheirlicensesterminatedsolongassuchpartiesremaininfullcompliance. 6. YouarenotrequiredtoacceptthisLicense,sinceyouhavenotsignedit.However,nothing elsegrantsyoupermissiontomodifyordistributetheProgramoritsderivativeworks. TheseactionsareprohibitedbylawifyoudonotacceptthisLicense.Therefore,by modifyingordistributingtheProgram(oranyworkbasedontheProgram),youindicate youracceptanceofthisLicensetodoso,andallitstermsandconditionsforcopying, distributingormodifyingtheProgramorworksbasedonit. 7. EachtimeyouredistributetheProgram(oranyworkbasedontheProgram),therecipient automaticallyreceivesalicensefromtheoriginallicensortocopy,distributeormodifythe Programsubjecttothesetermsandconditions.Youmaynotimposeanyfurtherrestrictions ontherecipients'exerciseoftherightsgrantedherein.Youarenotresponsibleforenforcing compliancebythirdpartiestothisLicense. 8. If,asaconsequenceofacourtjudgmentorallegationofpatentinfringementorforanyother reason(notlimitedtopatentissues),conditionsareimposedonyou(whetherbycourt order,agreementorotherwise)thatcontradicttheconditionsofthisLicense,theydonot excuseyoufromtheconditionsofthisLicense.Ifyoucannotdistributesoastosatisfy simultaneouslyyourobligationsunderthisLicenseandanyotherpertinentobligations,then asaconsequenceyoumaynotdistributetheProgramatall.Forexample,ifapatentlicense wouldnotpermitroyaltyfreeredistributionoftheProgrambyallthosewhoreceivecopies directlyorindirectlythroughyou,thentheonlywayyoucouldsatisfybothitandthisLicense wouldbetorefrainentirelyfromdistributionoftheProgram. Ifanyportionofthissectionisheldinvalidorunenforceableunderanyparticular circumstance,thebalanceofthesectionisintendedtoapplyandthesectionasawholeis intendedtoapplyinothercircumstances. Itisnotthepurposeofthissectiontoinduceyoutoinfringeanypatentsorotherproperty rightclaimsortocontestvalidityofanysuchclaimsthissectionhasthesolepurposeof protectingtheintegrityofthefreesoftwaredistributionsystem,whichisimplementedby publiclicensepractices.Manypeoplehavemadegenerouscontributionstothewiderange
ofsoftwaredistributedthroughthatsysteminrelianceonconsistentapplicationofthat systemitisuptotheauthor/donortodecideifheorsheiswillingtodistributesoftware throughanyothersystemandalicenseecannotimposethatchoice. Thissectionisintendedtomakethoroughlyclearwhatisbelievedtobeaconsequenceof therestofthisLicense. 9. Ifthedistributionand/oruseoftheProgramisrestrictedincertaincountrieseitherby patentsorbycopyrightedinterfaces,theoriginalcopyrightholderwhoplacestheProgram underthisLicensemayaddanexplicitgeographicaldistributionlimitationexcludingthose countries,sothatdistributionispermittedonlyinoramongcountriesnotthusexcluded.In suchcase,thisLicenseincorporatesthelimitationasifwritteninthebodyofthisLicense. 10. TheFreeSoftwareFoundationmaypublishrevisedand/ornewversionsoftheGeneral PublicLicensefromtimetotime.Suchnewversionswillbesimilarinspirittothepresent version,butmaydifferindetailtoaddressnewproblemsorconcerns. Eachversionisgivenadistinguishingversionnumber.IftheProgramspecifiesaversion numberofthisLicensewhichappliestoitandanylaterversion,youhavetheoptionof followingthetermsandconditionseitherofthatversionorofanylaterversionpublishedby theFreeSoftwareFoundation.IftheProgramdoesnotspecifyaversionnumberofthis License,youmaychooseanyversioneverpublishedbytheFreeSoftwareFoundation. 11. IfyouwishtoincorporatepartsoftheProgramintootherfreeprogramswhosedistribution conditionsaredifferent,writetotheauthortoaskforpermission.Forsoftwarewhichis copyrightedbytheFreeSoftwareFoundation,writetotheFreeSoftwareFoundationwe sometimesmakeexceptionsforthis.Ourdecisionwillbeguidedbythetwogoalsof preservingthefreestatusofallderivativesofourfreesoftwareandofpromotingthesharing andreuseofsoftwaregenerally. 12. NOWARRANTY BECAUSETHEPROGRAMISLICENSEDFREEOFCHARGE,THEREISNO WARRANTYFORTHEPROGRAM,TOTHEEXTENTPERMITTEDBY APPLICABLELAW.EXCEPTWHENOTHERWISESTATEDINWRITINGTHE COPYRIGHTHOLDERSAND/OROTHERPARTIESPROVIDETHEPROGRAM ASISWITHOUTWARRANTYOFANYKIND,EITHEREXPRESSEDOR IMPLIED,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIES OFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSE.THE ENTIRERISKASTOTHEQUALITYANDPERFORMANCEOFTHEPROGRAM ISWITHYOU.SHOULDTHEPROGRAMPROVEDEFECTIVE,YOUASSUME THECOSTOFALLNECESSARYSERVICING,REPAIRORCORRECTION. 13. INNOEVENTUNLESSREQUIREDBYAPPLICABLELAWORAGREEDTOIN WRITINGWILLANYCOPYRIGHTHOLDER,ORANYOTHERPARTYWHO MAYMODIFYAND/ORREDISTRIBUTETHEPROGRAMASPERMITTED ABOVE,BELIABLETOYOUFORDAMAGES,INCLUDINGANYGENERAL, SPECIAL,INCIDENTALORCONSEQUENTIALDAMAGESARISINGOUTOF THEUSEORINABILITYTOUSETHEPROGRAM(INCLUDINGBUTNOT LIMITEDTOLOSSOFDATAORDATABEINGRENDEREDINACCURATEOR LOSSESSUSTAINEDBYYOUORTHIRDPARTIESORAFAILUREOFTHE PROGRAMTOOPERATEWITHANYOTHERPROGRAMS),EVENIFSUCH HOLDEROROTHERPARTYHASBEENADVISEDOFTHEPOSSIBILITYOF
Alsoaddinformationonhowtocontactyoubyelectronicandpapermail. Iftheprogramisinteractive,makeitoutputashortnoticelikethiswhenitstartsinaninteractivemode:
Gnomovisionversion69,Copyright(C)yearnameofauthor GnomovisioncomeswithABSOLUTELYNOWARRANTYfordetailstype`showw'. Thisisfreesoftware,andyouarewelcometoredistributeit undercertainconditionstype`showc'fordetails.