Vous êtes sur la page 1sur 164

SlackwareLinuxEssentials

AlanHicks ChrisLumens DavidCantrell LoganJohnson


Copyright1998,1999,2000,2001,2002,2003,2004,2005SlackwareLinux,Inc.
SLACKWARE LINUXISA REGISTERED TRADEMARK OFPATRICK VOLKERDING AND SLACKWARE LINUX,INC. LINUXISA REGISTERED TRADEMARK OFLINUSTORVALDS. A MERICA ONLINE AND AOLARE REGISTERED TRADEMARKSOFA MERICA ONLINE ,INC.IN THE UNITED STATESAND /OROTHER COUNTRIES. A P P LE ,FIRE W IRE ,M AC,M ACINTOSH ,M ACOS,QUICKTIME ,AND TRUE TYP E ARE TRADEMARKSOFA P P LE COMP UTER,INC., REGISTERED IN THE UNITED STATESAND OTHERCOUNTRIES. IBM,AIX,ETHERJET,NETFINITY ,OS/2,POWERPC,PS/2,S/390,AND THINK PAD ARE TRADEMARKSOFINTERNATIONAL BUSINESSM ACHINESCORP ORATION IN THE UNITED STATES,OTHERCOUNTRIES,ORBOTH . IEEE,POSIX,AND 802ARE REGISTERED TRADEMARKSOFINSTITUTE OFELECTRICAL AND ELECTRONICSENGINEERS,INC.IN THE UNITED STATES. INTEL ,CELERON ,ETHEREXP RESS,I386,I486,ITANIUM,PENTIUM,AND XEON ARE TRADEMARKSORREGISTERED TRADEMARKSOF INTEL CORP ORATION ORITSSUBSIDIARIESIN THE UNITED STATESAND OTHERCOUNTRIES. M ICROSOFT,INTELLIM OUSE ,MSDOS,OUTLOOK ,W INDOWS,W INDOWSM EDIA AND W INDOWSNTARE EITHERREGISTERED TRADEMARKSORTRADEMARKSOFM ICROSOFTCORP ORATION IN THE UNITED STATESAND / OROTHERCOUNTRIES. NETSCAP E AND THE NETSCAP E NAVIGATORARE REGISTERED TRADEMARKSOFNETSCAP E COMMUNICATIONSCORP ORATION IN THE U.S.AND OTHERCOUNTRIES. RED HAT,RPM,ARE TRADEMARKSORREGISTERED TRADEMARKSOFRED HAT,INC.IN THE UNITED STATESAND OTHER COUNTRIES. XFREE 86ISA TRADEMARK OFTHE XFREE 86PROJECT,INC. M ANY OFTHE DESIGNATIONSUSED BY MANUFACTURERSAND SELLERSTO DISTINGUISH THEIRP RODUCTSARE CLAIMED AS TRADEMARKS.W HERE THOSE DESIGNATIONSAP P EARIN THISDOCUMENT,AND SLACKWARE LINUX,INC.WASAWARE OFTHE TRADEMARK CLAIM,THE DESIGNATIONSHAVE BEEN FOLLOWED BY THE ORTHE SYMBOL .

1571763384 [SplitHTML/SingleHTML] TableofContents

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.

Chapter18,SlackwarePackageManagement DescribestheSlackwarepackageutilitiesandtheprocessusedtocreatecustompackagesand tagfiles. Chapter19,ZipSlack DescribestheZipSlackversionofLinuxthatcanbeusedfromWindowswithoutrequiringan installation. AppendixA,TheGNUGeneralPublicLicense DescribesthelicensetermsunderwhichSlackwareLinuxandthisbookcanbecopiedand distributed.

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

Examplesstartingwith#indicateacommandthatmustbeinvokedasthesuperuserinSlackware.You canloginasroottotypethecommand,orloginasyournormalaccountandusesu(1)togain superuserprivileges.


#ddif=bare.iof=/dev/fd0

Examplesstartingwith%indicateacommandthatshouldbeinvokedfromanormaluseraccount. Unlessotherwisenoted,Cshellsyntaxisusedforsettingenvironmentvariablesandothershell commands.


%top

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,

includingHP/Compaq'sAlpha,Sun'sSPARCandUltraSPARC,andMotorola'sPowerPCchips (throughAppleMacintoshandIBMRS/6000computers.)Hundreds,ifnotthousands,ofprogrammers allovertheworldnowdevelopLinux.ItrunsprogramslikeSendmail,Apache,andBIND,whichare verypopularsoftwareusedtorunInternetservers.It'simportanttorememberthatthetermLinux reallyreferstothekernelthecoreoftheoperatingsystem.Thiscoreisresponsibleforcontrollingyour computer'sprocessor,memory,harddrives,andperipherals.That'sallLinuxreallydoes:Itcontrolsthe operationsofyourcomputerandmakessurethatallofitsprogramsbehave.Variouscompaniesand individualsbundlethekernelandvariousprogramstogethertomakeanoperatingsystem.Wecalleach bundleaLinuxdistribution.

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

notthesamething.TheFreeSoftwareFoundationusesaspecificlicenseandprovidessoftwareunder thatlicense.TheOpenSourceInitiativeseekssupportforallopensourcelicenses,includingtheone fromtheFreeSoftwareFoundation.Thegroundsonwhicheacharguesformakingsourcecodefreely availablesometimesdividesthetwomovements,butthefactthattwoideologicallydiversegroupsare workingtowardthesamegoallendscredencetotheeffortsofeach.

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)

Inadditiontoman(1),therearethecommandswhatis(1)andapropos(1)availabletoyou,whose sharedpurposeistomakeiteasiertofindinformationinthemansystem. Thecommandwhatisgivesaverybriefdescriptionofsystemcommands,somewhatinthestyleofa pocketcommandreference. Example:


%whatiswhatis whatis(1)searchthewhatisdatabaseforcompletewords

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

Where$programisthenameoftheprogramyouarewantingtoreadabout,and$versionis (obviously)theappropriateversionofsoftwarepackageinstalledonyoursystem. Forexample,toreadthedocumentationforthecommandman(1)youwouldwanttocdto:


%cd/usr/doc/man$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:support@slackware.com.Otheremailaddressesand contactinformationarelistedonthewebsite. 2.2.2.1SlackwareLinuxProjectMailingLists Wehaveseveralmailinglists,availableindigestandnormalforms.Checktheinstructionsforhowto subscribe. Tosubscribetoamailinglist,email: majordomo@slackware.com 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

Telephone 1(925)6740783 Website http://store.slackware.com Email orders@slackware.com Postal 1164ClaremontDrive,Brentwood,CA94513

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.

TherearemoreSlackwarebootdisksthanyoucanshakeastickat(whichistosayabout16).A completelistofbootdisks,withadescriptionofeach,isavailableintheSlackwaredistributiontreein thefilebootdisks/README.TXT.However,mostpeopleareabletousethebare.i(forIDEdevices) orscsi.s(forSCSIdevices)bootdiskimage. SeeSection3.2.6forinstructionsonmakingadiskfromanimage. Afterbooting,youwillbepromptedtoinserttherootdisk.Werecommendthatyoujusthumorthe bootdiskandplayalong.

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

Ifyou'rerunningaMicrosoftOS,you'llneedtousetheRAWRITE.EXEprogram,whichisincludedinthe distributiontreeinthesamedirectoriesasthefloppyimages.Againassumingthatbare.iisyourdisk imagefileandyourfloppydriveisA:,openaDOSpromptandtypethefollowing:


C:\rawritea:bare.i

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

Thiswilldisplayallsortsofinformationaboutyourcurrentpartitions.Mostpeoplepickafreedriveto installtoandthenremoveanyexistingpartitionsonittocreateroomfortheLinuxpartitions. ITISVERYIMPORTANTTHATYOUBACKUPANYINFORMATIONYOUWANT TOSAVEBEFOREDESTROYINGTHEPARTITIONITLIVESON. Thereisnoeasywaytorecoverfromdeletingapartition,soalwaysbackupbeforeplayingwiththem. Lookingatthetableofpartitioninformationyoushouldseeapartitionnumber,thesizeofthepartition, anditstype.There'smoreinformation,butdon'tworryaboutthatfornow.Wearegoingtodeleteallof thepartitionsonthisdrivetocreatetheLinuxones.Werunthedcommandtodeletethose:


Command(mforhelp):d Partitionnumber(14):1

Thisprocessshouldbecontinuedforeachofthepartitions.Afterdeletingthepartitionswearereadyto createtheLinuxones.Wehavedecidedtocreateonepartitionforourrootfilesystemandonefor swap.ItisworthnotingthatUnixpartitioningschemesarethesubjectofmanyflamewars,andthat mostuserswilltellyouthebestwaytodoit.Ataminimum,youshouldcreateonepartitionfor/and oneforswap.Overtime,you'lldevelopamethodthatworkswellforyou. Iusetwobasicpartitionschemes.Thefirstisforadesktop.Imake4partitions,/,/home, /usr/local,andswap.Thisletsmereinstallorupgradetheentireinstallationunder/withoutwiping outmydatafilesunder/homeormycustomcompiledapplicationsunder/usr/local.Forservers,I oftenreplacethe/usr/localpartitionwitha/varpartition.Manydifferentserversstoreinformation

onthatpartitionandhavingitkeptseparatefrom/hascertainperformancebenefits.Fornow,we're stickingwithjusttwopartitions:/andswap. Nowwecreatethepartitionswiththencommand:


Command(mforhelp):n Commandaction eextended pprimarypartition(14) p Partitionnumber(14):1 Firstcylinder(01060,default0):0 Lastcylinderor+sizeor+sizeMor+sizeK(01060,default1060):+64M

Youneedtomakesureyoucreateprimarypartitions.Thefirstpartitionisgoingtobeourswap partition.Wetellfdisktomakepartitionnumber1aprimarypartition.Westartitatcylinder0andfor theendingcylinderwetype+64M.Thiswillgiveusa64megabytepartitionforswap.(Thesizeofthe swappartitionyouneedactuallydependsontheamountofRAMyouhave.Itisconventionalwisdom thataswapspacedoublethesizeofyourRAMshouldbecreated.)Thenwedefineprimarypartition number2startingatthefirstavailablecylinderandgoingallthewaytotheendofthedrive.


Command(mforhelp):n Commandaction eextended pprimarypartition(14) p Partitionnumber(14):2 Firstcylinder(1241060,default124):124 Lastcylinderor+sizeor+sizeMor+sizeK(1241060,default1060):1060

Wearealmostdone.Weneedtochangethetypeofthefirstpartitiontotype82(Linuxswap).Typet tochangethetype,selectthefirstpartition,andtype82.Beforewritingyourchangestothedisk,you shouldlookatthenewpartitiontableonelasttime.Usethepinfdisktodisplaythepartitiontable.If everythinglooksgood,typewtowriteyourchangestothediskandquitfdisk.

3.4ThesetupProgram
Onceyouhavecreatedyourpartitions,youarereadytoinstallSlackware.Thenextstepinthe installationprocessisrunningthesetup(8)program.Todoso,simplytypesetupattheshellprompt. setupisamenudrivensystemforactuallyinstallingtheSlackwarepackagesandconfiguringyour system.

