Table Of ContentLinux Essentials
The LPI Introductory
Programme
LinupFrontGmbH
Postfach100121 64201Darmstadt Germany
⋅ ⋅
Telefon+49(0)615190670 Telefax+49(0)61519067299
⋅
www.linupfront.de
TheLinuxEssentialslogodoesnotimplythatthistrainingmanualwas
checkedorendorsedbytheLinuxProfessionalInstitute(LPI).
TheLPIdoesnotendorsespecificexampreparationmethodsormate-
rials. Furtherinformationisavailablefromhttp://www.lpi.org/.
LinuxEssentials TheLPIIntroductoryProgramme
Revision:lxes:54d12fc97784892b:2012-05-11
adm1:62522705f117f22a:2012-05-11 13–14
grd1:822549a3d13cac8e:2012-05-11 4–11,B
lxes:7ef0d045e4cceb6c:2012-05-11 1–3,12,15
lxes:HacJlmLhsTatn7YZSqqfhF
©2012LinupFrontGmbH Darmstadt
http://www.linupfront.de [email protected]
⋅
Authors: TobiasElsner,ThomasErker,AnselmLingnau
TechnicalEditor: AnselmLingnau [email protected]
⟨ ⟩
TypesetinPalatino,OptimaandDejaVuSansMono
About Ourselves
Who We Are
Since2001,LinupFrontGmbHofferstrainingmaterialsandinstructor
servicesforLinuxandfree/open-sourcesoftware—competentlyandre-
liably, in Germany and abroad. As a leading enterprise we stand for
uncompromisingquality,customer-orientedflexibility,andfairprices.
Linux Essentials
You can download the Linux Essentials app, in English and German,
fromtheGooglePlayStore. AfreelyredistributablePDFversionofthis
training manual for printing and giving away is available from Linup
FrontGmbH’sonlineshopathttp://shop.linupfront.com/.
Inouronlineshop,wealsoofferadditionaltrainingmanualsforLinux
andFLOSStopics. Weshipprintedmanuals(withinGermanyandthe
EU)andalsodelivermanualsinPDFande-bookformats.
We Would Like To Hear From You!
Wearehappytohearyourcommentsandsuggestions. Getintouchby
[email protected]. Morewaysofreachingusarelisted
inouronlineshop.
3
Important
All representations and information contained in this document have
beencompiledtothebestofourknowledgeandcarefullytested. How-
ever,mistakescannotberuledoutcompletely. TheauthorsandLinup
FrontGmbHassumenoresponsibilityorliabilityresultinginanyway
fromtheuseofthismaterialorpartsofitorfromanyviolationofthe
rightsofthirdparties.
Reproductionoftrademarks,servicemarksandsimilarmonikersinthis
document,evenifnotspeciallymarked,doesnotimplythestipulation
thatthesemaybefreelyusableaccordingtotrademarkprotectionlaws.
Alltrademarksareusedwithoutawarrantyoffreeusabilityandmay
beregisteredtrademarksofthirdparties.
This work is protected by copyright. All rights, particularly those of
translations to foreign languages, are reserved. No part of this docu-
ment may be photocopied or otherwise reproduced or translated into
a machine-readable representation without the express permission of
LinupFrontGmbH.
Machine-readablerepresentationsofthisdocument,particularlyHTML
orPDFversions,aremadeavailableforpersonaluseonlyandmaynot
be distributed without the express permission of Linup Front GmbH.
Thesamerestrictionsapplytoprintoutsofsuchrepresentations.
4
Contents
1 Computers,SoftwareandOperatingSystems 16
1.1 WhatIsAComputer,Anyway?. . . . . . . . . . . 17
1.2 ComponentsOfAComputer . . . . . . . . . . . 20
1.3 Software . . . . . . . . . . . . . . . . . . . 28
1.4 TheMostImportantOperatingSystems. . . . . . . . 30
1.4.1 WindowsAndOSX. . . . . . . . . . . . . 30
1.4.2 Linux . . . . . . . . . . . . . . . . . . 32
1.4.3 MoreDifferencesAndSimilarities. . . . . . . . 33
1.5 Summary. . . . . . . . . . . . . . . . . . . 35
2 LinuxandFreeSoftware 37
2.1 Linux: ASuccessStory . . . . . . . . . . . . . . 38
2.2 FreeOrOpenSource? . . . . . . . . . . . . . . 44
2.2.1 CopyrightAnd“FreeSoftware” . . . . . . . . 44
2.2.2 Licences . . . . . . . . . . . . . . . . . 49
2.2.3 TheGPL . . . . . . . . . . . . . . . . . 52
2.2.4 OtherLicences. . . . . . . . . . . . . . . 56
2.3 ImportantFreeSoftware . . . . . . . . . . . . . 61
2.3.1 Overview . . . . . . . . . . . . . . . . 61
2.4 OfficeandProductivityTools . . . . . . . . . . . 62
2.4.1 GraphicsandMultimediaTools . . . . . . . . 63
2.4.2 InternetServices . . . . . . . . . . . . . . 65
2.4.3 InfrastructureSoftware. . . . . . . . . . . . 65
2.4.4 ProgrammingLanguagesandDevelopment . . . . 66
2.5 ImportantLinuxDistributions . . . . . . . . . . . 68
2.5.1 Overview . . . . . . . . . . . . . . . . 68
2.5.2 RedHat . . . . . . . . . . . . . . . . . 69
2.5.3 SUSE . . . . . . . . . . . . . . . . . . 70
2.5.4 Debian . . . . . . . . . . . . . . . . . 72
2.5.5 Ubuntu . . . . . . . . . . . . . . . . . 74
2.5.6 Others. . . . . . . . . . . . . . . . . . 75
2.5.7 DifferencesandSimilarities . . . . . . . . . . 76
3 FirstStepswithLinux 82
3.1 LoggingInandOut . . . . . . . . . . . . . . . 83
3.2 DesktopEnvironmentandBrowser . . . . . . . . . 87
3.2.1 GraphicalDesktopEnvironments . . . . . . . . 87
3.2.2 Browsers. . . . . . . . . . . . . . . . . 89
3.2.3 TerminalsandShells. . . . . . . . . . . . . 90
3.3 CreatingandModifyingTextFiles. . . . . . . . . . 92
4 Who’sAfraidOfTheBigBadShell? 101
4.1 Why? . . . . . . . . . . . . . . . . . . . . 102
4.1.1 WhatIsTheShell? . . . . . . . . . . . . . 103
4.2 Commands . . . . . . . . . . . . . . . . . . 106
4.2.1 WhyCommands?. . . . . . . . . . . . . . 106
4.2.2 CommandStructure. . . . . . . . . . . . . 106
4.2.3 CommandTypes . . . . . . . . . . . . . . 108
4.2.4 EvenMoreRules . . . . . . . . . . . . . . 110
5 GettingHelp 113
5.1 Self-Help. . . . . . . . . . . . . . . . . . . 114
5.2 Thehelp Commandandthe--help Option . . . . . . . 115
5.3 TheOn-LineManual . . . . . . . . . . . . . . 116
5.3.1 Overview . . . . . . . . . . . . . . . . 116
5.3.2 Structure. . . . . . . . . . . . . . . . . 117
5.3.3 Chapters . . . . . . . . . . . . . . . . . 118
5.3.4 DisplayingManualPages. . . . . . . . . . . 119
5.4 InfoPages . . . . . . . . . . . . . . . . . . 122
5.5 HOWTOs. . . . . . . . . . . . . . . . . . . 124
5.6 FurtherInformationSources. . . . . . . . . . . . 125
6
6 Files: CareandFeeding 130
6.1 FileandPathNames. . . . . . . . . . . . . . . 131
6.1.1 FileNames . . . . . . . . . . . . . . . . 131
6.1.2 Directories . . . . . . . . . . . . . . . . 134
6.1.3 AbsoluteandRelativePathNames . . . . . . . 135
6.2 DirectoryCommands . . . . . . . . . . . . . . 138
6.2.1 TheCurrentDirectory: cd &Co. . . . . . . . . 138
6.2.2 ListingFilesandDirectories—ls . . . . . . . . 139
6.2.3 CreatingandDeletingDirectories: mkdir andrmdir . . 143
6.3 FileSearchPatterns . . . . . . . . . . . . . . . 145
6.3.1 SimpleSearchPatterns. . . . . . . . . . . . 145
6.3.2 CharacterClasses. . . . . . . . . . . . . . 147
6.3.3 Braces . . . . . . . . . . . . . . . . . . 149
6.4 HandlingFiles . . . . . . . . . . . . . . . . . 151
6.4.1 Copying,MovingandDeleting—cp andFriends. . . 151
6.4.2 LinkingFiles—ln andln -s . . . . . . . . . . 155
6.4.3 DisplayingFileContent—more andless . . . . . . 160
6.4.4 SearchingFiles—find . . . . . . . . . . . . 162
6.4.5 FindingFilesQuickly—locate andslocate . . . . . 167
7 RegularExpressions 173
7.1 RegularExpressions: TheBasics . . . . . . . . . . 174
7.1.1 RegularExpressions: Extras . . . . . . . . . . 175
7.2 SearchingFilesforText—grep . . . . . . . . . . . 178
8 StandardI/OandFilterCommands 184
8.1 I/ORedirectionandCommandPipelines . . . . . . . 185
8.1.1 StandardChannels . . . . . . . . . . . . . 185
8.1.2 RedirectingStandardChannels. . . . . . . . . 188
8.1.3 CommandPipelines. . . . . . . . . . . . . 192
8.2 FilterCommands . . . . . . . . . . . . . . . . 195
8.3 ReadingandWritingFiles. . . . . . . . . . . . . 197
8.3.1 OutputtingandConcatenatingTextFiles—cat . . . 197
8.3.2 BeginningandEnd—head andtail. . . . . . . . 198
7
8.4 DataManagement . . . . . . . . . . . . . . . 201
8.4.1 SortedFiles—sort anduniq . . . . . . . . . . 201
8.4.2 ColumnsandFields—cut,paste etc. . . . . . . . 210
9 MoreAboutTheShell 217
9.1 SimpleCommands: sleep,echo,anddate. . . . . . . . 218
9.2 ShellVariablesandTheEnvironment. . . . . . . . . 221
9.3 CommandTypes–Reloaded. . . . . . . . . . . . 224
9.4 TheShellAsAConvenientTool . . . . . . . . . . 228
9.5 CommandsFromAFile . . . . . . . . . . . . . 233
9.6 TheShellAsAProgrammingLanguage. . . . . . . . 235
10 TheFileSystem 244
10.1 Terms . . . . . . . . . . . . . . . . . . . . 245
10.2 FileTypes. . . . . . . . . . . . . . . . . . . 247
10.3 TheLinuxDirectoryTree . . . . . . . . . . . . . 249
10.4 DirectoryTreeandFileSystems. . . . . . . . . . . 263
11 ArchivingandCompressingFiles 268
11.1 ArchivalandCompression . . . . . . . . . . . . 269
11.2 ArchivingFilesUsingtar . . . . . . . . . . . . . 271
11.3 CompressingFileswithgzip . . . . . . . . . . . . 277
11.4 CompressingFileswithbzip2. . . . . . . . . . . . 280
11.5 ArchivingandCompressingFilesUsingzip andunzip. . . 282
12 IntroductiontoSystemAdministration 290
12.1 SystemAdministrationBasics . . . . . . . . . . . 291
12.2 SystemConfiguration . . . . . . . . . . . . . . 294
12.3 Processes. . . . . . . . . . . . . . . . . . . 297
12.4 PackageManagement . . . . . . . . . . . . . . 304
13 UserAdministration 309
13.1 Basics . . . . . . . . . . . . . . . . . . . . 310
13.1.1 WhyUsers?. . . . . . . . . . . . . . . . 310
13.1.2 UsersandGroups . . . . . . . . . . . . . 312
8
13.1.3 PeopleandPseudo-Users . . . . . . . . . . . 316
13.2 UserandGroupInformation. . . . . . . . . . . . 318
13.2.1 The/etc/passwd File . . . . . . . . . . . . . 318
13.2.2 The/etc/shadow File . . . . . . . . . . . . . 322
13.2.3 The/etc/group File . . . . . . . . . . . . . 327
13.2.4 The/etc/gshadow File . . . . . . . . . . . . . 328
13.3 ManagingUserAccountsandGroupInformation . . . . 330
13.3.1 CreatingUserAccounts . . . . . . . . . . . 330
13.3.2 Thepasswd Command . . . . . . . . . . . . 333
13.3.3 DeletingUserAccounts . . . . . . . . . . . 336
13.3.4 ChangingUserAccountsandGroupAssignment . . 337
13.3.5 ChangingUserInformationDirectly—vipw. . . . . 338
13.3.6 Creating,ChangingandDeletingGroups . . . . . 339
14 AccessControl 344
14.1 TheLinuxAccessControlSystem . . . . . . . . . . 345
14.2 AccessControlForFilesAndDirectories . . . . . . . 346
14.2.1 TheBasics . . . . . . . . . . . . . . . . 346
14.2.2 InspectingandChangingAccessPermissions. . . . 347
14.2.3 SpecifyingFileOwnersandGroups—chown andchgrp . 350
14.3 ProcessOwnership . . . . . . . . . . . . . . . 352
14.4 SpecialPermissionsforExecutableFiles. . . . . . . . 353
14.5 SpecialPermissionsforDirectories . . . . . . . . . 355
15 LinuxNetworking 361
15.1 NetworkingBasics . . . . . . . . . . . . . . . 362
15.1.1 IntroductionandProtocols . . . . . . . . . . 362
15.1.2 AddressingandRouting . . . . . . . . . . . 364
15.1.3 NamesandtheDNS. . . . . . . . . . . . . 368
15.1.4 IPv6 . . . . . . . . . . . . . . . . . . 369
15.2 LinuxAsANetworkingClient . . . . . . . . . . . 373
15.2.1 Requirements . . . . . . . . . . . . . . . 373
15.2.2 Troubleshooting . . . . . . . . . . . . . . 375
A SampleSolutions 387
9
B ExampleFiles 411
C LinuxEssentialsCertification 416
C.1 ExamObjectiveOverview. . . . . . . . . . . . . 417
C.2 ExamObjectivesForLinuxEssentials . . . . . . . . . 419
D CommandIndex 431
Index 436
10
Description:6.6 Test conditions for find .. which may contain conditions and loops. And things are . external disks, one uses USB or eSATA (a variant of SATA with sile launchers to annoy your cubicle neighbours, and so on. The grammer's life as easy as their more expensive relations.