Thesetupprocessgoessomethinglikethis:Youstepthrougheachoptioninthesetupprogram,inthe ordertheyarelisted.(Ofcourse,youarefreetodothingsinalmostanyorderyouchoose,butchances areitisn'tgoingtoworkoutverywell.)Menuitemsareselectedusingtheupanddownarrowkeys, andtheOkayandCancelbuttonscanbechosenbyusingtheleftandrightarrowkeys. Alternatively,eachoptionhasacorrespondingkey,whichishighlightedintheoptionname.Options whichareflaggable(thoseindicatedwitha[X])aretoggledusingthespacebar. Ofcourse,allofthatisdescribedinthehelpsectionofsetup,butwebelieveingivingourreaders theirmoney'sworth.

3.4.1HELP
IfthisisyourfirsttimeinstallingSlackware,youmightwanttotakealookatthehelpscreen.Itwillgive adescriptionofeachpartofsetup(muchliketheonewe'rewritingnow,butlessinvolved)and instructionsfornavigatingtherestoftheinstall.

3.4.2KEYMAP
IfyourequireakeymapotherthantheUnitedStatesqwertylayout,youmaywanttotakealookat thissection.Itoffersanumberofalternatelayoutsforyourkeyboardingenjoyment.

3.4.3ADDSWAP

Ifyoucreatedaswappartition(backinSection3.3),thissectionwillallowyoutoenableit.Itwill autodetectanddisplaytheswappartitionsonyourharddrive,allowingyoutoselectonetoformatand enable.

3.4.4TARGET

Thetargetsectioniswhereyourother(nonswap)partitionsareformattedandmappedtofilesystem

mountpoints.Alistofthepartitionsonyourharddiskwillbedisplayed.Foreachpartition,youwillbe giventheoptionofwhethertoformatthatpartitionornot.Dependingonthekernelused,youcan choosebetweenreiserfs(thedefault),ext3,ext2,jfs,andxfs.Mostpeopleuseeitherreiserfsorext3.In thenearfuturewemayseesupportforreiserfs4slipin. Thefirstoptioninthetargetsectionistheselectionofapartitiononwhichtoinstallyourroot(/) filesystem.Afterthat,youwillbeabletomapotherpartitionstofilesystemsasyouchoose.(For instance,youmaywantyourthirdpartition,say/dev/hda3,tobeyourhomefilesystem.Thisisjustan examplemapthepartitionsasyouseefit.)

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.

Notethatitispossibletorunoutofspacewhileinstalling.Ifyouselectedtoomanypackagesforthe amountoffreespaceonthetargetdevice,youwillhaveproblems.Thesafestthingtodoistoselect somesoftwareandaddmorelater,ifyouneedit.ThiscaneasilybedoneusingSlackware'spackage managementtools.Forthisinformation,seeChapter18.

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.

3.4.8.2Makeabootdisk Makingabootdiskforfutureuseisprobablyagoodidea.Youwillhavetheoptionofformattinga floppyandthencreatingoneoftwotypesofbootdisk.Thefirsttype,simple,simply(gofigure)writes akerneltothefloppy.Amoreflexible(andhighlyrecommended)optionislilo,whichwillofcourse createalilobootdisk.SeeLILOinSection7.1formoreinformation.Ofcourse,youmayalsochoose tosimplycontinue,inwhichcasenobootdiskwillbemade.

3.4.8.3Modem Youwillbepromptedformodeminformation.Morespecifically,youwillbeaskedwhetheryouhavea modem,andifso,whatserialportitison.

Thesenextconfigurationsubsectionsmayormaynotappear,dependingonwhetherornotyouinstalled theircorrespondingpackages.

3.4.8.4Timezone Thisone'sprettystraightforward:youwillbeaskedwhattimezoneyouarein.IfyouoperateonZulu time,weareverysorrythe(extremelylong)listisalphabeticallyordered,andyou'reatthebottom.

3.4.8.5Mouse Thissubsectionsimplyaskswhatkindofmouseyouhave,andwhetheryouwantgpm(8)console mousesupportenabledonbootup.

3.4.8.6Hardwareclock Thissubsectionasksifyourcomputer'shardwareclockissettoCoordinatedUniversalTime(UTCor GMT).MostPCsarenot,soyoushouldprobablysayno.

3.4.8.7Font

Thefontsubsectionallowsyoutochoosefromalistofcustomconsolefonts.

3.4.8.8LILO HereyouarepromptedforinstallationofLILO(theLInuxLOaderseeSection7.1formore information).

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.

Nomatterwhichpackagesyouinstalled,thelastthingconfigurewilldoisaskyouwhetheryouwantto goaheadandsetarootpassword.Forsecurityreasons,thisisprobablyagoodideahowever,like almosteverythingelseinSlackware,thisisyourcall.

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

Essentialuserprogramsarestoredhere.Theserepresentthebareminimumsetofprograms requiredforausertousethesystem.Thingsliketheshellandthefilesystemcommands(ls,cp, andsoon)arestoredhere.The/bindirectoryusuallydoesn'treceivemodificationafter installation.Ifitdoes,it'susuallyintheformofpackageupgradesthatweprovide.


boot

FilesthatareusedbytheLinuxLoader(LILO).Thisdirectoryalsoreceiveslittlemodification afteraninstallation.ThekernelisstoredhereasofSlackware8.1.Inearlierreleasesof Slackware,thekernelwassimplystoredunder/,butcommonpracticeistoputthekerneland relatedfilesheretofacilitatedualbooting.


dev

EverythinginLinuxistreatedasafile,evenhardwaredeviceslikeserialports,harddisks,and scanners.Inordertoaccessthesedevices,aspecialfilecalledadevicenodehastobepresent. Alldevicenodesarestoredinthe/devdirectory.YouwillfindthistobetrueacrossmanyUnix likeoperatingsystems.


etc

Thisdirectoryholdssystemconfigurationfiles.EverythingfromtheXWindowconfigurationfile, theuserdatabase,tothesystemstartupscripts.Thesystemadministratorwillbecomequite familiarwiththisdirectoryovertime.


home

Linuxisamultiuseroperatingsystem.Eachuseronthesystemisgivenanaccountandaunique directoryforpersonalfiles.Thisdirectoryiscalledtheuser'shomedirectory.The/home directoryisprovidedasthedefaultlocationforuserhomedirectories.


lib

Systemlibrariesthatarerequiredforbasicoperationarestoredhere.TheClibrary,thedynamic loader,thencurseslibrary,andkernelmodulesareamongthethingsstoredhere.
mnt

Thisdirectorycontainstemporarymountpointsforworkingonharddisksorremovabledrives. Hereyou'llfindmountpointsforyourCDROMandfloppydrives.
opt

Optionalsoftwarepackages.Theideabehind/optisthateachsoftwarepackageinstallsto /opt/softwarepackage,whichmakesiteasytoremovelater.Slackwaredistributessome thingsin/opt(suchasKDEin/opt/kde),butyouarefreetoaddanythingyouwantto/opt.


proc

Thisisauniquedirectory.It'snotreallypartofthefilesystem,butavirtualfilesystemthat providesaccesstokernelinformation.Variouspiecesofinformationthatthekernelwantsyouto knowareconveyedtoyouthroughfilesinthe/procdirectory.Youcanalsosendinformationto thekernelthroughsomeofthesefiles.Trydoingcat/proc/cpuinfo.


root

Thesystemadministratorisknownasrootonthesystem.root'shomedirectoryiskeptin /rootinsteadof/home/root.Thereasonissimple.Whatif/homewasadifferentpartition from/anditcouldnotbemounted?rootwouldnaturallywanttologinandrepairtheproblem. Ifhishomedirectorywasonthedamagedfilesystem,itwouldmakeitdifficultforhimtologin.


sbin

Essentialprogramsthatarerunbyrootandduringthesystembootupprocessarekepthere. Normaluserswillnotrunprogramsinthisdirectory.
tmp

Thetemporarystoragelocation.Allusershavereadandwriteaccesstothisdirectory.
usr

ThisisthebigdirectoryonaLinuxsystem.Everythingelseprettymuchgoeshere,programs, documentation,thekernelsourcecode,andtheXWindowsystem.Thisisthedirectorytowhich youwillmostlikelybeinstallingprograms.


var

Systemlogfiles,cachedata,andprogramlockfilesarestoredhere.Thisisthedirectoryfor frequentlychangingdata. Youshouldnowhaveagoodfeelforwhichdirectoriescontainwhatonthefilesystem.Moredetailed informationaboutthefilesystemlayoutisavailableinthehier(7)manpage.Thenextsectionwillhelp

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

Fromthatyouseethatbashisinthe/bindirectory.Thisisaverylimitedcommandforsearching, sinceitonlysearchesyourPATH. 4.1.2.2whereis Thewhereis(1)commandworkssimilartowhich,butcanalsosearchformanpagesandsourcefiles. Awhereissearchforbashshouldreturnthis:


%whereisbash bash:/bin/bash/usr/bin/bash/usr/man/man1/bash.1.gz

Thiscommandnotonlytolduswheretheactualprogramislocated,butalsowheretheonline documentationisstored.Still,thiscommandislimited.Whatifyouwantedtosearchforaspecific configurationfile?Youcan'tusewhichorwhereisforthat. 4.1.2.3find Thefind(1)commandallowstheusertosearchthefilesystemwitharichcollectionofsearch predicates.Usersmayspecifyasearchwithfilenamewildcards,rangesofmodificationorcreation times,orotheradvancedproperties.Forexample,tosearchforthedefaultxinitrcfileonthesystem, thefollowingcommandcouldbeused.


%find/namexinitrc /var/X11R6/lib/xinit/xinitrc findwilltakeawhiletorun,sinceithastotraversetheentirerootdirectorytree.Andifthiscommand isrunasanormaluser,therewillbepermissiondeniederrormessagesfordirectoriesthatonlyroot cansee.Butfindfoundourfile,sothat'sgood.Ifonlyitcouldbeabitfaster...

4.1.2.4slocate

Theslocate(1)commandsearchestheentirefilesystem,justlikethefindcommandcando,butit searchesadatabaseinsteadoftheactualfilesystem.Thedatabaseissettoautomaticallyupdateevery morning,soyouhaveasomewhatfreshlistingoffilesonyoursystem.Youcanmanuallyrun updatedb(1)toupdatetheslocatedatabase(beforerunningupdatedbbyhand,youmustfirstsuto therootuser).Here'sanexampleofslocateinaction:


%slocatexinitrc#wedon'thavetogototheroot /var/X11R6/lib/xinit/xinitrc /var/X11R6/lib/xinit/xinitrc.fvwm2 /var/X11R6/lib/xinit/xinitrc.openwin /var/X11R6/lib/xinit/xinitrc.twm

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

LooksforSystemVinitscriptsforthedesiredrunlevelandrunsthem.Thisisdiscussedinmore detailbelow. 4.1.3.2RunlevelInitializationScripts Aftersysteminitializationiscomplete,initmovesontorunlevelinitialization.Arunleveldescribesthe statethatyourmachinewillberunningin.Soundredundant?Well,therunleveltellsinitifyouwillbe acceptingmultiuserloginsorjustasingleuser,whetherornotyouwantnetworkservices,andifyouwill beusingtheXWindowSystemoragetty(8)tohandlelogins.Thefilesbelowdefinethedifferent runlevelsinSlackwareLinux.


rc.0

Haltthesystem(runlevel0).Bydefault,thisissymlinkedtorc.6.
rc.4

Multiuserstartup(runlevel4),butinX11withKDM,GDM,orXDMastheloginmanager.
rc.6

Rebootthesystem(runlevel6).
rc.K

Startupinsingleusermode(runlevel1).
rc.M

Multiusermode(runlevels2and3),butwiththestandardtextbasedlogin.Thisisthedefault runlevelinSlackware. 4.1.3.3NetworkInitialization Runlevels2,3,and4willstartupthenetworkservices.Thefollowingfilesareresponsibleforthe networkinitialization:


rc.inet1

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

Startsupgeneralpurposemouseservices.AllowsyoutocopyandpasteattheLinuxconsole. Occasionally,gpmwillcauseproblemswiththemousewhenitisusedunderXwindows.Ifyou experienceproblemswiththemouseunderX,trytakingawaytheexecutablepermissionfrom thisfileandstoppingthegpmserver.


rc.font

Loadsthecustomscreenfontfortheconsole.
rc.local

Containsanyspecificstartupcommandsforyoursystem.Thisisemptyafterafreshinstall,asitis reservedforlocaladministrators.Thisscriptisrunafterallotherinitializationhastakenplace. Toenableascript,allyouneedtodoisaddtheexecutepermissionstoitwiththechmodcommand.To disableascript,removetheexecutepermissionsfromit.Formoreinformationaboutchmod,see Section9.2.

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

Purpose Thesystemmapfileforthiskernel Theactualkernelimage Thesourceconfigurationfileforthiskernel

Touseakernel,copytheSystem.mapandconfigfilestoyour/bootdirectoryandcopythekernel imageto/boot/vmlinuz.Run/sbin/lilo(8)toinstallLILOforthenewkernel,andthenreboot yoursystem.That'sallthereistoinstallinganewkernel. Thekernelsthatendwitha.iareIDEkernels.Thatis,theyincludenoSCSIsupportinthebasekernel. Thekernelsthatendwith.sareSCSIkernels.TheyincludealltheIDEsupportin.ikernels,plusSCSI support.

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

Nowyoucanconfigurethekernelforyoursystem.Thecurrentkerneloffersthreewaysofdoingthis. Thefirstistheoriginaltextbasedquestionandanswersystem.Itasksabunchofquestionsandthen buildsaconfigurationfile.Theproblemwiththismethodisthatifyoumessup,youmuststartover.The methodthatmostpeoplepreferisthemenudrivenone.Lastly,thereisanXbasedkernelconfiguration tool.Picktheoneyouwantandissuetheappropriatecommand:


#makeconfig(textbasedQ&Aversion) #makemenuconfig(menudriven,textbasedversion) #makexconfig(Xbasedversion,makesureyouareinXfirst)

Figure41.KernelConfigurationMenu

Newuserswillprobablyfindmenuconfigtobetheeasiesttouse.Helpscreensareprovidedthat explainthevariouspartsofthekernel.Afterconfiguringyourkernel,exittheconfigurationprogram.It willwritethenecessaryconfigurationfiles.Nowwecanpreparethesourcetreeforabuild:


#makedep #makeclean

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

connectionifyouwillletit.NotethatIwouldstronglysuggestthatyoureviewyourconfigfilefora coupleofreasons: 1. Youshouldnevertrustasetupprogramtoproperlyconfigureyourcomputer.Ifyouusea setupprogram,youshouldreviewtheconfigurationyourself. 2. IfyouarestilllearningSlackwareandLinuxsystemmanagement,viewingaworking configurationcanbehelpful.You'llatleastknowwhattheconfigurationshouldlooklike. Thiswillallowyoutocorrectproblemsduetomisconfigurationofthesystematalaterdate.

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)

Ifyoujusttyped/sbin/ifconfigwithouttheasuffix,youwouldnotseetheeth0interface,asyour networkcarddoesnotyethaveavalidIPaddressorroute. Whiletherearemanydifferentwaystosetupandsubnetanetwork,allofthemcanbebrokendown intotwotypes:StaticandDynamic.Staticnetworksaresetupsuchthateachnode(geeklingoforthing withanIPaddress)alwayshasthesameIPaddress.Dynamicnetworksaresetupinsuchawaythat theIPaddressesforthenodesarecontrolledbyasingleservercalledtheDHCPserver.

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=""

Inthiscase,ourtaskismerelytoplacethecorrectinformationbetweenthedoublequotes.These variablesarecalledby/etc/rc.d/rc.inet1atboottimetosetupthenics.ForeachNIC,justenter thecorrectIPinformation,orputYESforUSE_DHCP.Slackwarewillstartuptheinterfaceswiththe informationplacedhereintheordertheyarefound. TheDEFAULT_GWvariablesetsupthedefaultrouteforSlackware.Allcommunicationsbetween yourcomputerandothercomputersontheInternetmustpassthroughthatgatewayifnootherrouteis specifiedforthem.IfyouareusingDHCP,youwillusuallynotneedtoenteranythinghere,asthe DHCPserverwillspecifywhatgatewaytouse.

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

Thefirstlineissimple.ThenameserverdirectivetellsuswhatDNSserverstoquery.Bynecessitythese arealwaysIPaddresses.Youmayhaveasmanylistedthereasyoulike.Slackwarewillhappilycheck oneaftertheotheruntilonereturnsamatch. Thesecondlineisalittlemoreinteresting.Thesearchdirectivegivesusalistofdomainnamesto assumewheneveraDNSrequestismade.Thisallowsyoutocontactamachinebyonlythefirstpartof itsFQDN(FullyQualifiedDomainName).Forexample,ifslackware.comwereinyoursearchpath, youcouldreachhttp://store.slackware.combyjustpointingyourwebbrowserat http://store.


#pingc1store PINGstore.slackware.com(69.50.233.153):56databytes 64bytesfrom69.50.233.153:icmp_seq=0ttl=64time=0.251ms 1packetstransmitted,1packetsreceived,0%packetloss roundtripmin/avg/max=0.251/0.251/0.251ms

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

yourmodemdevice,themodeminitializationstring,andtheISPphonenumber.Someitemswillhavea default,whichyoucanacceptinmostcases. Aftertheprogramruns,itwillcreateapppgoprogramandapppoffprogram.Theseareusedto startandstop,respectively,thePPPconnection.Thetwoprogramsarelocatedin/usr/sbinand needrootprivilegestorun.

5.4.2/etc/ppp
Formostusers,runningpppsetupwillbesufficient.However,theremaybeaninstancewhereyou wanttotweaksomeofthevaluesusedbythePPPdaemon.Alloftheconfigurationinformationiskept in/etc/ppp.Hereisalistofwhatthedifferentfilesarefor:
ipdown

ThisscriptisrunbypppdafterthePPPconnectionisended. Thisscriptisrunbypppdwhenthere'sasuccessfulpppconnection.Putany commandsyouwantrunafterasuccessfulconnectioninthisfile. Generalconfigurationoptionsforpppd. Generalconfigurationoptionsforpppdwhenrunindemanddialingmode. Thecommandssenttothemodem. Alogofwhatyouenteredwhenyouranpppsetup.

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.

Nowthatyou'veseenhowtoedit/etc/rc.d/rc.wirelessforyoudefaultnetwork,let'stakea closerlookatiwconfigandseehowitallworks.Thiswillteachyouthequickanddirtywayofsetting upwififorthosetimeswhenyoufindyourselfatanInternetcafe,coffeeshop,oranyotherwifihotspot andwishtogetonline. ThefirststepistotellyourwirelessNICwhatnetworktojoin.Makesureyoureplaceeth0with whatevernetworkinterfaceyourwirelesscardusesandchangemynetworktotheessidyouwishto use.Yes,weknowyou'resmarterthanthat.Nextyou'llhavetospecifytheencryptionkey(ifany)used onyourwirelessnetwork.Finallyspecifythechanneltouse(ifneeded).


#iwconfigeth0essid"mynetwork" #iwconfigeth0keyXXXXXXXXXXXXXXXXXXXXXXXXXXX #iwconfigeth0channeln

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

becauseWindowssupportsit. Samba'sconfigurationfileis/etc/samba/smb.confoneofthemostwellcommentedand documentedconfigurationfilesyouwillfindanywhere.Sampleshareshavebeensetupforyoutoview andmodifyforyourneeds.Ifyouneedeventightercontrolthemanpageforsmb.confisindispensable. SinceSambaisdocumentedsowellintheplacesI'vementionedabove,wewillnotrewritethe documentationhere.Wewill,however,quicklycoverthebasics.


smb.confisbrokendownintomultiplesections:onesectionpershare,andaglobalsectionforsetting

optionsthataretobeusedeverywhere.Someoptionsareonlyvalidintheglobalsectionsomeareonly validoutsidetheglobalsection.Rememberthattheglobalsectioncanbeoverriddenbyanyother section.Refertothemanpagesformoreinformation. Youwillmostlikelywishtoedityoursmb.conffiletoreflectthenetworksettingsinyourLAN.I wouldsuggestmodifyingtheitemslistedbelow:


[global] #workgroup=NTDomainNameorWorkgroupName,eg:LINUX2 workgroup=MYGROUP

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

Ifencryptpasswordsisnotenabled,youwillnotbeabletouseSambawithNT4.0,Win2k,WinXP, andWin2003.EarlierWindowsoperatingsystemsdidnotrequireencryptiontosharefiles. SMBisanauthenticatedprotocol,meaningyoumustsupplyacorrectusernameandpasswordinorder tousethisservice.Wetellthesambaserverwhatusernamesandpasswordsarevalidwiththe smbpasswdcommand.smbpasswdtakesacoupleofcommonswitchestotellittoeitheraddtraditional users,oraddmachineusers(SMBrequiresthatyouaddthecomputers'NETBIOSnamesasmachine users,restrictingwhatcomputersonecanauthenticatefrom).

Addingausertothe/etc/samba/private/smbpasswdfile. #smbpasswdauser Addingamachinenametothe/etc/samba/private/smbpasswdfile. #smbpasswdammachine

It'simportanttonotethatagivenusernameormachinenamemustalreadyexistinthe/etc/passwd file.Youcanaccomplishthissimplywiththeaddusercommand.Notethatwhenusingtheadduser commandtoaddamachinenameonemustappendadollarsign($)tothemachinename.Thisshould nothowever,bedonewithsmbpasswd.smbpasswdappendsthedollarsignonitsown.Failingto manglethemachinenamethiswaywithadduserwillresultinanerrorwhenaddingthemachinename tosamba.


#addusermachine$

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)

Asyoucansee,therearevariousoptionsavailable,butmostshouldbefairlyclearfromthisexample. NFSworksundertheassumptionthatagivenuserononemachineinanetworkhasthesameuserID onallmachinesacrossthenetwork.WhenanattemptismadetoreadorwritefromaNFSclienttoan NFSserver,aUIDispassedaspartoftheread/writerequest.ThisUIDistreatedthesameasifthe read/writerequestoriginatedonthelocalmachine.Asyoucansee,ifonecouldarbitrarilyspecifya givenUIDwhenaccessingresourcesonaremotesystem,BadThings(tm)couldandwouldhappen.As apartialhedgeagainstthis,eachdirectoryismountedwiththeroot_squashoption.ThismapstheUID foranyuserclaimingtoberoottoadifferentUID,thuspreventingrootaccesstothefilesorfoldersin theexporteddirectory.root_squashseemstobeenabledbydefaultasasecuritymeasure,butthe

authorsrecommendspecifyingitanywayinyour/etc/exportsfile. Youcanalsoexportadirectorydirectlyfromthecommandlineontheserverbyusingtheexportfs commandasfollows:


#exportfsorw,no_root_squashBar:/home/foo

Thislineexportsthe/home/foodirectorytothecomputerBarandgrantsBarread/writeaccess. Additionally,theNFSserverwillnotinvokeroot_squash,whichmeansanyuseronBarwithaUIDof 0(root'sUID)willhavethesameprivilegesasrootontheserver.Thesyntaxdoeslookstrange (usuallywhenadirectoryisspecifiedincomputer:/directory/filesyntax,youarereferringtoafileina directoryonagivencomputer). You'llfindmoreinformationonthemanpagefortheexportsfile.

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

Thiswillpresentascreenfulofinformationaboutxorgconfig.Tocontinue,pressENTER. xorgconfigwillaskyoutoverifyyouhavesetyourPATHcorrectly.Itshouldbefine,sogoaheadand hitENTER. Figure61.xorgconfigMouseConfiguration

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

Inthenextsectionyouenterthesyncrangeforyourmonitor.Tostartconfiguringyourmonitor,press ENTER.Youwillseealistofmonitortypeschooseoneofthem.Becarefulnottoexceedthe specificationsofyourmonitor.Doingsocoulddamageyourhardware. Figure63.xorgconfigVerticalSync

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

Ifyou'vealreadygotan/etc/X11/xorg.conffile(becauseyou'vealreadyconfiguredX),you'llbe askedifyouwanttobackuptheexistingconfigfilebeforecontinuing.Theoriginalfilewillberenamedto /etc/X11/xorg.conf.backup.

6.3xinitrc
xinit(1)istheprogramthatactuallystartsXitiscalledbystartx(1),soyoumaynothavenoticedit

(andprobablydon'treallyneedto).Itsconfigurationfile,however,determineswhichprograms (includingandespeciallythewindowmanager)arerunwhenXstartsup.xinitfirstchecksyourhome directoryfora.xinitrcfile.Ifthefileisfound,itgetsrunotherwise, /var/X11R6/lib/xinit/xinitrc(thesystemwidedefault)isused.Here'sasimplexinitrcfile:


#!/bin/sh #$XConsortium:xinitrc.cpp,v1.491/08/2211:41:34rwsExp$ userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/usr/X11R6/lib/X11/xinit/.Xresources sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap #mergeindefaultsandkeymaps if[f$sysresources]then xrdbmerge$sysresources fi if[f$sysmodmap]then xmodmap$sysmodmap fi if[f$userresources]then xrdbmerge$userresources fi if[f$usermodmap]then xmodmap$usermodmap fi #startsomeniceprograms twm& xclockgeometry50x501+1& xtermgeometry80x50+494+51& xtermgeometry80x20+4940& execxtermgeometry80x66+0+0namelogin

Allofthoseifblocksaretheretomergeinvariousconfigurationsettingsfromotherfiles.The interestingpartofthefileistowardtheend,wherevariousprogramsarerun.ThisXsessionwillbegin withthetwm(1)windowmanager,aclock,andthreeterminals.Notetheexecbeforethelastxterm. Whatthatdoesisreplacethecurrentlyrunningshell(theonethat'sexecutingthisxinitrcscript)with thatxterm(1)command.Whentheuserquitsthatxterm,theXsessionwillend. TocustomizeyourXstartup,copythedefault/var/X11R6/lib/xinit/xinitrcto~/.xinitrc andeditit,replacingthoseprogramlineswithwhateveryoulike.Theendofmineissimply:

#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

You'llbegivenalistofallthedesktopsandwindowmanagersinstalled.Justselecttheoneyouwant fromthelist.Eachuseronyoursystemwillneedtorunthisprogram,sincedifferentuserscanuse differentdesktops,andnoteveryonewillwantthedefaultoneyouselectedatinstallation. ThenjuststartupX,andyou'regoodtogo.

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

tologinasanyuser,andchoosewhatdesktopyouwishtouse. Unfortunately,Slackwaredoesn'tincludeaniceprogramlikexwmconfigforchoosingwhatlogin managertouse,soifallthreeareinstalledyoumayhavetodosomeeditingtochooseyourpreference. Butfirst,we'lldiscusshowtobootintoagraphicalenvironment. InordertostartXatboot,youneedtobootintorunlevel4.Runlevelsarejustawayoftelling init(8)todosomethingdifferentwhenitstartstheOS.Wedothisbyeditingtheconfigfileforinit, /etc/inittab.

#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:

NowSlackwarewillbootintorunlevel4andexecute/etc/rc.d/rc.4.ThisfilestartsupXandcalls whateverloginmanageryou'vechosen.So,howdowechooseloginmanagers?Thereareafewways todothis,andI'llexplainthemafterwelookatrc.4.


#TrytouseGNOME'sgdmsessionmanager: if[x/usr/bin/gdm]then exec/usr/bin/gdmnodaemon fi #Notthere?OK,trytouseKDE'skdmsessionmanager: if[x/opt/kde/bin/kdm]then exec/opt/kde/bin/kdmnodaemon fi #IfallyouhaveisXDM,Iguessitwillhavetodo: if[x/usr/X11R6/bin/xdm]then exec/usr/X11R6/bin/xdmnodaemon fi

Asyoucanseehere,rc.4firstcheckstoseeifgdmisexecutable,andifsorunsit.Secondonthelistis kdm,andfinallyxdm.Onewayofchoosingaloginmanageristosimplyremovetheonesyoudon'twish touseusingremovepkg.YoucanfindoutmoreaboutremovepkginChapter18. Optionally,youcanremovetheexecutablepermissionfromthosefilesthatyoudon'twanttouse.We discusschmodinChapter9.


#chmodx/usr/bin/gdm

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

exec/opt/kde/bin/kdmnodaemon fi #IfallyouhaveisXDM,Iguessitwillhavetodo: if[x/usr/X11R6/bin/xdm]then exec/usr/X11R6/bin/xdmnodaemon fi

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

YouwillwanttousethismethodifSlackwareistheonlyoperatingsystemonyourcomputer,or ifyouwillbeusingLILOtochoosebetweenmultipleoperatingsystemsonyourcomputer.This isthemostpreferredmethodforinstallingLILOandwillworkwithalmostanycomputersystem. ThisoptionwilloverwriteanyotherbooteryouhaveintheMBR. Afterselectingtheinstallationlocation,liloconfigwillwritetheconfigurationfileandinstallLILO. That'sit.Ifyouselecttheexpertmodeyouwillreceiveaspecialmenu.Thismenuallowsyoutotweak the/etc/lilo.conffile,addotheroperatingsystemstoyourbootmenu,andsetLILOtopass specialkernelparametersatboottime.Theexpertmenulookslikethis: Figure72.liloconfigExpertMenu

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

addedtoyourAUTOEXEC.BATfilethatwouldallowyoutopickbetweenLinuxorDOS.Achoiceof LinuxwouldrunLOADLIN,thusbootingyourSlackwaresystem.ThisAUTOEXEC.BATfileunder Windows95willprovideasufficientbootmenu:


@ECHOOFF SETPROMPT=$P$G SETPATH=C:\WINDOWSC:\WINDOWS\COMMANDC:\ CLS ECHOPleaseSelectYourOperatingSystem: ECHO. ECHO[1]SlackwareLinux ECHO[2]Windows95 ECHO. CHOICE/C:12"Selection?>" IFERRORLEVEL2GOTOWIN IFERRORLEVEL1GOTOLINUX :WIN CLS ECHOStartingWindows95... WIN GOTOEND :LINUX ECHOStartingSlackwareLinux... CD\LINUX LOADLINC:\LINUX\VMLINUZROOT=<rootpartitiondevice>RO GOTOEND :END

YouwillwanttospecifyyourrootpartitionasaLinuxdevicename,like/dev/hda2orsomethingelse. YoucanalwaysuseLOADLINatthecommandline.Yousimplyuseitinthesamemannerasitisinthe exampleabove.TheLOADLINdocumentationcomeswithmanyexamplesonhowtouseit.

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

MostpeoplewillwanttouseLILOtochosebetweenLinuxandWindows.Asstatedabove,you shouldinstallWindowsfirst,thenLinux. Let'ssayyouhavea40GBIDEharddiskastheonlydriveinyoursystem.Let'salsosaythatyouwant togivehalfofthatspacetoWindowsandhalfofthatspacetoLinux.Thiswillpresentaproblemwhen tryingtobootLinux.


20GBWindowsboot(C:) 1GBLinuxroot(/) 19GBLinux/usr(/usr)

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

#mounttvfat/dev/hda1/win #mkdir/win/linux #cd/root #cploadlin*/win/linux #cp/boot/vmlinuz/win/linux #cd/win/linuz #unziploadlin16a.zip

ThatwillcreateaC:\LINUXdirectoryonyourWindowspartition(assumingit's/dev/hda1)andcopy overthenecessarystuffforLOADLIN.Afterdoingthis,youwillneedtorebootintoWindowstosetup abootmenu. OnceinWindows,gettoaDOSprompt.First,weneedtomakesurethesystemissettonotbootinto thegraphicalinterface.


C:\>cd\ C:\>attribrashMSDOS.SYS C:\>editMSDOS.SYS

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

ThekeylineistheonethatrunsLOADLIN.Wetellitthekerneltoload,theLinuxrootpartition,and thatwewantitmountedreadonlyinitially. ThetoolsforthesetwomethodsareprovidedwithSlackwareLinux.Therearenumerousotherbooters onthemarket,buttheseshouldworkformostdualbootsetups.

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

That'sit.Nowyouneedtocopybootsect.lnxtotheWindowsNTpartition.Here'swhereweruninto anotherproblem.LinuxdoesnothavestablewritesupportfortheNTFSfilesystem.Ifyouinstalled WindowsNTandformattedyourdriveasNTFS,youwillneedtocopythisfiletoaFATfloppyand thenreadfromitunderWindowsNT.IfyouformattedtheWindowsNTdriveasFAT,youcansimply mountitunderLinuxandcopythefileover.Eitherway,youwillwanttoget/tmp/bootsect.lnx fromtheLinuxdrivetoC:\BOOTSECT.LNXontheWindowsNTdrive. ThelaststepisaddingamenuoptiontotheWindowsNTbootmenu.UnderWindowsNTopena commandprompt.


C:\WINNT>cd\ C:\>attribrashboot.ini C:\>editboot.ini

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:

Hmm..nobodysaidanythingaboutalogin.Andwhat'sadarkstar?Don'tworryyouprobablydidn't accidentallyfireupahyperspacecommlinktotheEmpire'sartificialmoon.(I'mafraidthehyperspace commlinkprotocolisn'tcurrentlysupportedbytheLinuxkernel.Maybethe2.8kernelbranchwillat lastprovidethisoftlookedforsupport.)No,darkstarisjustthenameofoneofourcomputers,andits namegetsstampedonasthedefault.Ifyouspecifiedanameforyourcomputerduringsetup,you shouldseeitinsteadofdarkstar. Asforthelogin...Ifthisisyourfirsttime,you'llwanttologinasroot.You'llbepromptedfora passwordifyousetoneduringthesetupprocess,that'swhatit'slookingfor.Ifnot,justhitenter.That's ityou'rein!

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

usethesu(1)command.You'llbeaskedforroot'spasswordandthenitwillmakeyourootuntilyou exitorlogout.Youcanalsobecomeanyotheruserusingsu,providedyouknowthatuser's password:sulogan,forinstance,wouldmakeyoume.


rootisallowedtosutoanyuser,withoutrequiringtheirpassword.

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

matchthat?,soitwouldbeleftout. Anothercommonwildcardisthebracketpair[].Anycharactersinsidethebracketswillbesubstituted inplaceofthe[]tofindmatches.Soundconfusing?It'snottoobad.Supposeforinstance,wehavea directorycontainingthefollowing8files:a1,a2,a3,a4,aA,aB,aC,andaD.Wewanttoonlyfindthe filesendinginnumbers[]willdothisforus.


%lsa[14] a1a2a3a4

Butwhatwereallywantisjusta1,a2,anda4?Inthepreviousexampleweusedtomeanallvalues between1and4.Wecanalsoseparateindividualentrieswithcommas.
%lsa[1,2,4] a1a2a4

Iknowwhatyou'rethinkingnow,Wellwhataboutletters?Linuxiscasesensitive,meaningthataand Aaredifferentcharactersandareonlyrelatedinyourmind.Capitalsalwayscomebeforelowercase letters,soAandBcomebeforeaandb.Continuingwithourearlierexample,ifwewantedfilesa1,and A1,wecanfindthesequicklywith[].


%ls[A,a]1 A1a1

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

Thisisthethirdmostcommonlyusedredirectoritdoesthesamethingas>,exceptthat>>will appendoutputfrompstothefileblargh,ifsaidfileexists.Ifnot,justlike>,itwillbecreated.(> willobliteratethecurrentcontentsofblargh.) Thereisalsoa<operator,whichmeanstakeyourinputfromthefollowing,butit'snotusednearlyso often.


%fromdos<dosfile.txt>unixfile.txt

Redirectiongetsreallyfunwhenyoustartpilingitup:
%ps|tac>>blargh

Thatwillrunps,reversethelinesofitsoutput,andappendthosetothefileblargh.Youcanstackas manyoftheseupasyouwantjustbecarefultorememberthattheygetinterpretedfromlefttoright. Seethebash(1)manpageformoredetailedinformationonredirection.

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

Now,exportistrulyhandy.Usingit,yougivetheenvironmentvariableVARIABLEthevalue some_valueifVARIABLEdidn'texist,itdoesnow.IfVARIABLEalreadyhadavalue,well,it'sgone. That'snotsogood,ifyou'rejusttryingtoaddadirectorytoyourPATH.Inthatcase,youprobablywant todosomethinglikethis:


%exportPATH=$PATH:/some/new/directory

Notetheuseof$PATHthere:whenyouwantbashtointerpretavariable(replaceitwithitsvalue),tack a$ontothebeginningofthevariable'sname.Forinstance,echo$PATHwillechothevalueofPATH,in mycase:


%echo$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

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.

screenalsosupportsdetachingandreattachingtoscreensessionswhichisparticularlyusefulfor remotesessionsviasshandtelnet,(moreonthoselater).Ctrl+A+Dwilldetachfromthecurrently runningscreen.Executingscreenrwilllistallcurrentlyrunningscreensessionsyoumayreattachto.

%screenr Thereareseveralsuitablescreenson: 1212.pts1.redtail(Detached) 1195.pts1.redtail(Detached) 1225.pts1.redtail(Detached) 17146.pts1.sanctuary(Dead???) Removedeadscreenswith'screenwipe'. Type"screen[d]r[pid.]tty.host"toresumeoneofthem.

Runningscreenr1212wouldreattachtothefirstscreenlisted.Imentionedearlierhowusefulthis wasforremotesessions.IfIweretologintoaremoteslackwareserverviassh,andmyconnection wasseveredbysomechanceoccurrencesuchasalocalpowerfailure,whateverIwasdoingatthat momentwouldinstantlyperish,whichcanbeahorriblethingforyourserver.Usingscreenprevents thisbydetachingmysessionifmyconnectionisdropped.Oncemyconnectionisrestored,Ican reattachtomyscreensessionandresumerightwhereIleftoff.

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

Weareinterestedinthethirdandfourthcolumns.Thesecontaintheusernameandgroupnamethat ownsthisfile.Weseethattheuserrootandthegroupbinownthisfile. Wecaneasilychangethefileownerswiththechown(1)(whichmeanschangeowner)andchgrp(1) (whichmeanschangegroup)commands.Tochangethefileownertodaemon,wewouldusechown:


#chowndaemon/usr/bin/wc

Tochangethegroupownertoroot,wewouldusechgrp:
#chgrproot/usr/bin/wc

Wecanalsousechowntospecifytheuserandgroupownersforafile:
#chowndaemon:root/usr/bin/wc

Intheaboveexample,theusercouldhaveusedaperiodinsteadofacolon.Theresultwouldhavebeen thesamehowever,thecolonisconsideredbetterform.Useoftheperiodisdeprecatedandmaybe removedfromfutureversionsofchowntoallowusernameswithperiodsinthem.Theseusernamestend tobeverypopularwithWindowsExchangeServersandareencounteredmostcommonlyinemail addressessuchas:mr.jones@example.com.Inslackware,administratorsareadvisedtostayaway fromsuchusernamesbecausesomescriptsstillusetheperiodtoindicatetheuserandgroupofafileor directory.Inourexample,chmodwouldinterpretmr.jonesasusermrandgroupjones. FileownershipisaveryimportantpartofusingaLinuxsystem,evenifyouaretheonlyuser.You sometimesneedtofixownershipsonfilesanddevicenodes.

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

Thefirstdashwouldbereplacedwithadifthiswasadirectory.Thethreepermissiongroups(owner, group,andworld)aredisplayednext.Weseethattheownerhasread,write,andexecutepermissions (rwx).Thegrouphasonlyreadandexecute(rx).Andeveryoneelsehasonlyreadandexecute(rx). Howwouldwesetpermissionsonanotherfiletoresemblebash's?First,let'smakeanexamplefile:


%touch/tmp/example %lsl/tmp/example rwrwr1davidusers0Apr1911:21/tmp/example

Wewillusechmod(1)(whichmeanschangemode)tosetthepermissionsontheexamplefile.Add theoctalnumbersforthepermissionsyouwant.Fortheownertohaveread,write,andexecute,we wouldhaveavalueof7.Readandexecutewouldhave5.Runthosetogetherandpassthemtochmod likethis:


%chmod755/tmp/example %lsl/tmp/example rwxrxrx1davidusers0Apr1911:21/tmp/example

Nowyoumaybethinking,Whydidn'titjustcreateafilewiththosepermissionsinthefirstplace? Welltheanswerissimple.bashincludesanicelittlebuiltincalledumask.Thisisincludedwithmost Unixshellsaswell,andcontrolswhatfilepermissionsareassignedtonewlycreatedfiles.Wediscussed bashbuiltinstosomedegreeinSection8.3.1.umasktakesalittlegettingusedto.Itworksverysimilar tochmod,onlyinreverse.Youspecifytheoctalvaluesyoudonotwishtohavepresentinnewly createdfiles.Thedefaultumaskvalueis0022.


%umask 0022 %umask0077 %touchtempfile %lsltempfile rw1davidusers0Apr1911:21tempfile

Seethemanpageforbashformoreinformation. Tosetspecialpermissionswithchmod,addthenumberstogetherandplacetheminthefirstcolumn. Forexample,tomakeitsetuserIDandsetgroupID,weuse6asthefirstcolumn:


%chmod6755/tmp/example %lsl/tmp/example rwsrsrx1davidusers0Apr1911:21/tmp/example

Iftheoctalvaluesconfuseyou,youcanuseletterswithchmod.Thepermissiongroupsarerepresented as: Owner Group World u g o

Alloftheabove a Todotheabove,wewouldhavetouseseveralcommandlines:
%chmoda+rx/tmp/example %chmodu+w/tmp/example %chmodug+s/tmp/example

Somepeoplepreferthelettersoverthenumbers.Eitherwaywillresultinthesamesetofpermissions. Theoctalformatisoftenfaster,andtheoneyouseemostoftenusedinshellscripts.Sometimesthe lettersaremorepowerfulhowever.Forexample,there'snoeasywaytochangeonegroupof permissionswhilepreservingtheothergroupsonfilesanddirectorieswhenusingtheoctalformat.This istrivialwiththeletters.


%lsl/tmp/ rwxrxrx1alanusers0Apr1911:21/tmp/example0 rwxrx1alanusers0Apr1911:21/tmp/example1 rxrx1alanusers0Apr1911:21/tmp/example2 %chmodgrwx/tmp/example? rwxrx1alanusers0Apr1911:21/tmp/example0 rwx1alanusers0Apr1911:21/tmp/example1 rx1alanusers0Apr1911:21/tmp/example2

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

TheshshellunderSlackwareisactuallybash.Removinglinksisdoneusingrm.Thelncommandis usedtocreatelinks.ThesecommandswillbediscussedinmoredepthinChapter10. It'sveryimportanttobecarefulaboutsymlinksinparticular.Once,Iwasworkingonamachinethat wasconsistentlyfailingtobackuptotapeeachnight.Twosymlinkshadbeenmadetodirectories beneatheachother.Thebackupsoftwarekeptappendingthosesamedirectoriestothetapeuntilit wasoutofspace.Normally,asetofcheckswillpreventcreatingasymlinkinthissituation,butourswas aspecialcase.

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

Thefirstcolumnisthedevicename.Inthiscase,thedevicesarefivepartitionsspreadoutacrosstwo SCSIharddrives,twospecialfilesystemsthatdon'tneedadevice,afloppy,andaCDROMdrive. Thesecondcolumniswherethedevicewillbemounted.Thisneedstobeadirectoryname,exceptin thecaseofaswappartition.Thethirdcolumnisthefilesystemtypeofthedevice.FornormalLinux filesystems,thiswillbeext2(secondextendedfilesystem).CDROMdrivesareiso9660,and Windowsbaseddeviceswilleitherbemsdosorvfat. Thefourthcolumnisalistingofoptionsthatapplytothemountedfilesystem.defaultsisfineforjust abouteverything.However,readonlydevicesshouldbegiventheroflag.Therearealotofoptions

thatcanbeused.Checkthefstab(5)manpageformoreinformation.Thelasttwocolumnsareused byfsckandothercommandsthatneedtomanipulatethedevices.Checkthemanpageforthat informationaswell. WhenyouinstallSlackwareLinux,thesetupprogramwillbuildmuchofthefstabfile.

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/

drwxrxx12rootroot4096Feb2602:06root/ drwxrxrx2rootbin4096Feb1702:02sbin/ drwxrxrx5rootroot2048Oct2510:51suncd/ drwxrwxrwt4rootroot487424Mar720:42tmp/ drwxrxrx21rootroot4096Aug2403:04usr/ drwxrxrx18rootroot4096Mar803:32var/

Supposeyouwanttogetalistingofthehiddenfilesinthecurrentdirectory.Thiscommandwilldojust that:
%lsa .bincdromhomemntsbinusr ..bootdevlibprocsuncdvar .pwrchute_tmpcdretclost+foundroottmpvmlinuz

Filesbeginningwithaperiod(calleddotfiles)arehiddenwhenyourunls.Youwillonlyseethemifyou passtheaoption. Therearemanymoreoptionsthatcanbefoundintheonlinemanualpage.Don'tforgetthatyoucan combineoptionsthatyoupasstols.

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$

Noticethatwithouttheprecedingslash,ittriestochangetoadirectoryinthecurrentdirectory.Also executingcdwithnooptionswillmoveyoutoyourhomedirectory. Thecdcommandisnotliketheothercommands.Itisabuiltinshellcommand.Shellbuiltinsare discussedinSection8.3.1.Thismaynotmakeanysensetoyourightnow.Basicallyitmeansthereisno manpageforthiscommand.Instead,youhavetousetheshellhelp.Likethis:


%helpcd

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

onescreen.Theindividualcommandsdonotknowhowtofittheiroutputtoseparatescreens.They leavethisjobtothepagerutility. Themorecommandbreakstheoutputintoindividualscreensandwaitsforyoutopressthespacebar beforecontinuingontothenextscreen.Pressingtheenterkeywilladvancetheoutputoneline.Hereis agoodexample:


%cd/usr/bin %lsl

Thatshouldscrollforawhile.Tobreakuptheoutputscreenbyscreen,justpipeitthroughmore:
%lsl|more

Thatisthepipecharacter(shiftbackslash).Thepipeisshortforsayingtaketheoutputoflsandfeedit intomore.Youcanpipejustaboutanythingthroughthemorecommand,notjustls.Pipingisalso coveredinSection8.2.3.

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

formanyotherpurposes. Tomergetwoormorefilesintoone,yousimplylistthefilesafterthecatcommandandthenredirect thenewoutputtoafile.catworkswithstandardinputandstandardoutput,soyouhavetousethe shellredirectioncharacters.Forexample:


%catfile1file2file3>bigfile

Thiscommandtakesthecontentsoffile1,file2,andfile3andmergesitalltogether.Thenew outputissenttostandardout. Onecanalsousecattodisplayfiles.Manypeoplecattextfilesthroughthemoreorlesscommands, likethis:


%catfile1|more

Thatwilldisplaythefile1fileandpipeitthroughthemorecommandsothatyouonlygetonescreen atatime. Anothercommonuseforcatiscopyingfiles.Youcancopyanyfilearoundwithcat,likethis:


%cat/bin/bash>~/mybash

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

Thatwillcopythemydirdirectorytothe/tmpdirectory. Alsoifyouwishtocopyadirectoryorafileandkeepallit'soldpermissionsandtimestampsandkeep itexactlythesameusecpp.


%lslfile rwrr1rootvlad4Jan115:27file %cppfile/tmp %lsl/tmp/file rwrr1rootvlad4Jan115:27file cphasmanymoreoptionsthatarediscussedindetailintheonlinemanualpage.

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

possibletoretrievearecentlydeletedfile,itcanbecomplicated(andpotentiallycostly)andisbeyond thescopeofthisbook. Toremoveasinglefile,specifyitsnamewhenyourunrm:


%rmfile1

Ifthefilehaswritepermissionsremoved,youmaygetapermissiondeniederrormessage.Toforce removalofthefilenomatterwhat,passthefoption,likethis:
%rmffile1

Toremoveanentiredirectory,youusetherandfoptionstogether.Thisisagoodexampleofhowto deletetheentirecontentsofyourharddrive.Youreallydon'twanttodothis.Buthere'sthecommand anyway:


#rmrf/

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

Thesoptiontellslntomakeasymboliclink.Thenextoptionisthetargetofthelink,andthefinal optioniswhattocallthelink.Inthiscase,itwilljustmakeafilecalledmp3inyourhomedirectorythat pointsto/var/media/mp3.Youcancallthelinkitselfwhateveryouwantbyjustchangingthelast option. Makingahardlinkisjustassimple.Allyouhavetodoisleaveoffthesoption.Hardlinksmaynot normallyrefertodirectoriesorspanfilesystems,however.Tocreateahardlink/usr/bin/emailto /usr/bin/mutt,simplytypethefollowing:


#ln/usr/bin/mutt/usr/bin/email

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&

Theprogramwillrunasnormal,andyouarereturnedtoaprompt. Theotherwaytobackgroundaprocessistodosowhileitisrunning.First,startupaprogram.Whileit isrunning,hitControl+z.Thissuspendstheprocess.Asuspendedprocessisbasicallypaused.It

momentarilystopsrunning,butcanbestartedupagainatanytime.Onceyouhavesuspendeda process,youarereturnedtoaprompt.Youcanbackgroundtheprocessbytyping:
%bg

Nowthesuspendedprocessisrunninginthebackground.

11.2Foregrounding
Ifyouneedtointeractwithabackgroundedprocess,youcanbringitbackintotheforeground.If you'veonlygotonebackgroundedprocess,youcanbringitbackbytyping:
%fg

Iftheprogramisnotdonerunning,theprogramwilltakecontroloveryouterminalandyouwillnotbe returnedtoaprompt.Sometimes,theprogramwillfinishrunningwhilebackgrounded.Inthisinstance, you'llgetamessagelikethis:


[1]+Done/bin/ls$LS_OPTIONS

Thattellsyouthatthebackgroundedprocess(inthiscaselsnotterriblyinteresting)hascompleted. Itispossibletohaveseveralprocessesbackgroundedatonce.Whenthishappens,you'llneedtoknow whichprocessyouwanttobringbacktotheforeground.Justtypingfgwillforegroundtheprocessthat waslastbackgrounded.Whatifyouhadawholelistofprocessesinthebackground?Luckily,bash includesacommandtolistalltheprocesses.It'scalledjobsandgivesoutputlikeso:


%jobs [1]Stoppedvim [2]Stoppedamp [3]+Stoppedmanps

Thisshowsyoualistofalltheprocessesthatarebackgrounded.Asyoucansee,theyareallstopped. Thismeansthattheprocessesaresuspended.ThenumberisasortofIDforallthebackgrounded processes.TheIDwithaplussignbesideit(manps)istheprocessthatwillbeforegroundedifyoujust typefg. Ifyouwantedtoforegroundvim,youwouldtype:


%fg1

andvimwouldspringbackuptotheconsole.Backgroundingprocessescanbeveryusefulifyouonly haveoneterminalopenoveradialupconnection.Youcanhaveseveralprogramsrunningonthatone terminal,periodicallyswitchingbackandforthbetweenthem.

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]

That'sawholelotofinformation.Basically,itaddsinformationincludingwhatuserstartedtheprocess, howmuchofthesystemresourcestheprocessisusing(the%CPU,%MEM,VSZ,andRSScolumns), andonwhatdatetheprocesswasstarted.Obviously,that'salotofinformationthatcouldcomein handyforasystemadministrator.Italsobringsupanotherpoint:theinformationnowgoesofftheedge ofthescreensothatyoucannotseeitall.Thewoptionwillforcepstowraplonglines. It'snotterriblypretty,butitdoesthejob.You'venowgotthecompletelistingsforeachprocess. There'sevenmoreinformationthatyoucandisplayabouteachprocess.Checkouttheveryindepth manpageforps.However,theoptionsshownabovearethemostpopularonesandwillbetheones youneedtousethemostoften.

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

Notethatyou'llhavetobetheowneroftheprocessinordertokillit.Thisisasecurityfeature.Ifyou wereallowedtokilloffprocessesstartedbyotherusers,itwouldbepossibletodoallsortsof maliciousthings.Ofcourse,rootcankilloffanyprocessonthesystem. There'sanothervarietyofthekillcommandcalledkillall(1).Thisprogramdoesexactlywhatit says:itkillsalltherunningprocessesthathaveacertainname.Ifyouwantedtokilloffalltherunning vimprocesses,youcouldtypethefollowingcommand:


%killallvim

Anyandallvimprocessesyouhaverunningwilldieoff.Doingthisasrootwouldkilloffallthevim processesrunningforallusers.Thisbringsupaninterestingwaytokickeveryone(includingyourself)

offthesystem:
#killallbash

Sometimesaregularkilldoesn'tgetthejobdone.Certainprocesseswillnotdiewithakill.You'llneed touseamorepotentform.IfthatpeskyPID4747wasn'trespondingtoyourkillrequest,youcoulddo thefollowing:


%kill94747

Thatwillalmostcertainlycauseprocess4747todie.Youcandothesamethingwithkillall.What thisisdoingissendingadifferentsignaltotheprocess.AregularkillsendsaSIGTERM(terminate) signaltotheprocess,whichtellsittofinishwhatit'sdoing,cleanup,andexit.kill9sendsa SIGKILL(kill)signaltotheprocess,whichessentiallydropsit.Theprocessisnotallowedtocleanup, andsometimesbadthingslikedatacorruptioncouldoccurbykillingsomethingwithaSIGKILL. There'sawholelistofsignalsatyourdisposal.Youcangetalistingofsignalsbytypingthefollowing:


%killl 1)SIGHUP2)SIGINT3)SIGQUIT4)SIGILL 5)SIGTRAP6)SIGABRT7)SIGBUS8)SIGFPE 9)SIGKILL10)SIGUSR111)SIGSEGV12)SIGUSR2 13)SIGPIPE14)SIGALRM15)SIGTERM17)SIGCHLD 18)SIGCONT19)SIGSTOP20)SIGTSTP21)SIGTTIN 22)SIGTTOU23)SIGURG24)SIGXCPU25)SIGXFSZ 26)SIGVTALRM27)SIGPROF28)SIGWINCH29)SIGIO 30)SIGPWR

Thenumbermustbeusedforkill,whilethenameminustheleadingSIGcanbeusedwith killall.Here'sanotherexample:
%killallKILLvim

Afinaluseofkillistorestartaprocess.SendingaSIGHUPwillcausemostprocessestoreread theirconfigurationfiles.Thisisespeciallyhelpfulfortellingsystemprocessestorereadtheirconfigfiles afterediting.

11.5top
Finally,there'sacommandyoucanusetodisplayupdatinginformationabouttheprocessesrunningon thesystem.Thiscommandiscalledtop(1),andisstartedlikeso:
%top

Thiswilldisplayafullscreenofinformationabouttheprocessesrunningonthesystem,aswellassome overallinformationaboutthesystem.Thisincludesloadaverage,numberofprocesses,theCPUstatus, freememoryinformation,anddetailsaboutprocessesincludingPID,user,priority,CPUandmemory

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

It'scalledtopbecausethemostCPUintensiveprogramswillbelistedatthetop.Aninterestingnoteis thattopwillbelistedfirstonmostinactive(andsomeactive)systemsbecauseofitsCPUutilization. However,topisquiteusefulfordeterminingwhatprogramismisbehavingandneedstobekilledoff. Butsupposeyouonlywantalistofyourownprocesses,ortheprocessesofsomeotheruser.The processesyouwanttoseemightnotbeamongthemostCPUintensiveprogramscurrentlyrunning.The uoptionallowsyoutospecifyausernameorUIDandmonitoronlythoseprocessesownedbythat UID.


%topualan PIDUSERPRNIVIRTRESSHRS%CPU%MEMTIME+COMMAND 3622alan1301101210m6956S1.02.10:03.66gnometerminal 3739alan13010121012804R0.30.20:00.06top 3518alan90131213121032S0.00.30:00.09bash 3529alan90984984848S0.00.20:00.00startx 3544alan90640640568S0.00.10:00.00xinit 3548alan90832483206044S0.01.60:00.30gnomesession 3551alan90708470841968S0.01.40:00.50gconfd2 3553alan9022322232380S0.00.40:00.05esd 3555alan90255225521948S0.00.50:00.10bonoboactivati 3557alan90274027402224S0.00.50:00.05gnomesmproxy 3559alan90649664925004S0.01.30:00.31gnomesettings 3565alan90174017401440S0.00.30:00.28xscreensaver 3568alan90705270524960S0.01.40:02.28metacity 3572alan901141211m7992S0.02.20:01.58gnomepanel 3574alan901214811m8780S0.02.40:00.64nautilus 3575alan901214811m8780S0.02.40:00.00nautilus 3576alan901214811m8780S0.02.40:00.00nautilus

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

Thisisthenamethattheuserwillusetologin.Traditionally,loginnamesareeightcharactersorfewer, andalllowercasecharacters.(Youmayusemorethaneightcharacters,orusedigits,butavoiddoingso unlessyouhaveafairlyimportantreason.) Youcanalsoprovidetheloginnameasanargumentonthecommandline:

#adduserjellyd

Ineithercase,afterprovidingtheloginname,adduserwillpromptfortheuserID:
UserID('UID')[defaultstonextavailable]:

TheuserID(UID)ishowownershipsarereallydeterminedinLinux.Eachuserhasauniquenumber, startingat1000inSlackware.YoucanpickaUIDforthenewuser,oryoucanjustletadduserassign theuserthenextfreeone.


Initialgroup[users]:

Allusersareplacedintotheusersgroupbydefault.Youmightwanttoplacethenewuserintoa differentgroup,butitisnotrecommendedunlessyouknowwhatyou'redoing.
Additionalgroups(commaseparated)[]:

Thisquestionallowsyoutoplacethenewuserintoadditionalgroups.Itispossibleforausertobein severalgroupsatthesametime.Thisisusefulifyouhaveestablishedgroupsforthingslikemodifying websitefiles,playinggames,andsoon.Forexample,somesitesdefinegroupwheelastheonlygroup thatcanusethesucommand.Or,adefaultSlackwareinstallationusesthesysgroupforusers authorizedtoplaysoundsthroughtheinternalsoundcard.


Homedirectory[/home/jellyd]

Homedirectoriesdefaulttobeingplacedunder/home.Ifyourunaverylargesystem,it'spossiblethat youhavemovedthehomedirectoriestoadifferentlocation(ortomanylocations).Thisstepallowsyou tospecifywheretheuser'shomedirectorywillbe.


Shell[/bin/bash] bashisthedefaultshellforSlackwareLinux,andwillbefineformostpeople.Ifyournewusercomes

fromaUnixbackground,theymaybefamiliarwithadifferentshell.Youcanchangetheirshellnow,or theycanchangeitthemselveslaterusingthechshcommand.
Expirydate(YYYYMMDD)[]:

Accountscanbesetuptoexpireonaspecifieddate.Bydefault,thereisnoexpirationdate.Youcan changethat,ifyou'dlike.ThisoptionmightbeusefulforpeoplerunninganISPwhomightwanttomake anaccountexpireuponacertaindate,unlesstheyreceivethenextyear'spayment.


Newaccountwillbecreatedasfollows: Loginname:jellyd

UID:[Nextavailable] Initialgroup:users Additionalgroups:[None] Homedirectory:/home/jellyd Shell:/bin/bash Expirydate:[Never]

Thisisit...ifyouwanttobailout,hitControl+C.Otherwise,pressENTERtogoaheadandmakethe account. Younowseealltheinformationthatyou'veenteredaboutthenewaccountandaregiventhe opportunitytoaborttheaccountcreation.Ifyouenteredsomethingincorrectly,youshouldhit Control+Candstartover.Otherwise,youcanhitenterandtheaccountwillbemade.


Creatingnewaccount... Changingtheuserinformationforjellyd Enterthenewvalue,orpressreturnforthedefault FullName[]:Jeremy RoomNumber[]:Smith130 WorkPhone[]: HomePhone[]: Other[]:

Allofthisinformationisoptional.Youdon'thavetoenteranyofthisifyoudon'twantto,andtheuser canchangeitatanytimeusingchfn.However,youmightfindithelpfultoenteratleastthefullname andaphonenumber,incaseyouneedtogetintouchwiththepersonlater.


Changingpasswordforjellyd Enterthenewpassword(minimumof5,maximumof127characters) Pleaseuseacombinationofupperandlowercaselettersandnumbers. Newpassword: Reenternewpassword: Passwordchanged. Accountsetupcomplete.

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.

Removingusersisnotdifficultatall.Justrunuserdelwiththenameoftheaccounttoremove.You shouldverifythattheuserisnotloggedin,andthatnoprocessesarerunningasthatuser.Also, rememberthatonceyou'vedeletedtheuser,allofthatuser'spasswordinformationisgonepermanently.


#userdeljellyd

Thiscommandremovesthatannoyingjellyduserfromyoursystem.Goodriddance!:)Theuseris removedfromthe/etc/passwd,/etc/shadow,and/etc/groupfiles,butdoesn'tremovetheuser's homedirectory. Ifyou'dwantedtoremovethehomedirectoryaswell,youwouldinsteadusethiscommand:


#userdelrjellyd

Temporarilydisablinganaccountwillbecoveredinthenextsectiononpasswords,sinceatemporary changeinvolveschangingtheuser'spassword.ChangingotheraccountinformationiscoveredinSection 12.1.3. Theprogramstoaddandremovegroupsareverysimple.groupaddwilljustaddanotherentrytothe /etc/groupfilewithauniquegroupID,whilegroupdelwillremovethespecifiedgroup.Itisupto youtoedit/etc/grouptoadduserstoaspecificgroup.Forexample,toaddagroupcalledcvs:


#groupaddcvs

Andtoremoveit:
#groupdelcvs

12.1.2ChangingPasswords
Thepasswdprogramchangespasswordsbymodifyingthe/etc/shadowfile.Thisfileholdsallthe passwordsforthesysteminanencryptedformat.Inordertochangeyourownpassword,youwould type:
%passwd Changingpasswordforchris Oldpassword: Enterthenewpassword(minumumof5,maximumof127characters) Pleaseuseacombinationofupperandlowercaselettersandnumbers. Newpassword:

Asyoucansee,youarepromptedtoenteryouroldpassword.Itwon'tappearonthescreenasyou typeit,justlikewhenyoulogin.Then,youarepromptedtoenterthenewpassword.passwdperforms alotofchecksonyournewpassword,anditwillcomplainifyournewpassworddoesn'tpassits checks.Youcanignoreitswarningsifyouwant.Youwillbepromptedtoenteryournewpassworda secondtimeforconfirmation.

Ifyouareroot,youcanalsochangeanotheruser'spassword:
#passwdted

Youwillthenhavetogothroughthesameprocedureasabove,exceptthatyouwon'thavetoenterthe user'soldpassword.(Oneofthemanybenefitsofbeingroot...) Ifneeded,youcanalsotemporarilydisableanaccount,andreenableitatalatertimeifneeded.Both disablinganaccountandreenablinganaccountcanbedonewithpasswd.Todisableanaccount,do thefollowingasroot:


#passwdldavid

Thiswillchangedavid'spasswordtosomethingthatcannevermatchanyencryptedvalue.Youwould reenabletheaccountbyusing:
#passwdudavid

Now,david'saccountisbacktonormal.Disablinganaccountmightbeusefuliftheuserdoesn'tplayby therulesyou'vesetuponyoursystem,orifthey'veexportedaverylargecopyofxeyes(1)toyourX desktop.

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]:

Afterenteringyourpassword,enterthefullpathtothenewshell.Makesurethatit'slistedinthe /etc/shells(5)filefirst.Therootusercanalsochangeanyuser'sshellbyrunningchshwitha usernameastheargument. Thefingerinformationistheoptionalinformationsuchasyourfullname,phonenumbers,androom number.Thiscanbechangedusingchfn,andfollowsthesameprocedureasitdidduringaccount creation.Asusual,rootcanchangeanyone'sfingerinformation.

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:::

Again,eachlineisanentryforoneperson,witheachfielddelimitedbyacolon.Thefieldsare(inorder) loginname,encryptedpassword,dayssincetheEpoch(January1,1970)thatthepasswordwaslast changed,daysbeforethepasswordmaybechanged,daysafterwhichthepasswordmustbechanged, daysbeforepasswordexpirationthattheuserisnotified,daysafterexpirationthattheaccountis disabled,dayssincetheEpochthattheaccountisdisabled,andareservedfield. Asyoucansee,mostofthatisforaccountexpirationinformation.Ifyouaren'tusingexpiration information,youonlyneedtofillinafewfieldswithsomespecialvalues.Otherwise,you'llneedtodo

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

Inthiscase,wearenotgoingtosendacustommessagetotheuserstheywillseeshutdown'sdefault message.nowisthetimethatwewanttoshutdown,andthehmeanstohaltthesystem.Thisisnot averyfriendlywaytorunamultiusersystem,butitworksjustfineonyourhomecomputer.Abetter methodonamultiusersystemwouldbetogiveeveryonealittleadvancewarning:


#shutdownh+60

Thiswouldshutdownthesysteminonehour(60minutes),whichwouldbejustfineonanormal multiusersystem.Vitalsystemsshouldhavetheirdowntimescheduledfarinadvance,andyoushould postwarningsaboutthedowntimeinanyappropriatelocationsusedforsystemnotifications(email, bulletinboard,/etc/motd,whatever). Rebootingthesystemusesthesamecommand,butsubstitutesrforh:


#shutdownrnow

Youcanusesametimenotationwithshutdownrthatyoucouldwithshutdownh.Therearealot ofotherthingsthatyoucandowithshutdowntocontrolwhentohaltorrebootthemachineseethe manpageformoredetails. Thesecondwayofshuttingdownorpoweringoffthecomputeristousethehalt(8)andreboot(8) commands.Asthenamesindicate,haltwillimmediatelyhalttheoperatingsystem,andrebootwill rebootthesystem.(rebootisactuallyjustasymboliclinktohalt.)Theyareinvokedlikeso:


#halt #reboot

Alowerlevelwaytorebootorshutdownthesystemistotalkdirectlytoinit.Alltheothermethods aresimplyconvenientwaystotalktoinit,butyoucandirectlytellitwhattodousingtelinit(8)

(notethatitonlyhasonel).Usingtelinitwilltellinitwhatrunleveltodropinto,whichwillcause aspecialscripttoberun.Thisscriptwillkillorspawnprocessesasneededforthatrunlevel.Thisworks forrebootingandshuttingdownbecausebothofthosearespecialrunlevels.


#telinit0

Runlevel0ishaltmode.Tellinginittoenterrunlevel0willcauseallprocessestobekilledoff,the filesystemsunmounted,andthemachinetobehalted.Thisisaperfectlyacceptablewaytobringdown thesystem.Onmanylaptopsandmoderndesktopcomputers,thiswillalsocausethemachinetobe turnedoff.


#telinit6

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

anICMPpacketback.Soundstrange?Well,youcanpinganIPaddresstoseeifamachineisalive. Ifthereisnoresponse,youknowsomethingiswrong.Hereisanexampleconversationbetweentwo Linuxusers: UserA:Loki'sdownagain. UserB:Areyousure? UserA:Yeah,Itriedpingingit,butthere'snoresponse. It'sinstanceslikethesethatmakepingaveryusefuldaytodaycommand.Itprovidesaveryquick waytoseeifamachineisupandconnectedtothenetwork.Thebasicsyntaxis:


%pingwww.slackware.com

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.
%dig@192.168.1.254www.slackware.commx <<>>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

Thisshouldgiveyouanideahowdigworks.@192.168.1.254specifiesthednsservertouse. www.slackware.comisthedomainnameIamperformingalookupon,andmxisthetypeof lookupIamperforming.Theabovequerytellsmethatemailtowww.slackware.comwillinsteadbe senttomail.slackware.comfordelivery.

13.4finger
finger(1)willretrieveinformationaboutthespecifieduser.Yougivefingerausernameoranemail

addressanditwilltrytocontactthenecessaryserverandretrievetheusername,office,telephone number,andotherpiecesofinformation.Hereisanexample:
%fingerjohnc@idsoftware.com 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

usernameandpasswordareverified,youaregivenashellprompt.Fromhere,youcandoanything requiringatextconsole.Composeemail,readnewsgroups,movefilesaround,andsoon.Ifyouare runningXandyoutelnettoanothermachine,youcanrunXprogramsontheremotecomputerand displaythemonyours. Tologintoaremotemachine,usethissyntax:


%telnet<hostname>

Ifthehostresponds,youwillreceivealoginprompt.Giveityourusernameandpassword.That'sit. Youarenowatashell.Toquityourtelnetsession,useeithertheexitcommandorthelogout command.


telnetdoesnotencrypttheinformationitsends.Everythingissentinplaintext,even passwords.ItisnotadvisabletousetelnetovertheInternet.Instead,considertheSecure Shell.Itencryptsalltrafficandisavailableforfree.

13.5.1Theotheruseoftelnet
Nowthatwehaveconvincedyounottousethetelnetprotocolanymoretologintoaremotemachine, we'llshowyouacoupleofusefulwaystousetelnet. Youcanalsousethetelnetcommandtoconnecttoahostonacertainport.
%telnet<hostname>[port]

Thiscanbequitehandywhenyouquicklyneedtotestacertainservice,andyouneedfullcontrolover thecommands,andyouneedtoseewhatexactlyisgoingon.Youcaninteractivelytestorusean SMTPserver,aPOP3server,anHTTPserver,etc.thisway. Inthenextfigureyou'llseehowyoucantelnettoaHTTPserveronport80,andgetsomebasic informationfromit. Figure131.Telnettingtoawebserver


%telnetstore.slackware.com80

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

Bydefault,youareplacedinyourinbox.Themessagesarelistedwiththemessagenumber,date, sender,andsubject.Usethearrowkeystohighlightthemessageyouwant.PressEntertoreadthe message. Tocomposeanewmessage,typematthemainscreen.Thedkeywillflagamessagefordeletion.And therkeywillreplytothecurrentmessageyouarereading.Allofthesekeysaredisplayedatthe bottomofthescreenwithaprompt. Themanpagediscusseselminmoredetail,soyouwillprobablywanttoconsultthatbeforeusingelm.

13.7.3mutt
Allmailclientssuck.Thisonejustsucksless.mutt'soriginalinterfacewasbasedonelmwithadded featuresfoundinotherpopularmailclients,resultinginahybridmutt. Someofmutt'sfeaturesinclude: colorsupport messagethreading MIMEandPGP/MIMEsupport pop3andimapsupport

supportformultiplemailboxformats(mbox,MMDF,MH,maildir) highlycustomizable Figure134.Muttmainscreen

ifyou'relookingforamailclientthatwillletyoubeintotalcontrolovereverything,thenyouwilllike mutt.allthedefaultsettingscanbecustomized,keybindingscanbechanged.ifyouliketoadda macro,youcan. youprobablywanttotakealookatthemuttrcmanpage,whichwilltellyouhowtoconfigure everything.ortakealookattheincludedexamplemuttrcfile.

13.7.4nail
nail(1)isacommandlinedrivenmailclient.Itisveryprimitiveandoffersprettymuchnothinginthe

wayofuserinterfaces.However,mailxishandyfortimeswhenyouneedtoquicklymailsomething, scriptingabulkmailer,testingyourMTAinstallationorsomethingsimilar.NotethatSlackwarecreates symboliclinkstonailat/usr/bin/mailand/usr/bin/mailx.Anyofthesethreecommands executesthesameprogram.Infact,youwillmostlikelyseenailreferredtoasmail. Thebasiccommandlineis:


%mailx<subject><toaddr> mailxreadsthemessagebodyfromstandardinput.Soyoucancatafileintothiscommandtomailit,

oryoucanjusttypetextandhitCtrl+Dwhenfinishedwiththemessage. Hereisanexampleofmailingaprogramsourcefiletoanotherperson.

%catrandomfunc.c|mails"Here'sthatfunction"asdf@example.net

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

SlackwareLinuxviaFTP,youmustuseanonymousFTP. Onceconnected,youwillbeattheftp>prompt.TherearespecialcommandsforFTP,buttheyare similartootherstandardcommands.Thefollowingshowssomeofthebasiccommandsandwhatthey do: Table131.ftpcommands Command


ls

Purpose

Listfiles cd<dirname> Changedirectory bin Setbinarytransfermode ascii SetASCIItransfermode get<filename> Downloadafile


put<filename> hash tick prom mget<mask> mput<mask> quit

Uploadafile Togglehashmarkstatsindicator Togglebytecounterindicator Toggleinteractivemodefordownloads Downloadafileorgroupoffileswildcardsareallowed Uploadafileorgroupoffileswildcardsareallowed LogofftheFTPserver

Youcanalsousesomeofthefollowingcommandswhicharequiteselfexplanatory:chmod,delete, rename,rmdir.Foracompletelistofallcommandsandtheirmeaning,justtypehelpor?andyou'll seeacompletelistingonscreen. FTPisafairlysimpleprogramtouse,butlackstheuserinterfacethatmanyofusareusedtonowadays. Themanpagediscussessomeofthecommandlineoptionsforftp(1).


ftp>ls*.TXT 200PORTcommandsuccessful. 150OpeningASCIImodedataconnectionfor/bin/ls. rwrr1root10018606Apr62002BOOTING.TXT rwrr1root10010518Jun132002COPYRIGHT.TXT rwrr1root100602Apr62002CRYPTO_NOTICE.TXT rwrr1root10032431Sep2902:56FAQ.TXT rwrr1root100499784Mar319:29FILELIST.TXT rwrr1root100241099Mar319:12PACKAGES.TXT rwrr1root10012339Jun192002README81.TXT rwrr1root10014826Jun172002SPEAKUP_DOCS.TXT rwrr1root10015434Jun172002SPEAK_INSTALL.TXT rwrr1root1002876Jun172002UPGRADE.TXT 226Transfercomplete. ftp>tick Tickcounterprintingon(10240bytes/tickincrement). ftp>getREADME81.TXT local:README81.TXTremote:README81.TXT 200PORTcommandsuccessful. 150OpeningBINARYmodedataconnectionforREADME81.TXT(12339bytes). Bytestransferred:12339 226Transfercomplete. 12339bytesreceivedin0.208secs(58Kbytes/sec)

13.9.2ncftp
ncftp(1)(pronounced"NikFTP")isanalternativetothetraditionalftpclientthatcomeswith Slackware.Itisstillatextbasedprogram,butoffersmanyadvantagesoverftp,including:

Tabcompletion Bookmarksfile Moreliberalwildcarduses Commandhistory Bydefault,ncftpwilltrytologinanonymouslytotheserveryouspecify.Youcanforcencftpto presentaloginpromptwiththeuoption.Onceloggedin,youcanusethesamecommandsasinftp, onlyyou'llnoticeanicerinterface,onethatworksmorelikebash.


ncftp/pub/linux/slackware>cdslackwarecurrent/ PleasereadthefileREADME81.TXT itwaslastmodifiedonWedJun1916:24:212002258daysago CWDcommandsuccessful. ncftp...ware/slackwarecurrent>ls BOOTING.TXTFAQ.TXTbootdisks/ CHECKSUMSFILELIST.TXTextra/ CHECKSUMS.ascGPGKEYisolinux/ CHECKSUMS.md5PACKAGES.TXTkernels/ CHECKSUMS.md5.ascPRERELEASE_NOTESpasture/ COPYINGREADME81.TXTrootdisks/ COPYRIGHT.TXTSPEEKUP_DOCS.TXTslackware/ CRYPTO_NOTICE.TXTSPEEK_INSTALL.TXTsource/ CURRENT.WARNINGSlackwareHOWTO ChangeLog.txtUPGRADE.TXT ncftp...ware/slackwarecurrent>getREADME81.TXT README81.TXT:12.29kB307.07kB/s

13.10TalkingtoOtherPeople
13.10.1wall
wall(1)isaquickwaytowriteamessagetotheusersonasystem.Thebasicsyntaxis:

%wall[file]

Thiswillresultinthecontentsof[file]beingdisplayedontheterminalsofallcurrentlyloggedinusers.If youdon'tspecifyafile,wallwillreadfromstandardinput,soyoucanjusttypeyourmessage,andend withCtrl+d.


walldoesn'thavemanyfeatures,andapartfromlettingyourusersknowthatyou'reabouttodosome

seriousmaintenancetothesystem,orevenrebootit,sotheyhavetimetosavetheirworkandlogoff:)

13.10.2talk

talk(1)allowstwouserstochat.Itsplitsthescreeninhalf,horizontally.Torequestachatwithanother

user,usethiscommand:
%talk<person>[ttyname]

Figure137.Twousersinatalksession

Ifyouspecifyjustausername,thechatrequestisassumedtobelocal,soonlylocalusersarequeried. Thettynameisrequiredifyouwanttoringauseronaspecificterminal(iftheuserisloggedinmore thanonce).Therequiredinformationfortalkcanbeobtainedfromthew(1)command.


talkcanalsoringusersonremotehosts.Fortheusernameyousimplyspecifyanemailaddress.talk

willtrytocontactthatremoteuseronthathost.
talkissomewhatlimited.Itonlysupportstwousersandishalfduplex.

13.10.3ytalk
ytalk(1)isabackwardscompatiblereplacementfortalk.ItcomeswithSlackwareastheytalk

command.Thesyntaxissimilar,buthasafewdifferences:
%ytalk<username>[#ttyname]

Figure138.Twousersinaytalksession

Theusernameandterminalarespecifiedthesameasundertalk,exceptyoumustputthemtogetherwith thehashmark(#). ytalkoffersseveraladvantages: Itsupportsmorethantwousers. AmenuofoptionsthatcanbebroughtupanytimewithEsc. Youcanshelloutwhilestillinthetalksession. Plusmore... Ifyou'reaserveradministrator,you'llwanttomakesurethatthentalkportisenabledin /etc/inetd.conf.ytalkneedsthattoworkproperly.

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

Forservicesthatdon'thavetheirowninitscript,youwillneedtocommentouttherelevantlinesinthe initscriptstodisablethem.Forexample,theportmapdaemonisstartedbythefollowinglinesin /etc/rc.d/rc.inet2:


#ThismustberunninginordertomountNFSvolumes. #StarttheRPCportmapper: if[x/sbin/rpc.portmap]then echo"StartingRPCportmapper:/sbin/rpc.portmap" /sbin/rpc.portmap fi #DonestartingtheRPCportmapper.

Thiscanbedisabledbyadding#symbolstothebeginningsofthelinesthatdon'talreadystartwith them,likeso:

#ThismustberunninginordertomountNFSvolumes. #StarttheRPCportmapper: #if[x/sbin/rpc.portmap]then #echo"StartingRPCportmapper:/sbin/rpc.portmap" #/sbin/rpc.portmap #fi #DonestartingtheRPCportmapper.

Thesechangeswillonlytakeeffectaftereitherarebootorchangingfromandbacktorunlevel3or4. Youcandothisbytypingthefollowingontheconsole(youwillneedtologinagainafterchangingto runlevel1):


#telinit1 #telinit3

14.2HostAccessControl
14.2.1iptables
iptablesisthepacketfilteringconfigurationprogramforLinux2.4andabove.The2.4kernel(2.4.5,

tobeexact)wasfirstintroducedintoSlackware(asanoption)inversion8.0andwasmadethedefault inSlackware8.1.Thissectiononlycoversthebasicsofitsusageandyoushouldcheck http://www.netfilter.org/formoredetails.Thesecommandscanbeenteredinto /etc/rc.d/rc.firewall,whichhastobesetasexecutablefortheserulestotakeeffectatstartup. Notethatincorrectiptablescommandscanessentiallylockyououtofyourownmachine.Unlessyou are100%confidentinyourskills,alwaysensureyouhavelocalaccesstothemachine. ThefirstthingmostpeopleshoulddoissetthedefaultpolicyforeachinboundchaintoDROP:


#iptablesPINPUTDROP #iptablesPFORWARDDROP

Wheneverythingisdenied,youcanstartallowingthings.Thefirstthingtoallowisanytrafficfor sessionswhicharealreadyestablished:
#iptablesAINPUTmstatestateESTABLISHED,RELATEDjACCEPT

Soasnottobreakanyapplicationsthatcommunicateusingtheloopbackaddress,itisusuallywiseto addarulelikethis:
#iptablesAINPUTs127.0.0.0/8d127.0.0.0/8ilojACCEPT

Thisrulesallowsanytraffictoandfrom127.0.0.0/8(127.0.0.0127.255.255.255)ontheloopback (lo)interface.Whencreatingrules,itisagoodideatobeasspecificaspossible,tomakesurethat yourrulesdonotinadvertentlyallowanythingevil.Thatsaid,rulesthatallowtoolittlemeanmorerules andmoretyping.

Thenextthingtodowouldbetoallowaccesstospecificservicesrunningonyourmachine.If,for example,youwantedtorunawebserveronyourmachine,youwouldusearulesimilartothis:
#iptablesAINPUTptcpdport80ippp0jACCEPT

Thiswillallowaccessfromanymachinetoport80onyourmachineviatheppp0interface.Youmay wanttorestrictaccesstothisservicesothatonlycertainmachinescanaccessit.Thisruleallowsaccess toyourwebservicefrom64.57.102.34:


#iptablesAINPUTptcps64.57.102.34dport80ippp0jACCEPT

AllowingICMPtrafficcanbeusefulfordiagnosticpurposes.Todothis,youwouldusearulelikethis:
#iptablesAINPUTpicmpjACCEPT

MostpeoplewillalsowanttosetupNetworkAddressTranslation(NAT)ontheirgatewaymachine, sothatothermachinesontheirnetworkcanaccesstheInternetthroughit.Youwouldusethefollowing ruletodothis:


#iptablestnatAPOSTROUTINGoppp0jMASQUERADE

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

provideanextralayerofsecurityattimeswhenIPlevelaccesscontrols(e.g.Netfilter)arenot functioningcorrectly.Forexample,ifyourecompilethekernelbutforgettoincludeiptablessupport, yourIPlevelprotectionwillfailbuttcpwrapperswillstillhelpprotectyoursystem.

Accesstoservicesprotectedbytcpwrapperscanbecontrolledusing/etc/hosts.allowand /etc/hosts.deny. Themajorityofpeoplewouldhaveasinglelineintheir/etc/hosts.denyfiletodenyaccesstoall daemonsbydefault.Thislinewouldbe:


ALL:ALL

Whenthisisdone,youcanconcentrateonallowingaccesstoservicesforspecifiedhosts,domains,or IPranges.Thiscanbedoneinthe/etc/hosts.allowfile,whichfollowsthesameformat. Alotofpeoplewouldstartbyacceptingallconnectionsfromlocalhost.Thiscanbeachievedusing:


ALL:127.0.0.1

ToallowaccesstoSSHdfrom192.168.0.0/24,youcoulduseeitherofthefollowingrules:
sshd:192.168.0.0/24 sshd:192.168.0.

Itisalsopossibletorestrictaccesstohostsincertaindomains.Thiscanbedoneusingthefollowingrule (notethatthisreliesonthereverseDNSentryfortheconnectinghostbeingtrustworthy,soIwould recommandagainstitsuseonInternetconnectedhosts):


sshd:.slackware.com

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

YoushouldthencheckthisagainstthelineforthenewpackageintheCHECKSUMS.md5fileintheroot oftheslackware$VERSIONdirectory(alsointhe/patchesdirectoryforpatches)orintheemailto theslackwaresecuritymailinglist. Ifyouhaveafilewiththemd5sumvaluesinit,youcansourceitinsteadwiththecoptiontomd5sum.


#md5sumcCHECKSUMS.md5 ./ANNOUNCE.10_0:OK ./BOOTING.TXT:OK ./COPYING:OK ./COPYRIGHT.TXT:OK ./CRYPTO_NOTICE.TXT:OK ./ChangeLog.txt:OK ./FAQ.TXT:FAILED

Asyoucansee,anyfilesthatmd5sumevaluatesascorrectarelistedOKwhilefilesthatfailare labelledFAILED.(Yes,thiswasaninsulttoyourintelligence.Whydoyouputupwithme?)

Chapter15ArchiveFiles
15.1gzip
gzip(1)istheGNUcompressionprogram.Ittakesasinglefileandcompressesit.Thebasicusageis

asfollows:
%gzipfilename

Theresultingfilewillbenamedfilename.gzandwillusuallybesmallerthantheinputfile.Notethat filename.gzwillreplacefilename.Thismeansthatfilenamewillnolongerexist,eventhougha gzippedcopywill.Regulartextfileswillcompressnicely,whilejpegimages,mp3s,andothersuchfiles willnotcompresstoowellastheyarealreadycompressed.Thisbasicusageisabalanceoffinalfilesize andcompressiontime.Themaximumcompressioncanbeachievedlikeso:


%gzip9filename

Thiswilltakealongertimetocompressthefile,buttheresultwillbeassmallasgzipcanmakeit. Usinglowervaluesforthecommandlineoptionwillcauseittocompressfaster,butthefilewillnotbe ascompressed. Decompressinggzippedfilescanbedoneusingtwocommands,whicharereallyjustthesameprogram. gzipwilldecompressanyfilewitharecognizedfileextension.Arecognizedextensioncanbeanyofthe

following:.gz,gz,.z,z,.Z,orZ.Thefirstmethodistocallgunzip(1)onafile,likeso:
%gunzipfilename.gz

Thiswillleaveadecompressedversionofinfileinthecurrentdirectory,andthe.gzextensionwillbe strippedfromthefilename.gunzipisreallypartofgzipandisidenticaltogzipd.Assuch,gzipis oftenpronouncedgunzip,asthatnamejustsoundscooler.:^)

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.

Youcangettoallthefilesinthisarchivebymakinguseoftarandsomecommandlinearguments. Unarchivingatarballmakesuseofthezflag,whichmeanstofirstrunthefilethroughgunzipand decompressit.Themostcommonwaytodecompressatarballislikeso:


%tarxvzffilename.tar.gz

That'squiteafewoptions.Sowhatdotheyallmean?Thexmeanstoextract.Thisisimportant,asit tellstarexactlywhattodowiththeinputfile.Inthiscase,we'llbesplittingitbackupintoallthefiles thatitcamefrom.vmeanstobeverbose.Thiswilllistallthefilesthatarebeingunarchived.Itis perfectlyacceptabletoleavethisoptionoff,ifsomewhatboring.Alternatively,youcouldusevvtobe veryverboseandlistevenmoreinformationabouteachfilebeingunarchived.Thezoptiontellstarto runfilename.tar.gzthroughgunzipfirst.Andfinally,thefoptiontellstarthatthenextstringon thecommandlineisthefiletooperateon. Thereareafewotherwaystowritethissamecommand.Onoldersystemslackingadecentcopyof GNUtar,youmightseeitwrittenlikeso:


%gunzipfilename.tar.gz|tarxvf

Thiscommandlinewilluncompressthefileandsendtheoutputtotar.Sincegzipwillwriteitsoutput tostandardoutiftoldtodoso,thiscommandwillwritethedecompressedfiletostandardout.Thepipe thensendsittotarforunarchiving.Themeanstooperateonstandardinput.Itwillunarchivethe streamofdatathatitgetsfromgzipandwritethattothedisk. Anotherwaytowritethefirstcommandlineistoleaveoffthedashbeforetheoptions,likeso:


%tarxvzffilename.tar.gz

Youmightalsoencounterabzippedarchive.TheversionoftarthatcomeswithSlackwareLinuxcan handlethesethesameasgzippedarchives.Insteadofthezcommandlineoption,you'dusej:
%tarxvjffilename.tar.bz2

Itisimportanttonotethattarwillplacetheunarchivedfilesinthecurrentdirectory.So,ifyouhadan archivein/tmpthatyouwantedtodecompressintoyourhomedirectory,thereareafewoptions.First, thearchivecouldbemovedintoyourhomedirectoryandthenrunthroughtar.Second,youcould specifythepathtothearchivefileonthecommandline.Third,youcanusetheCoptiontoexplode thetarballinaspecifieddirectory.


%cd$HOME %cp/tmp/filename.tar.gz. %tarxvzffilename.tar.gz %cd$HOME %tarxvzf/tmp/filename.tar.gz %cd/ %tarxvzf/tmp/filename.tar.gzC$HOME

Alltheabovestatementsareequivalent.Ineachcase,thearchiveisunpackedinsideyourhome directoryandtheoriginaluncompressedarchiveisleftinplace. Sowhatgoodisbeingabletouncompressthesearchivesifyoucan'tmakethem?Well,tarhandles thattoo.Inmostcasesit'saseasyasremovingthexoptionandreplacingitwiththecoption.


%tarcvzffilename.tar.gz.

Inthiscommandline,thecoptiontellstartocreateanarchive,whilethezoptionrunstheresulting archivefilethroughgziptocompressit.filename.tar.gzisthefilethatyouwanttocreate. Specifyingthefoptionisn'talwaysnecessary,butistypicallygoodpracticeanyway.Withoutit,tar writestostandardoutput,whichisusuallydesiredforpipingtar'soutputtoanotherprogram,likeso.


%tarcvfilename.tar.|gpgencrypt

Thatcommandcreatesannoncompressedtararchiveofthecurrentdirectory,pipesthetarballthrough gpgwhichencryptsandcompressesthetarball,makingitrealisticallyimpossibletoreadbyanyone otherthanthepersonknowingthesecretkey.

15.4zip
Finally,therearetwoutilitiesthatcanbeusedonzipfiles.TheseareverycommonintheWindows world,soLinuxhasprogramstodealwiththem.Thecompressionprogramiscalledzip(1),andthe decompressionprogramiscalledunzip(1).
%zipfoo*

Thiswillcreatethefilefoo.zip,whichwillcontainallthefilesinthecurrentdirectory.zipwilladdthe .zipextensionautomatically,sothere'snoneedtoincludethatinthefilename.Youcanalsorecurse throughthecurrentdirectory,zippingupanydirectoriesthatarealsolayingaround:


%ziprfoo*

Decompressingfilesiseasy,aswell.
%unzipfoo.zip

Thiswillextractallthefilesinthefilefoo.zip,includinganydirectoriesinthearchive. Theziputilitieshaveseveraladvancedoptionsforcreatingselfextractingarchives,leavingoutfiles, controllingcompressedfilesize,printingoutwhatwillhappen,andmuchmore.Seethemanpagesfor zipandunziptofindouthowtousetheseoptions.

Chapter16Vi
vi(1)isthestandardUnixtexteditingprogram,andwhilemasteringitisnotasessentialasitoncewas, isstillaveryrewardinggoal.Thereareseveralversions(orclones)ofviavailable,includingvi,elvis, vile,andvim.OneoftheseisavailableonjustaboutanyversionofUnix,aswellasonLinux.Allof

theseversionsincludethesamebasicfeaturesetandcommands,solearningonecloneshouldmakeit easytolearnanother.WiththevarietyoftexteditorsincludedwithLinuxdistributionsandUnixvariants thesedays,manypeoplenolongerusevi.Still,itremainsthemostuniversaltexteditoracrossUnixand Unixworkalikes.MasteringvimeansyoushouldneverbesittingataUnixmachineandnotbe comfortablewithatleastonepowerfultexteditor.


viincludesanumberofpowerfulfeaturesincludingsyntaxhighlighting,codeformatting,apowerful

searchandreplacemechanism,macros,andmore.Thesefeaturesmakeitespeciallyattractiveto programmers,webdevelopers,andthelike.Systemadministratorswillappreciatetheautomationand integrationwiththeshellthatispossible. OnSlackwareLinux,thedefaultversionofviavailableiselvis.Otherversionsincludingvimand gvimareavailableifyou'veinstalledtheproperpackages.gvimisanXWindowversionofvimthat includestoolbars,detachablemenus,anddialogboxes.

16.1Startingvi
vicanbestartedfromthecommandlineinavarietyofways.Thesimplestformisjust:

%vi

Figure161.Avisession.

Thiswillstartupviwithanemptybuffer.Atthispoint,you'llseeamostlyblankscreen.Itisnowin commandmode,waitingforyoutodosomething.Foradiscussionofthevariousvimodes,seethe Section16.2.Inordertoquitoutofvi,typethefollowing:


:q

Assumingthattherehavebeennochangestothefile,thiswillcausevitoquit.Iftherehavebeen changesmade,itwillwarnyouthattherehavebeenchangesandtellyouhowtodisregardthem. Disregardingchangesusuallymeansappendinganexclamationpointaftertheqlikeso:


:q!

Theexclamationpointusuallymeanstoforcesomeaction.We'lldiscussitandotherkeycombinations infurtherdetailslater. Youcanalsostartviwithapreexistingfile.Forexample,thefile/etc/resolv.confwouldbe openedlikeso:


%vi/etc/resolv.conf

Finally,vicanbestartedonaparticularlineofafile.Thisisespeciallyusefulforprogrammerswhenan errormessageincludesthelinetheirprogrambombedon.Forexample,youcouldstartupvionline47 of/usr/src/linux/init/main.clikeso:


%vi+47/usr/src/linux/init/main.c

viwilldisplaythegivenfileandwillplacethecursoratthespecifiedline.Inthecasewhereyouspecify alinethatisaftertheendofthefile,viwillplacethecursoronthelastline.Thisisespeciallyhelpfulfor

programmers,astheycanjumpstraighttothelocationinthefilethatanerroroccurred,withouthaving tosearchforit.

16.2Modes
vioperatesinvariousmodes,whichareusedtoaccomplishvarioustasks.Whenyoufirststartvi,you

areplacedintocommandmode.Fromthispoint,youcanissuevariouscommandstomanipulatetext, movearoundinthefile,save,quit,andchangemodes.Editingthetextisdoneininsertmode.Youcan quicklymovebetweenmodeswithavarietyofkeystrokes,whichareexplainedbelow.

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

warningscanbesuppressedbyfollowingthecommandwithanexclamationmark. Ifyouwanttoreopenthecurrentfile,youcandososimplybytypinge!.Thisisparticularlyusefulifyou havesomehowmessedupthefileandwanttoreopenit. Someviclones(forexample,vim)allowformultiplebufferstobeopenatthesametime.Forexample, toopenupthefile09vi.sgmlinmyhomedirectorywhileanotherfilewasopen,Iwouldtype:


:split~/09vi.sgml

Thenewfileisdisplayedonthetophalfofthescreen,andtheoldfileisdisplayedinthebottomhalfof thescreen.Therearealotofcommandsthatmanipulatethesplitscreen,andmanyofthesecommands starttoresemblesomethingoutofEmacsThebestplacetolookupthesecommandswouldbetheman pageforyourviclone.Notethatmanyclonesdonotsupportthesplitscreenidea,soyoumightnotbe abletouseitatall.

16.4SavingFiles
Thereareseveralwaystosavefilesinvi.Ifyouwanttosavethecurrentbuffertothefilerandomness, youwouldtype:
:wrandomness

Onceyou'vesavedthefileonce,savingitagainisassimpleastyping:w.Anychangeswillbewritten outtothefile.Afteryou'vesavedthefile,youaredumpedbackintocommandmode.Ifyouwantto savethefileandquitvi(averycommonoperation),youwouldtype:wq.Thattellsvitosavethe currentfileandquitbacktotheshell. Onoccasion,youwanttosaveafilethatismarkedasreadonly.Youcandothisbyaddingan exclamationpointafterthewritecommand,likeso:


:w!

However,therewillstillbeinstanceswhereyoucannotwritethefile(forexample,youareattemptingto editafilethatisownedbyanotheruser).Whenthishappens,viwilltellyouthatitcannotsavethefile. Ifyoureallywanttoeditthefile,you'llhavetocomebackandedititasrootor(preferably)theowner ofthatfile.

16.5Quittingvi
Onewaytoquitviisthrough:wq,whichwillsavethecurrentbufferbeforequitting.Youcanalsoquit withoutsavingwith:qor(morecommonly):q!.Thelatterisusedwhenyou'vemodifiedthefilebutdo notwishtosaveanychangestoit. Onoccasion,yourmachinemightcrashorvimightcrash.However,bothelvisandvimwilltake stepstominimizethedamagetoanyopenbuffers.Botheditorssavetheopenbufferstoatemporaryfile

onoccasion.Thisfileisusuallynamedsimilarlytotheopenfile,butwithadotatthebeginning.This makesthefilehidden. Thistemporaryfilegetsremovedoncetheeditorquitsundernormalconditions.Thismeansthatthe temporarycopywillstillbearoundifsomethingcrashes.Whenyougobacktoeditthefileagain,you willbepromptedforwhatactiontotake.Inmostcases,alargeamountofyourunsavedworkcanbe recovered.elviswillalsosendyouamail(fromGraceland,oddlyenough:)tellingyouthatabackup copyexists.

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

left,down,up,right h,j,k,l Totheendoftheline $ Tothebeginningoftheline ^ Totheendofthefile G Tothebeginningofthefile :1 Toline47 :47

Table162.Editing Operation Removingaline Removingfivelines Replacingacharacter Removingacharacter Removingtencharacters Key dd 5dd r x 10x

Undolastaction u Joincurrentandnextlines J Replaceoldwithnew,globally %s'old'new'g Table163.Searching Operation Key

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

NotethatmanyMetacommandsareparalleltotheControlcommandsexceptthattheyoperateon largerunits:whileCfgoesforwardonecharacter,Mfgoesforwardanentireword,etc. AlsonotethatM<andM>requireyoutotypeShift+Alt+commaandShift+Alt+dotrespectively, since<and>areonShift+commaandShift+dot.(Unlessofcourseyouhaveadifferentkeyboard layoutfromthestandardUSlayout.) NotethatCkdeletes(kills,asitiscommonlycalled)allthetextafterthecursortotheendoftheline, butdoesn'tdeletethelineitself(i.e.,itdoesn'tdeletethefinalnewline).Itonlydeletesthelineifthere wasnotextafterthecursor.Inotherwords,inordertodeleteacompleteline,youhavetoputthe cursoratthebeginningoftheline,andthenhitCktwice:oncetodeletethetextontheline,onceto

deletethelineitself.

17.5SavingFiles
Inordertosaveafile,youtype
CxCs

Emacswillnotaskyouforafilename,thebufferwilljustbesavedtothefileitwasloadedfrom.Ifyou wanttosaveyourtexttoanotherfile,type
CxCw

Whenyousavethefileforthefirsttimeinthissession,Emacswillnormallysavetheoldversionofyour filetoabackupfile,whichhasthesamenameappendedwithatilde:soifyou'reeditingafile cars.txt,Emacswillcreateabackupcars.txt~. Thisbackupfileisacopyofthefilethatyouopened.Whileyouareworking,Emacswillalsoregularly createanautosavecopyoftheworkyouaredoing,toafilenamedwithhashsigns:#cars.txt#.This backupisdeletedwhenyousavethefilewithCxCs. Whenyouaredoneeditingafile,youcankillthebufferthatholdsitbytyping


Cxk

Emacswillthenaskyouwhichbufferyouwanttokill,withthecurrentbufferasdefault,whichyoucan selectbyhittingENTER.Ifyouhaven'tsavedyourfileyet,Emacswillaskyouifyoureallywanttokill thebuffer.

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

Thepackagesystemwillextractthisfileintherootdirectorytoinstallit.Anentryinthepackage databasewillbecreatedthatcontainsthecontentsofthispackagesothatitcanbeupgradedor removedlater. Noticetheinstall/subdirectory.Thisisaspecialdirectorythatcancontainapostinstallationscript calleddoinst.sh.Ifthepackagesystemfindsthisfile,itwillexecuteitafterinstallingthepackage. Otherscriptscanbeembeddedinthepackage,butthosearediscussedmoreindetailinSection18.3.2 below.

18.2PackageUtilities

Therearefourmainutilitiesforpackagemanagement.Theyperforminstallation,removal,andupgrades ofpackages.

18.2.1pkgtool
pkgtool(8)isamenudrivenprogramthatallowsinstallationandremovalofpackages.Themainmenu

isshowninFigure181. Figure181.Pkgtool'smainmenu.

Installationisofferedfromthecurrentdirectory,anotherdirectory,orfromfloppydisks.Simplyselect theinstallationmethodyouwantandpkgtoolwillsearchthatlocationforvalidpackagestoinstall. Youmayalsoviewalistofinstalledpackages,asshowninFigure182. Figure182.Pkgtoolviewmode

Ifyouwanttoremovepackages,selecttheremoveoptionandyouwillbepresentedwithachecklistof alltheinstalledpackages.FlagtheonesyouwanttoremoveandselectOK.pkgtoolwillremove them. Someuserspreferthisutilitytothecommandlineutilities.However,itshouldbenotedthatthe commandlineutilitiesoffermanymoreoptions.Also,theabilitytoupgradepackagesisonlyoffered throughthecommandlineutilities.

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

to/mntorsomethingotherthan/. Theinstalledpackagedatabaseentryisstoredin/var/log/packages.Theentryisreallyjustaplain textfile,oneforeachpackage.Ifthepackagehasapostinstallationscript,itiswrittento /var/log/scripts/. Youmayspecifyseveralpackagesorusewildcardsforthepackagename.Beadvisedthat installpkgwillnottellyouifyouareoverwritinganinstalledpackage.Itwillsimplyinstallrightontop oftheoldone.Ifyouwanttoensurethatoldfilesfromthepreviouspackagearesafelyremoved,use upgradepkg.

18.2.3removepkg
removepkg(8)handlesremovinginstalledpackagesfromthesystem.Thesyntaxisasfollows:

#removepkgoptionpackage_name

Fouroptionsareprovidedforremovepkg.Onlyoneoptionmaybeusedatatime. Table182.removepkgOptions Option copy Effects Thepackageiscopiedtothepreservedpackagesdirectory.Thiscreatesatreeoftheoriginal packagewithoutremovingit. Savestemporaryfilescreatedduringtheremoval.Reallyonlyusefulfordebuggingpurposes.

keep Thepackageisremoved,butcopiedtothepreservedpackagesdirectoryatthesametime. preserve warn Showswhatwouldhappenifyouremovedthepackage.

IfyoupasstheROOTenvironmentvariablebeforeremovepkg,thatpathwillbeusedfortheroot directory.Thisisusefulforsettingupnewdrivesforyourrootdirectory.Theywilltypicallybemounted to/mntorsomethingotherthan/.


removepkglooksattheotherinstalledpackagesandonlyremovesfilesuniquetothepackageyou

specify.Itwillalsoscanthepostinstallationscriptforthespecifiedpackageandremoveanysymbolic linksthatwerecreatedbyit. Duringtheremovalprocess,astatusreportisdisplayed.Aftertheremoval,thepackagedatabaseentry ismovedto/var/log/removed_packagesandthepostinstallationscriptismovedto /var/log/removed_scripts. Justaswithinstallpkg,youcanspecifyseveralpackagesorusewildcardsforthepackagename.

18.2.4upgradepkg
upgradepkg(8)willupgradeaninstalledSlackwarepackage.Thesyntaxisasfollows:

#upgradepkgpackage_name

or
#upgradepkgold_package_name%new_package_name upgradepkgworksbyfirstinstallingthenewpackageandthenremovingtheoldpackagesothatold

filesarenolongeraroundonthesystem.Iftheupgradedpackagenamehaschanged,usethepercent signsyntaxtospecifytheoldpackage(theonethatisinstalled)andthenewpackage(theoneyouare upgradingitto). IfyoupasstheROOTenvironmentvariablebeforeupgradepkg,thatpathwillbeusedfortheroot directory.Thisisusefulforsettingupnewdrivesforyourrootdirectory.Theywilltypicallybemounted to/mntorsomethingotherthan/.


upgradepkgisnotflawless.Youshouldalwaysbackupyourconfigurationfiles.Iftheygetremovedor

overwritten,you'llwantacopyoftheoriginalsforanyneededrepairwork. Justaswithinstallpkgandremovepkg,youcanspecifyseveralpackagesorusewildcardsforthe packagename.

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.

IfyoulookattheSlackwaresourcetree,youwillseehowweusethiscommandforframework packages.Thesepackagescontainaskeletonofwhatthefinalpackagewilllooklike.Theyholdallthe necessaryfilenames(zerolength),permissions,andownerships.Thebuildscriptwillcatthepackage contentsfromthesourcedirectorytothepackagebuilddirectory.

18.3.2makepkg
makepkg(8)willpackageupthecurrentdirectoryintoavalidSlackwarepackage.Itwillsearchthetree

foranysymboliclinksandaddacreationblocktothepostinstallationscriptforcreatingthemduringthe packageinstall.Italsowarnsofanyzerolengthfilesinthepackagetree. Thiscommandistypicallyrunafteryouhavecreatedyourpackagetree.

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

Meaning Thepackageisrequiredforpropersystemoperation Thepackagewillbeautomaticallyskipped Thepackageisnotrequired,butrecommended Thepackageisoptional

Onepackageperline.Theoriginaltagfilesforeachsoftwareseriesarestoredastagfile.org.Soifyou

messupyours,youcanrestoretheoriginalone. Manyadministratorspreferwritingtheirowntagfilesandstartingtheinstallerandselectingfull.The setupprogramwillreadthetagfilesandperformtheinstallationaccordingtotheircontents.Ifyouuse RECorOPT,adialogboxwillbepresentedtotheuseraskingwhetherornottheywantaparticular package.Therefore,itisrecommendedthatyoustickwithADDandSKPwhenwritingtagfilesfor automatedinstalls. Justmakesureyourtagfilesarewrittentothesamelocationastheoriginals.Oryoucanspecifya customtagfilepathifyouhavecustomtagfiles.

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.

Loginasroot,withnopassword.You'llprobablywanttosetapasswordforroot,aswellasadding anaccountforyourself.Atthispointyoucanrefertotheothersectionsinthisbookforgeneralsystem usage. IfusingtheLINUX.BATfiletobootthesystemdidn'tworkforyou,youshouldrefertotheincluded C:\LINUX\README.1STfileforotherwaystoboot.

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

SUCHDAMAGES. ENDOFTERMSANDCONDITIONS A.3.HowtoApplyTheseTermstoYourNewPrograms Ifyoudevelopanewprogram,andyouwantittobeofthegreatestpossibleusetothepublic,thebest waytoachievethisistomakeitfreesoftwarewhicheveryonecanredistributeandchangeunderthese terms. Todoso,attachthefollowingnoticestotheprogram.Itissafesttoattachthemtothestartofeach sourcefiletomosteffectivelyconveytheexclusionofwarrantyandeachfileshouldhaveatleastthe copyrightlineandapointertowherethefullnoticeisfound.


<onelinetogivetheprogram'snameandabriefideaofwhatitdoes.> Copyright(C)<year><nameofauthor> Thisprogramisfreesoftwareyoucanredistributeitand/ormodify itunderthetermsoftheGNUGeneralPublicLicenseaspublishedby theFreeSoftwareFoundationeitherversion2oftheLicense,or (atyouroption)anylaterversion. Thisprogramisdistributedinthehopethatitwillbeuseful, butWITHOUTANYWARRANTYwithouteventheimpliedwarrantyof MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe GNUGeneralPublicLicenseformoredetails. YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogramifnot,writetotheFreeSoftware Foundation,Inc.,59TemplePlace,Suite330,Boston,MA021111307USA

Alsoaddinformationonhowtocontactyoubyelectronicandpapermail. Iftheprogramisinteractive,makeitoutputashortnoticelikethiswhenitstartsinaninteractivemode:
Gnomovisionversion69,Copyright(C)yearnameofauthor GnomovisioncomeswithABSOLUTELYNOWARRANTYfordetailstype`showw'. Thisisfreesoftware,andyouarewelcometoredistributeit undercertainconditionstype`showc'fordetails.

Thehypotheticalcommands`showw'and`showc'shouldshowtheappropriatepartsoftheGeneral PublicLicense.Ofcourse,thecommandsyouusemaybecalledsomethingotherthan`showw'and `showc'theycouldevenbemouseclicksormenuitemswhateversuitsyourprogram. Youshouldalsogetyouremployer(ifyouworkasaprogrammer)oryourschool,ifany,tosigna copyrightdisclaimerfortheprogram,ifnecessary.Hereisasamplealterthenames:


Yoyodyne,Inc.,herebydisclaimsallcopyrightinterestintheprogram `Gnomovision'(whichmakespassesatcompilers)writtenbyJamesHacker. <signatureofTyCoon>,1April1989 TyCoon,PresidentofVice

ThisGeneralPublicLicensedoesnotpermitincorporatingyourprogramintoproprietaryprograms.If yourprogramisasubroutinelibrary,youmayconsideritmoreusefultopermitlinkingproprietary applicationswiththelibrary.Ifthisiswhatyouwanttodo,usetheGNULibraryGeneralPublicLicense insteadofthisLicense.

Vous aimerez peut-être aussi