CompTIA Linux+ XK0-005 Cert Guide (2024)
CompTIA Linux+ XK0-005 Cert Guide (2024) provides everything you need to pass your certification test.
David Rodriguez
Contributor
4.9
37
about 2 months ago
Preview (31 of 906)
Sign in to access the full document!
CompTIA® Linux+ XK0-005 Cert Guide
Companion Website and Pearson Test Prep Access Code
Access interactive study tools on this book’s companion website, including
practice test software, review exercises, Key Term flash card application, a study
planner, and more!
To access the companion website, simply follow these steps:
1. Go to www.pearsonitcertification.com/register.
2. Enter the print book ISBN: 9780137866885.
3. Answer the security question to validate your purchase.
4. Go to your account page.
5. Click on the Registered Products tab.
6. Under the book listing, click on the Access Bonus Content link.
When you register your book, your Pearson Test Prep practice test access code
will automatically be populated with the book listing under the Registered
Products tab. You will need this code to access the practice test that comes with
this book. You can redeem the code at PearsonTestPrep.com. Simply choose
Pearson IT Certification as your product group and log in to the site with the
same credentials you used to register your book. Click the Activate New
Product button and enter the access code. More detailed instructions on how to
redeem your access code for both the online and desktop versions can be found
on the companion website.
If you have any issues accessing the companion website or obtaining your
Pearson Test Prep practice test access code, you can contact our support team
by going to pearsonitp.echelp.org.
Companion Website and Pearson Test Prep Access Code
Access interactive study tools on this book’s companion website, including
practice test software, review exercises, Key Term flash card application, a study
planner, and more!
To access the companion website, simply follow these steps:
1. Go to www.pearsonitcertification.com/register.
2. Enter the print book ISBN: 9780137866885.
3. Answer the security question to validate your purchase.
4. Go to your account page.
5. Click on the Registered Products tab.
6. Under the book listing, click on the Access Bonus Content link.
When you register your book, your Pearson Test Prep practice test access code
will automatically be populated with the book listing under the Registered
Products tab. You will need this code to access the practice test that comes with
this book. You can redeem the code at PearsonTestPrep.com. Simply choose
Pearson IT Certification as your product group and log in to the site with the
same credentials you used to register your book. Click the Activate New
Product button and enter the access code. More detailed instructions on how to
redeem your access code for both the online and desktop versions can be found
on the companion website.
If you have any issues accessing the companion website or obtaining your
Pearson Test Prep practice test access code, you can contact our support team
by going to pearsonitp.echelp.org.
This page intentionally left blank
Loading page 4...
CompTIA® Linux+
XK0-005 Cert Guide
Ross Brunson
Hoboken, New Jersey
XK0-005 Cert Guide
Ross Brunson
Hoboken, New Jersey
Loading page 5...
CompTIA® Linux+ XK0-005 Cert Guide
Copyright © 2024 by Pearson Education, Inc.
All rights reserved. This publication is protected by copyright, and
permission must be obtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise.
For information regarding permissions, request forms, and the appropri-
ate contacts within the Pearson Education Global Rights & Permissions
Department, please visit www.pearson.com/permissions.
No patent liability is assumed with respect to the use of the information
contained herein. Although every precaution has been taken in the
preparation of this book, the publisher and author assume no responsibility
for errors or omissions. Nor is any liability assumed for damages resulting
from the use of the information contained herein.
ISBN-13: 978-0-13-786688-5
ISBN-10: 0-13-786688-7
Library of Congress Control Number: 2023913510
$PrintCode
Trademarks
All terms mentioned in this book that are known to be trademarks or
service marks have been appropriately capitalized. Pearson IT Certification
cannot attest to the accuracy of this information. Use of a term in this book
should not be regarded as affecting the validity of any trademark or service
mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate
as possible, but no warranty or fitness is implied. The information provided
is on an “as is” basis. The author and the publisher shall have neither
liability nor responsibility to any person or entity with respect to any loss
or damages arising from the information contained in this book.
Special Sales
For information about buying this title in bulk quantities, or for special
sales opportunities (which may include electronic versions; custom cover
designs; and content particular to your business, training goals, marketing
focus, or branding interests), please contact our corporate sales department
at corpsales@pearsoned.com or (800) 382-3419.
For government sales inquiries, please contact
governmentsales@pearsoned.com.
For questions about sales outside the U.S., please contact
intlcs@pearson.com.
Vice President,
IT Professional
Mark Taub
Director, ITP Product
Line Management
Brett Bartow
Executive Editor
Nancy Davis
Development Editor
Ellie Bru
Managing Editor
Sandra Schroeder
Senior Project Editor
Mandie Frank
Copy Editor
Bill McManus
Indexer
Ken Johnson
Proofreader
Jennifer Hinchliffe
Technical Editor
Casey Boyles
Publishing Coordinator
Cindy Teeters
Designer
Chuti Prasertsith
Compositor
codeMantra
Copyright © 2024 by Pearson Education, Inc.
All rights reserved. This publication is protected by copyright, and
permission must be obtained from the publisher prior to any prohibited
reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise.
For information regarding permissions, request forms, and the appropri-
ate contacts within the Pearson Education Global Rights & Permissions
Department, please visit www.pearson.com/permissions.
No patent liability is assumed with respect to the use of the information
contained herein. Although every precaution has been taken in the
preparation of this book, the publisher and author assume no responsibility
for errors or omissions. Nor is any liability assumed for damages resulting
from the use of the information contained herein.
ISBN-13: 978-0-13-786688-5
ISBN-10: 0-13-786688-7
Library of Congress Control Number: 2023913510
$PrintCode
Trademarks
All terms mentioned in this book that are known to be trademarks or
service marks have been appropriately capitalized. Pearson IT Certification
cannot attest to the accuracy of this information. Use of a term in this book
should not be regarded as affecting the validity of any trademark or service
mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate
as possible, but no warranty or fitness is implied. The information provided
is on an “as is” basis. The author and the publisher shall have neither
liability nor responsibility to any person or entity with respect to any loss
or damages arising from the information contained in this book.
Special Sales
For information about buying this title in bulk quantities, or for special
sales opportunities (which may include electronic versions; custom cover
designs; and content particular to your business, training goals, marketing
focus, or branding interests), please contact our corporate sales department
at corpsales@pearsoned.com or (800) 382-3419.
For government sales inquiries, please contact
governmentsales@pearsoned.com.
For questions about sales outside the U.S., please contact
intlcs@pearson.com.
Vice President,
IT Professional
Mark Taub
Director, ITP Product
Line Management
Brett Bartow
Executive Editor
Nancy Davis
Development Editor
Ellie Bru
Managing Editor
Sandra Schroeder
Senior Project Editor
Mandie Frank
Copy Editor
Bill McManus
Indexer
Ken Johnson
Proofreader
Jennifer Hinchliffe
Technical Editor
Casey Boyles
Publishing Coordinator
Cindy Teeters
Designer
Chuti Prasertsith
Compositor
codeMantra
Loading page 6...
Pearson’s Commitment to Diversity, Equity, and
Inclusion
Pearson is dedicated to creating bias-free content that reflects the diversity of all
learners. We embrace the many dimensions of diversity, including but not limited
to race, ethnicity, gender, socioeconomic status, ability, age, sexual orientation, and
religious or political beliefs.
Education is a powerful force for equity and change in our world. It has the poten-
tial to deliver opportunities that improve lives and enable economic mobility. As we
work with authors to create content for every product and service, we acknowledge
our responsibility to demonstrate inclusivity and incorporate diverse scholarship so
that everyone can achieve their potential through learning. As the world’s leading
learning company, we have a duty to help drive change and live up to our purpose to
help more people create a better life for themselves and to create a better world.
Our ambition is to purposefully contribute to a world where
■ Everyone has an equitable and lifelong opportunity to succeed through
learning
■ Our educational products and services are inclusive and represent the rich
diversity of learners
■ Our educational content accurately reflects the histories and experiences of the
learners we serve
■ Our educational content prompts deeper discussions with learners and motivates
them to expand their own learning (and worldview)
While we work hard to present unbiased content, we want to hear from you about
any concerns or needs with this Pearson product so that we can investigate and
address them.
Please contact us with concerns about any potential bias at
https://www.pearson.com/report-bias.html.
Inclusion
Pearson is dedicated to creating bias-free content that reflects the diversity of all
learners. We embrace the many dimensions of diversity, including but not limited
to race, ethnicity, gender, socioeconomic status, ability, age, sexual orientation, and
religious or political beliefs.
Education is a powerful force for equity and change in our world. It has the poten-
tial to deliver opportunities that improve lives and enable economic mobility. As we
work with authors to create content for every product and service, we acknowledge
our responsibility to demonstrate inclusivity and incorporate diverse scholarship so
that everyone can achieve their potential through learning. As the world’s leading
learning company, we have a duty to help drive change and live up to our purpose to
help more people create a better life for themselves and to create a better world.
Our ambition is to purposefully contribute to a world where
■ Everyone has an equitable and lifelong opportunity to succeed through
learning
■ Our educational products and services are inclusive and represent the rich
diversity of learners
■ Our educational content accurately reflects the histories and experiences of the
learners we serve
■ Our educational content prompts deeper discussions with learners and motivates
them to expand their own learning (and worldview)
While we work hard to present unbiased content, we want to hear from you about
any concerns or needs with this Pearson product so that we can investigate and
address them.
Please contact us with concerns about any potential bias at
https://www.pearson.com/report-bias.html.
Loading page 7...
This page intentionally left blank
Loading page 8...
Contents at a Glance
Introduction xliii
Part I: System Management (Obj. 1.1 - 1.7)
CHAPTER 1 Understanding Linux Fundamentals 3
CHAPTER 2 Managing Files and Directories 43
CHAPTER 3 Configuring and Managing Storage 101
CHAPTER 4 Managing Processes and Services 139
CHAPTER 5 Using Network Tools and Configuration Files 185
CHAPTER 6 Building and Installing Software 225
CHAPTER 7 Managing Software Configurations 281
Part II: Security (Obj. 2.1 - 2.5)
CHAPTER 8 Understanding Linux Security Best Practices 321
CHAPTER 9 Implementing Identity Management 353
CHAPTER 10 Implementing and Configuring Firewalls 379
CHAPTER 11 Using Remote Connectivity for System Management 405
CHAPTER 12 Understanding and Applying Access Controls 427
Part III: Scripting, Containers, and Automation (Obj. 3.1 - 3.5)
CHAPTER 13 Automating Tasks via Shell Scripting 463
CHAPTER 14 Perform Basic Container Operations 523
CHAPTER 15 Performing Basic Version Control Using Git 539
CHAPTER 16 Understanding Infrastructure as Code 573
CHAPTER 17 Understanding Containers, Cloud, and Orchestration 597
Part IV: Troubleshooting (Obj. 4.1 - 4.5)
CHAPTER 18 Analyzing and Troubleshooting Storage Issues 619
CHAPTER 19 Analyzing and Troubleshooting Network Resource Issues 667
CHAPTER 20 Analyzing and Troubleshooting CPU and Memory Issues 701
Introduction xliii
Part I: System Management (Obj. 1.1 - 1.7)
CHAPTER 1 Understanding Linux Fundamentals 3
CHAPTER 2 Managing Files and Directories 43
CHAPTER 3 Configuring and Managing Storage 101
CHAPTER 4 Managing Processes and Services 139
CHAPTER 5 Using Network Tools and Configuration Files 185
CHAPTER 6 Building and Installing Software 225
CHAPTER 7 Managing Software Configurations 281
Part II: Security (Obj. 2.1 - 2.5)
CHAPTER 8 Understanding Linux Security Best Practices 321
CHAPTER 9 Implementing Identity Management 353
CHAPTER 10 Implementing and Configuring Firewalls 379
CHAPTER 11 Using Remote Connectivity for System Management 405
CHAPTER 12 Understanding and Applying Access Controls 427
Part III: Scripting, Containers, and Automation (Obj. 3.1 - 3.5)
CHAPTER 13 Automating Tasks via Shell Scripting 463
CHAPTER 14 Perform Basic Container Operations 523
CHAPTER 15 Performing Basic Version Control Using Git 539
CHAPTER 16 Understanding Infrastructure as Code 573
CHAPTER 17 Understanding Containers, Cloud, and Orchestration 597
Part IV: Troubleshooting (Obj. 4.1 - 4.5)
CHAPTER 18 Analyzing and Troubleshooting Storage Issues 619
CHAPTER 19 Analyzing and Troubleshooting Network Resource Issues 667
CHAPTER 20 Analyzing and Troubleshooting CPU and Memory Issues 701
Loading page 9...
viii CompTIA® Linux+ XK0-005 Cert Guide
CHAPTER 21 Analyzing and Troubleshooting User and File Permissions 725
CHAPTER 22 Analyzing and Troubleshooting Common Problems Using
Systemd 743
CHAPTER 23 Final Preparation 765
APPENDIX A Answers to the “Do I Know This Already?” Quizzes and Review
Questions 773
Glossary 790
Index 809
Online Elements
APPENDIX B Study Planner
CHAPTER 21 Analyzing and Troubleshooting User and File Permissions 725
CHAPTER 22 Analyzing and Troubleshooting Common Problems Using
Systemd 743
CHAPTER 23 Final Preparation 765
APPENDIX A Answers to the “Do I Know This Already?” Quizzes and Review
Questions 773
Glossary 790
Index 809
Online Elements
APPENDIX B Study Planner
Loading page 10...
Table of Contents
Introduction xliii
Part I: System Management (Obj. 1.1 - 1.7)
Chapter 1 Understanding Linux Fundamentals 3
“Do I Know This Already?” Quiz 3
Foundation Topics 6
Filesystem Hierarchy Standard 6
What Goes Where in the FHS 6
The Root of the Filesystem 6
Where to Put Programs 7
Basic Boot Process 8
What Is the Boot Process? 8
System Boot Options 9
initrd and initramfs 9
Booting with UEFI 10
Booting via PXE 11
Booting via NFS 12
Booting via ISO 13
Boot Loaders and Files 14
GRUB Legacy 15
GRUB2 15
Changes Made for GRUB2 15
GRUB2 Command Names 16
Installing GRUB2 17
Using the GRUB2 Command Line 18
Demystifying Kernel Images 19
Configuring GRUB2 20
Common Commands at Boot Time 21
When Kernels Panic 22
Identifying a Kernel Panic 22
Getting More Information 22
Kernel Panic Causes 23
Introduction xliii
Part I: System Management (Obj. 1.1 - 1.7)
Chapter 1 Understanding Linux Fundamentals 3
“Do I Know This Already?” Quiz 3
Foundation Topics 6
Filesystem Hierarchy Standard 6
What Goes Where in the FHS 6
The Root of the Filesystem 6
Where to Put Programs 7
Basic Boot Process 8
What Is the Boot Process? 8
System Boot Options 9
initrd and initramfs 9
Booting with UEFI 10
Booting via PXE 11
Booting via NFS 12
Booting via ISO 13
Boot Loaders and Files 14
GRUB Legacy 15
GRUB2 15
Changes Made for GRUB2 15
GRUB2 Command Names 16
Installing GRUB2 17
Using the GRUB2 Command Line 18
Demystifying Kernel Images 19
Configuring GRUB2 20
Common Commands at Boot Time 21
When Kernels Panic 22
Identifying a Kernel Panic 22
Getting More Information 22
Kernel Panic Causes 23
Loading page 11...
x CompTIA® Linux+ XK0-005 Cert Guide
Device Types in /dev 23
Installing Software from Source 24
Components of a Source Code Install 26
The Makefile 26
Example of a Compilation of Source Code 27
Storage Concepts 28
Partitions 28
MBR 29
GPT 29
Data Storage Methods 29
Block Storage 30
File Storage 30
Object Storage 31
FUSE (Filesystem in Userspace) 31
Why Use a FUSE? 31
Handling FUSE User Requests 32
Possible FUSE Applications/Uses 32
RAID 32
RAID Levels 33
Mirroring 34
Striping 34
Parity 35
Listing Your Hardware Info 35
The Proc Filesystem 36
Notable ls* Commands 36
Friends of procfs 37
The dmidecode Command 37
Displaying DMI Table Information 37
Summary 38
Exam Preparation Tasks 39
Review All Key Topics 39
Define Key Terms 40
Review Questions 40
Device Types in /dev 23
Installing Software from Source 24
Components of a Source Code Install 26
The Makefile 26
Example of a Compilation of Source Code 27
Storage Concepts 28
Partitions 28
MBR 29
GPT 29
Data Storage Methods 29
Block Storage 30
File Storage 30
Object Storage 31
FUSE (Filesystem in Userspace) 31
Why Use a FUSE? 31
Handling FUSE User Requests 32
Possible FUSE Applications/Uses 32
RAID 32
RAID Levels 33
Mirroring 34
Striping 34
Parity 35
Listing Your Hardware Info 35
The Proc Filesystem 36
Notable ls* Commands 36
Friends of procfs 37
The dmidecode Command 37
Displaying DMI Table Information 37
Summary 38
Exam Preparation Tasks 39
Review All Key Topics 39
Define Key Terms 40
Review Questions 40
Loading page 12...
xiContents
Chapter 2 Managing Files and Directories 43
“Do I Know This Already?” Quiz 43
Foundation Topics 46
File and Directory Operations 46
Tips for Working with Linux Files 46
Basic Navigation 47
Advanced Navigation 48
Listing Files and Directories 49
Touching Files 50
Copying Files and Directories 51
Moving Objects 54
Creating and Removing Directories 56
Removing Objects 57
File Metadata and File Types 57
Determining File Types 57
The file Command 57
Displaying File Metadata 58
The stat Command 58
Soft and Hard Links 60
Linking Files 60
Symbolic Links 61
Hard Links 62
File Compression, Archiving, and Backup 63
Using tar 64
Using Compression Utilities 66
Using tar with Compression Utilities 67
Taking Pity on the Unarchiver 70
Useful Creation Options 71
Listing Archive Files 71
Using cpio 72
Using the dd Command 73
Compression Tools 75
Backing Up Is Hard to Do 76
Backup Types 76
Other Backup Types 77
Chapter 2 Managing Files and Directories 43
“Do I Know This Already?” Quiz 43
Foundation Topics 46
File and Directory Operations 46
Tips for Working with Linux Files 46
Basic Navigation 47
Advanced Navigation 48
Listing Files and Directories 49
Touching Files 50
Copying Files and Directories 51
Moving Objects 54
Creating and Removing Directories 56
Removing Objects 57
File Metadata and File Types 57
Determining File Types 57
The file Command 57
Displaying File Metadata 58
The stat Command 58
Soft and Hard Links 60
Linking Files 60
Symbolic Links 61
Hard Links 62
File Compression, Archiving, and Backup 63
Using tar 64
Using Compression Utilities 66
Using tar with Compression Utilities 67
Taking Pity on the Unarchiver 70
Useful Creation Options 71
Listing Archive Files 71
Using cpio 72
Using the dd Command 73
Compression Tools 75
Backing Up Is Hard to Do 76
Backup Types 76
Other Backup Types 77
Loading page 13...
xii CompTIA® Linux+ XK0-005 Cert Guide
Copying Objects Between Systems 78
Using the scp Command 78
Everything and the Kitchen rsync 79
The nc Command 81
File Editing 82
The Message Line 83
Editing in vim 83
Opening a File for Editing 84
Navigating Within a File 85
Force Multipliers 86
Undo Operations 86
Saving Files 87
Quitting vim 87
Changing or Replacing Text 88
Deleting Text and Lines 88
Searching in vim 89
Searching and Replacing 89
nano, nano 90
Why nano and Not Pico? 90
nano’s Interface 91
That’s a Wrap 92
Feeling a Bit (awk)ward 92
The printf Function 94
Summary 95
Exam Preparation Tasks 96
Review All Key Topics 96
Define Key Terms 97
Review Questions 97
Chapter 3 Configuring and Managing Storage 101
“Do I Know This Already?” Quiz 101
Foundation Topics 104
Determining Storage Hardware 104
Viewing SCSI Device Information 104
Viewing Partition and Filesystem Device File Information 105
The lsblk Command 105
Copying Objects Between Systems 78
Using the scp Command 78
Everything and the Kitchen rsync 79
The nc Command 81
File Editing 82
The Message Line 83
Editing in vim 83
Opening a File for Editing 84
Navigating Within a File 85
Force Multipliers 86
Undo Operations 86
Saving Files 87
Quitting vim 87
Changing or Replacing Text 88
Deleting Text and Lines 88
Searching in vim 89
Searching and Replacing 89
nano, nano 90
Why nano and Not Pico? 90
nano’s Interface 91
That’s a Wrap 92
Feeling a Bit (awk)ward 92
The printf Function 94
Summary 95
Exam Preparation Tasks 96
Review All Key Topics 96
Define Key Terms 97
Review Questions 97
Chapter 3 Configuring and Managing Storage 101
“Do I Know This Already?” Quiz 101
Foundation Topics 104
Determining Storage Hardware 104
Viewing SCSI Device Information 104
Viewing Partition and Filesystem Device File Information 105
The lsblk Command 105
Loading page 14...
xiii
The blkid Command 106
The (Non-Linux) fcstat Command 108
Performing Disk Partitioning 108
fdisk 108
Partitioning with parted 112
partprobe 113
Inspecting and Managing Software RAID 114
Creating and Inspecting a Software RAID 114
Inspecting a Software RAID Device 114
Using Logical Volume Manager (LVM) 114
Overview of LVM 115
Understanding Multipath 116
Managing LVM 117
Mounting Local and Remote Devices 118
The Filesystem Table 119
Manually Mounting Filesystems 121
Unmounting Filesystems 121
Using systemd to Mount 122
Linux Unified Key Setup (LUKS) 123
Monitoring Storage Space and Disk Usage 123
Using iostat 123
Using du 124
Using df 125
Filesystem Management 126
Filesystem Checker 126
EXT2/3/4 Tools Overview 127
Tuning ext Filesystems 128
Btrfs Tools 128
XFS Commands 130
Storage Area Networks/Network-Attached Storage 131
SAN vs. NAS 131
Multipathing with multipathd 132
Typical Network Filesystems Used by SAN/NAS 133
Samba vs. SMB and CIFS 133
Summary 134
Exam Preparation Tasks 135
Contents
The blkid Command 106
The (Non-Linux) fcstat Command 108
Performing Disk Partitioning 108
fdisk 108
Partitioning with parted 112
partprobe 113
Inspecting and Managing Software RAID 114
Creating and Inspecting a Software RAID 114
Inspecting a Software RAID Device 114
Using Logical Volume Manager (LVM) 114
Overview of LVM 115
Understanding Multipath 116
Managing LVM 117
Mounting Local and Remote Devices 118
The Filesystem Table 119
Manually Mounting Filesystems 121
Unmounting Filesystems 121
Using systemd to Mount 122
Linux Unified Key Setup (LUKS) 123
Monitoring Storage Space and Disk Usage 123
Using iostat 123
Using du 124
Using df 125
Filesystem Management 126
Filesystem Checker 126
EXT2/3/4 Tools Overview 127
Tuning ext Filesystems 128
Btrfs Tools 128
XFS Commands 130
Storage Area Networks/Network-Attached Storage 131
SAN vs. NAS 131
Multipathing with multipathd 132
Typical Network Filesystems Used by SAN/NAS 133
Samba vs. SMB and CIFS 133
Summary 134
Exam Preparation Tasks 135
Contents
Loading page 15...
xiv CompTIA® Linux+ XK0-005 Cert Guide
Review All Key Topics 135
Define Key Terms 136
Review Questions 136
Chapter 4 Managing Processes and Services 139
“Do I Know This Already?” Quiz 139
Foundation Topics 142
Managing Processes 142
Viewing Processes 142
What’s the Diff? 143
The htop Command 144
The free Command 145
Blocks and Buffers 146
Pages, Slabs, and Caches 146
Interpreting Displayed Information from free 147
Sending Signals to Processes 148
Killing Processes by PID 149
Using pgrep and pkill to Send Signals 150
Killing Processes Using Other Criteria 152
Finding What Is Using a Resource 153
Introducing lsof 153
Using lsof 154
Job Control 155
Managing Process Priorities 157
systemd 159
What’s Different About systemd? 159
Units in systemd 161
Unit File Directory Locations 161
systemd Environment Variables 162
systemd Targets and Runlevels 163
Wants and Requires 163
Booting with systemd 164
Commands to Manage systemd 165
The State of Services/Units 165
Listing Services 166
Enabling and Disabling Services 166
Review All Key Topics 135
Define Key Terms 136
Review Questions 136
Chapter 4 Managing Processes and Services 139
“Do I Know This Already?” Quiz 139
Foundation Topics 142
Managing Processes 142
Viewing Processes 142
What’s the Diff? 143
The htop Command 144
The free Command 145
Blocks and Buffers 146
Pages, Slabs, and Caches 146
Interpreting Displayed Information from free 147
Sending Signals to Processes 148
Killing Processes by PID 149
Using pgrep and pkill to Send Signals 150
Killing Processes Using Other Criteria 152
Finding What Is Using a Resource 153
Introducing lsof 153
Using lsof 154
Job Control 155
Managing Process Priorities 157
systemd 159
What’s Different About systemd? 159
Units in systemd 161
Unit File Directory Locations 161
systemd Environment Variables 162
systemd Targets and Runlevels 163
Wants and Requires 163
Booting with systemd 164
Commands to Manage systemd 165
The State of Services/Units 165
Listing Services 166
Enabling and Disabling Services 166
Loading page 16...
xv
Service Start, Stop, Restart, and Status 167
Masking Services 169
Scheduling Services 170
Configuring crontabs 170
Using the crontab Command 170
Matching Times 171
Spelling Out Month and Day Names 172
Making Multiple Matches 172
Step Values 172
Putting Together the crontab 173
Issues About PATH 173
Dealing with Output 174
Nicknames 175
Other Files 175
System crontabs 176
Convenience crontabs 176
Restricting Access 177
Running ad hoc Jobs 178
The at Command 178
The batch Command 179
Summary 180
Exam Preparation Tasks 181
Review All Key Topics 181
Define Key Terms 182
Review Questions 182
Chapter 5 Using Network Tools and Configuration Files 185
“Do I Know This Already?” Quiz 186
Foundation Topics 188
Interface Management 188
iproute2 188
Interface Management Commands 188
The ip Command 189
Examples of the ip Command 190
The ss Command 191
NetworkManager 192
Contents
Service Start, Stop, Restart, and Status 167
Masking Services 169
Scheduling Services 170
Configuring crontabs 170
Using the crontab Command 170
Matching Times 171
Spelling Out Month and Day Names 172
Making Multiple Matches 172
Step Values 172
Putting Together the crontab 173
Issues About PATH 173
Dealing with Output 174
Nicknames 175
Other Files 175
System crontabs 176
Convenience crontabs 176
Restricting Access 177
Running ad hoc Jobs 178
The at Command 178
The batch Command 179
Summary 180
Exam Preparation Tasks 181
Review All Key Topics 181
Define Key Terms 182
Review Questions 182
Chapter 5 Using Network Tools and Configuration Files 185
“Do I Know This Already?” Quiz 186
Foundation Topics 188
Interface Management 188
iproute2 188
Interface Management Commands 188
The ip Command 189
Examples of the ip Command 190
The ss Command 191
NetworkManager 192
Contents
Loading page 17...
xvi CompTIA® Linux+ XK0-005 Cert Guide
The nmtui Command 192
The nmcli Command 192
The net-tools Suite 194
The ifconfig Command 195
Configuring via ifcfg-* files and network-scripts 195
On Debian-Based Systems 196
The hostname Command 197
The arp Command 198
The route Command 199
Name Resolution 199
Configuring Name Resolution 200
Controlling Resolution 202
Setting Hostnames on systemd Systems 204
The host, dig, and nslookup Commands 204
The whois Command 206
Network Monitoring 207
Is the Remote Host Reachable? 207
The ping Command 207
The traceroute Command 208
The mtr Command 210
Is the Data Flowing Properly? 211
Using netstat 211
Swimming with Wireshark 214
The tcpdump Command 216
Remote Networking Tools 217
SSH (Secure Shell) 217
Using curl and wget 218
The nc Command 219
Using rsync 221
Using scp 221
Summary 221
Exam Preparation Tasks 222
Review All Key Topics 222
Define Key Terms 223
Review Questions 223
The nmtui Command 192
The nmcli Command 192
The net-tools Suite 194
The ifconfig Command 195
Configuring via ifcfg-* files and network-scripts 195
On Debian-Based Systems 196
The hostname Command 197
The arp Command 198
The route Command 199
Name Resolution 199
Configuring Name Resolution 200
Controlling Resolution 202
Setting Hostnames on systemd Systems 204
The host, dig, and nslookup Commands 204
The whois Command 206
Network Monitoring 207
Is the Remote Host Reachable? 207
The ping Command 207
The traceroute Command 208
The mtr Command 210
Is the Data Flowing Properly? 211
Using netstat 211
Swimming with Wireshark 214
The tcpdump Command 216
Remote Networking Tools 217
SSH (Secure Shell) 217
Using curl and wget 218
The nc Command 219
Using rsync 221
Using scp 221
Summary 221
Exam Preparation Tasks 222
Review All Key Topics 222
Define Key Terms 223
Review Questions 223
Loading page 18...
xvii
Chapter 6 Building and Installing Software 225
“Do I Know This Already?” Quiz 226
Foundation Topics 228
Package Management 228
The Most Common Package Types 228
Package Managers 229
Debian Package Management 229
Managing Local Debian Packages 230
Installing Packages with dpkg 231
Removing Packages 231
Dependency Issues 232
Querying Packages 233
Reconfiguring Packages 234
Using Repositories 235
What Is a Repository? 236
Viewing Configured Repositories 236
Adding Repositories 238
Installing Remote Packages 239
Working with the Cache 241
Upgrading the System 241
Removing Packages 242
Graphical Managers 242
RPM and YUM Package Management 243
The RPM Database 243
RPM Package Files 244
Package Name Conventions 244
The rpm Command 245
Validation of Packages 246
Installation of Packages 246
Additional Installation Options 247
Verifying a Package’s Integrity 248
Freshening vs. Upgrading 249
Removing Packages 250
Other Removal Options 251
Contents
Chapter 6 Building and Installing Software 225
“Do I Know This Already?” Quiz 226
Foundation Topics 228
Package Management 228
The Most Common Package Types 228
Package Managers 229
Debian Package Management 229
Managing Local Debian Packages 230
Installing Packages with dpkg 231
Removing Packages 231
Dependency Issues 232
Querying Packages 233
Reconfiguring Packages 234
Using Repositories 235
What Is a Repository? 236
Viewing Configured Repositories 236
Adding Repositories 238
Installing Remote Packages 239
Working with the Cache 241
Upgrading the System 241
Removing Packages 242
Graphical Managers 242
RPM and YUM Package Management 243
The RPM Database 243
RPM Package Files 244
Package Name Conventions 244
The rpm Command 245
Validation of Packages 246
Installation of Packages 246
Additional Installation Options 247
Verifying a Package’s Integrity 248
Freshening vs. Upgrading 249
Removing Packages 250
Other Removal Options 251
Contents
Loading page 19...
xviii CompTIA® Linux+ XK0-005 Cert Guide
Querying Packages 252
Package Management with YUM 255
Installing Packages 255
Fetching Updates 257
Finding Packages to Install 258
Configuring YUM 259
Dandified YUM 262
ZYpp 262
Installing Software Packages with zypper 263
Removing a Package with zypper 265
Managing Repositories 265
Sandboxed Applications 268
What Is a Sandboxed App? 268
App Sandbox Applications 269
Flatpak 269
AppImage 269
Snapd 270
System Updates 270
Updating the Kernel 270
Choosing an Update Method 271
Reboot Methods 271
Manual Update 271
Update with Package Manager 272
Linux Kernel Utilities 272
No Reboot Method 273
Live Kernel Patching Overview 274
Issues with Live Patching 274
The Live Patch Process 274
Summary 275
Exam Preparation Tasks 276
Review All Key Topics 276
Define Key Terms 277
Review Questions 277
Querying Packages 252
Package Management with YUM 255
Installing Packages 255
Fetching Updates 257
Finding Packages to Install 258
Configuring YUM 259
Dandified YUM 262
ZYpp 262
Installing Software Packages with zypper 263
Removing a Package with zypper 265
Managing Repositories 265
Sandboxed Applications 268
What Is a Sandboxed App? 268
App Sandbox Applications 269
Flatpak 269
AppImage 269
Snapd 270
System Updates 270
Updating the Kernel 270
Choosing an Update Method 271
Reboot Methods 271
Manual Update 271
Update with Package Manager 272
Linux Kernel Utilities 272
No Reboot Method 273
Live Kernel Patching Overview 274
Issues with Live Patching 274
The Live Patch Process 274
Summary 275
Exam Preparation Tasks 276
Review All Key Topics 276
Define Key Terms 277
Review Questions 277
Loading page 20...
xix
Chapter 7 Managing Software Configurations 281
“Do I Know This Already?” Quiz 281
Foundation Topics 283
Updating Configuration Files 283
Restart or Reload? 283
Restarting a Service 283
Reloading a Service 283
Grace Under Pressure 284
Dealing with RPM Configurations 284
Rage About Your Machine 285
Two Methods to Retain the Original Configuration File 285
Handling .rpmsave and .rpmnew Files 286
Repository Configuration Files 287
Repository Configuration File Overview 288
The APT Configuration File 288
The YUM Configuration File 288
The DNF Configuration File 289
Actual Repository Files 289
The YUM Repo Files 289
The APT Repo Files 289
Configuring Kernel Options 289
Viewing Kernel Parameters 290
Doing It the Manual Way 290
Getting Used to Using sysctl 291
Ways to Set Kernel Parameters 291
Using the sysctl.conf File 291
Using the sysctl Command Directly 291
Using /etc/sysctl.conf 292
Using the sysctl Command to Load Parameters 292
Understanding Kernel Modules 293
Managing Kernel Modules 294
Loading and Unloading Modules Manually 296
The modprobe Command 298
Configuring Common System Services 300
Secure Shell (SSH) 301
Contents
Chapter 7 Managing Software Configurations 281
“Do I Know This Already?” Quiz 281
Foundation Topics 283
Updating Configuration Files 283
Restart or Reload? 283
Restarting a Service 283
Reloading a Service 283
Grace Under Pressure 284
Dealing with RPM Configurations 284
Rage About Your Machine 285
Two Methods to Retain the Original Configuration File 285
Handling .rpmsave and .rpmnew Files 286
Repository Configuration Files 287
Repository Configuration File Overview 288
The APT Configuration File 288
The YUM Configuration File 288
The DNF Configuration File 289
Actual Repository Files 289
The YUM Repo Files 289
The APT Repo Files 289
Configuring Kernel Options 289
Viewing Kernel Parameters 290
Doing It the Manual Way 290
Getting Used to Using sysctl 291
Ways to Set Kernel Parameters 291
Using the sysctl.conf File 291
Using the sysctl Command Directly 291
Using /etc/sysctl.conf 292
Using the sysctl Command to Load Parameters 292
Understanding Kernel Modules 293
Managing Kernel Modules 294
Loading and Unloading Modules Manually 296
The modprobe Command 298
Configuring Common System Services 300
Secure Shell (SSH) 301
Contents
Loading page 21...
xx CompTIA® Linux+ XK0-005 Cert Guide
Network Time Protocol (NTP) 301
NTP Expressed Through Chrony 302
The timedatectl Command 303
System Logging with Syslog 304
Representing Locales 304
Fallback Locales 306
Contents of a Locale 306
The localectl Command 307
How Linux Uses the Locale 307
systemd and syslog 308
syslog 309
The logger Command 312
Configuring syslogd 312
Key File Locations 313
Other syslog Implementations 314
Summary 315
Exam Preparation Tasks 316
Review All Key Topics 316
Define Key Terms 317
Review Questions 317
Part II: Security (Obj. 2.1 - 2.5)
Chapter 8 Understanding Linux Security Best Practices 321
“Do I Know This Already?” Quiz 321
Foundation Topics 323
Public Key Infrastructure 323
Purpose of Certificates 323
Certificate Authentication 323
Self-Signed Certificates 323
Certificate Authorities 323
Private Keys 324
Public Keys 324
Encryption and Hashing 324
Digital Signatures 325
Certificate Use Cases 325
Network Time Protocol (NTP) 301
NTP Expressed Through Chrony 302
The timedatectl Command 303
System Logging with Syslog 304
Representing Locales 304
Fallback Locales 306
Contents of a Locale 306
The localectl Command 307
How Linux Uses the Locale 307
systemd and syslog 308
syslog 309
The logger Command 312
Configuring syslogd 312
Key File Locations 313
Other syslog Implementations 314
Summary 315
Exam Preparation Tasks 316
Review All Key Topics 316
Define Key Terms 317
Review Questions 317
Part II: Security (Obj. 2.1 - 2.5)
Chapter 8 Understanding Linux Security Best Practices 321
“Do I Know This Already?” Quiz 321
Foundation Topics 323
Public Key Infrastructure 323
Purpose of Certificates 323
Certificate Authentication 323
Self-Signed Certificates 323
Certificate Authorities 323
Private Keys 324
Public Keys 324
Encryption and Hashing 324
Digital Signatures 325
Certificate Use Cases 325
Loading page 22...
xxi
Authentication 326
Multifactor Authentication 326
Tokens 326
OTP 327
Biometrics 327
LDAP 327
Pluggable Authentication Modules (PAMs) 327
Password Policies 328
Password Length 329
LDAP Integration 329
User Lockouts 329
The /etc/pam.d Directory 330
pam_tally2 and faillock 330
System Security Services Daemon 331
Single Sign-On (SSO) 332
Linux Hardening 333
The nmap Command 333
The nc Command 338
Secure Boot and UEFI 340
System Logging Configurations 340
Using umask 340
Disabling/Removing Insecure Services 342
Enforcing Password Strength 343
Setting Password Parameters 343
Aging Your Passwords 344
No Wire Hangers (Group Passwords) 345
Removing Unused Packages 345
Tuning Kernel Parameters 347
Securing Service Accounts 347
Configuring the Host Firewall 348
Summary 348
Exam Preparation Tasks 349
Review All Key Topics 349
Define Key Terms 350
Review Questions 350
Contents
Authentication 326
Multifactor Authentication 326
Tokens 326
OTP 327
Biometrics 327
LDAP 327
Pluggable Authentication Modules (PAMs) 327
Password Policies 328
Password Length 329
LDAP Integration 329
User Lockouts 329
The /etc/pam.d Directory 330
pam_tally2 and faillock 330
System Security Services Daemon 331
Single Sign-On (SSO) 332
Linux Hardening 333
The nmap Command 333
The nc Command 338
Secure Boot and UEFI 340
System Logging Configurations 340
Using umask 340
Disabling/Removing Insecure Services 342
Enforcing Password Strength 343
Setting Password Parameters 343
Aging Your Passwords 344
No Wire Hangers (Group Passwords) 345
Removing Unused Packages 345
Tuning Kernel Parameters 347
Securing Service Accounts 347
Configuring the Host Firewall 348
Summary 348
Exam Preparation Tasks 349
Review All Key Topics 349
Define Key Terms 350
Review Questions 350
Contents
Loading page 23...
xxii CompTIA® Linux+ XK0-005 Cert Guide
Chapter 9 Implementing Identity Management 353
“Do I Know This Already?” Quiz 353
Foundation Topics 355
Account Creation and Deletion 355
User Account Fundamentals 355
What Accounts Are What? 355
Regular User Accounts 356
User Entries in /etc/passwd 357
Special Login Files 357
pam_tally2 and faillock 358
Group Accounts 358
Group Entries in /etc/group 360
Group Passwords 360
Adding Users and Groups 361
Adding Users with useradd 361
useradd Defaults 362
skel Templates 362
Adding Groups with groupadd 364
Modifying Users and Groups 364
Modifying User Accounts with usermod 364
Modifying Groups with groupmod 365
Removing Users and Groups 366
Removing Users 366
Removing Groups 367
The Shadow Suite 368
Encrypted Passwords and Shadow Fields 368
/etc/shadow File Permissions 369
Changing Passwords 370
Aging Passwords 370
A Login Shell Session 371
A Non-Login Shell Session 372
User Identity Query Options 372
Summary 374
Exam Preparation Tasks 375
Chapter 9 Implementing Identity Management 353
“Do I Know This Already?” Quiz 353
Foundation Topics 355
Account Creation and Deletion 355
User Account Fundamentals 355
What Accounts Are What? 355
Regular User Accounts 356
User Entries in /etc/passwd 357
Special Login Files 357
pam_tally2 and faillock 358
Group Accounts 358
Group Entries in /etc/group 360
Group Passwords 360
Adding Users and Groups 361
Adding Users with useradd 361
useradd Defaults 362
skel Templates 362
Adding Groups with groupadd 364
Modifying Users and Groups 364
Modifying User Accounts with usermod 364
Modifying Groups with groupmod 365
Removing Users and Groups 366
Removing Users 366
Removing Groups 367
The Shadow Suite 368
Encrypted Passwords and Shadow Fields 368
/etc/shadow File Permissions 369
Changing Passwords 370
Aging Passwords 370
A Login Shell Session 371
A Non-Login Shell Session 372
User Identity Query Options 372
Summary 374
Exam Preparation Tasks 375
Loading page 24...
xxiii
Review All Key Topics 375
Define Key Terms 375
Review Questions 376
Chapter 10 Implementing and Configuring Firewalls 379
“Do I Know This Already?” Quiz 379
Foundation Topics 382
Common Firewall Technologies 382
iptables: Old and Reliable, but Complicated 383
nftables: Newer, Tighter, More Dynamic 383
firewalld: Newer, Flexible, Easier to Use 384
UFW: Uncomplicated Indeed 384
Understanding iptables 385
Overview of Filtering Packets 385
Important Terms 388
Using iptables to Filter Incoming Packets 389
Filtering by Protocol 391
Multiple Criteria 392
Filtering Based on Destination 392
Changing the Default Policy 393
Revisiting the Original Rules 394
Saving the Rules 394
Using iptables to Filter Outgoing Packets 395
Stateful Rules 396
Logging Rules 396
Implementing NAT 397
Additional Firewall Technologies 398
The fail2ban Service 398
DenyHosts 400
IPset 400
Summary 400
Exam Preparation Tasks 401
Review All Key Topics 401
Define Key Terms 401
Review Questions 402
Contents
Review All Key Topics 375
Define Key Terms 375
Review Questions 376
Chapter 10 Implementing and Configuring Firewalls 379
“Do I Know This Already?” Quiz 379
Foundation Topics 382
Common Firewall Technologies 382
iptables: Old and Reliable, but Complicated 383
nftables: Newer, Tighter, More Dynamic 383
firewalld: Newer, Flexible, Easier to Use 384
UFW: Uncomplicated Indeed 384
Understanding iptables 385
Overview of Filtering Packets 385
Important Terms 388
Using iptables to Filter Incoming Packets 389
Filtering by Protocol 391
Multiple Criteria 392
Filtering Based on Destination 392
Changing the Default Policy 393
Revisiting the Original Rules 394
Saving the Rules 394
Using iptables to Filter Outgoing Packets 395
Stateful Rules 396
Logging Rules 396
Implementing NAT 397
Additional Firewall Technologies 398
The fail2ban Service 398
DenyHosts 400
IPset 400
Summary 400
Exam Preparation Tasks 401
Review All Key Topics 401
Define Key Terms 401
Review Questions 402
Contents
Loading page 25...
xxiv CompTIA® Linux+ XK0-005 Cert Guide
Chapter 11 Using Remote Connectivity for System Management 405
“Do I Know This Already?” Quiz 405
Foundation Topics 408
SSH (Secure Shell) 408
SSH Components 408
Tunneling 414
X11 Forwarding 414
Port Forwarding 415
Executing Commands as Another User 416
The sudo Command 416
The sudoedit Command 417
User Privilege Escalation 418
The su Command 419
PolicyKit 420
The pkexec Command 420
Summary 421
Exam Preparation Tasks 422
Review All Key Topics 422
Define Key Terms 423
Review Questions 423
Chapter 12 Understanding and Applying Access Controls 427
“Do I Know This Already?” Quiz 427
Foundation Topics 429
File Permissions 429
Permission Trio Bits 429
Manipulating Permissions 432
Octal Mode 432
Symbolic Mode 433
File and Directory Ownership 434
Changing File Ownership 435
Changing Group Ownership 436
Understanding and Using umask 437
Permission Granularity Issues 437
Special Bit Permissions 438
Chapter 11 Using Remote Connectivity for System Management 405
“Do I Know This Already?” Quiz 405
Foundation Topics 408
SSH (Secure Shell) 408
SSH Components 408
Tunneling 414
X11 Forwarding 414
Port Forwarding 415
Executing Commands as Another User 416
The sudo Command 416
The sudoedit Command 417
User Privilege Escalation 418
The su Command 419
PolicyKit 420
The pkexec Command 420
Summary 421
Exam Preparation Tasks 422
Review All Key Topics 422
Define Key Terms 423
Review Questions 423
Chapter 12 Understanding and Applying Access Controls 427
“Do I Know This Already?” Quiz 427
Foundation Topics 429
File Permissions 429
Permission Trio Bits 429
Manipulating Permissions 432
Octal Mode 432
Symbolic Mode 433
File and Directory Ownership 434
Changing File Ownership 435
Changing Group Ownership 436
Understanding and Using umask 437
Permission Granularity Issues 437
Special Bit Permissions 438
Loading page 26...
xxv
Setting the SUID Bit on Files 439
Setting the SGID Bit on Files 440
Setting the SGID Bit on Directories 441
Setting the Sticky Bit 442
Viewing and Changing File Attributes 442
Displaying File Attributes 442
Key File Attributes 443
Setting File Attributes 443
Removing File Attributes 443
Finding Files by Permission 444
Access Control Lists 445
Not Enough Granularity 445
ACLs to the Rescue 445
Viewing ACLs 446
Setting an ACL 446
We All Wear Masks 447
Context-Based Access 448
Security-Enhanced Linux (SELinux) 449
SELinux Mode 450
SELinux Policy 451
SELinux Booleans 452
SELinux Contexts 454
The audit2allow Command 455
AppArmor 456
aa-disable Command 456
aa-complain Command 457
aa-unconfined Command 457
/etc/apparmor.d/ Directory 457
/etc/apparmor.d/tunables Directory 457
Command-Line Utilities 457
Summary 457
Exam Preparation Tasks 458
Review All Key Topics 458
Define Key Terms 458
Review Questions 459
Contents
Setting the SUID Bit on Files 439
Setting the SGID Bit on Files 440
Setting the SGID Bit on Directories 441
Setting the Sticky Bit 442
Viewing and Changing File Attributes 442
Displaying File Attributes 442
Key File Attributes 443
Setting File Attributes 443
Removing File Attributes 443
Finding Files by Permission 444
Access Control Lists 445
Not Enough Granularity 445
ACLs to the Rescue 445
Viewing ACLs 446
Setting an ACL 446
We All Wear Masks 447
Context-Based Access 448
Security-Enhanced Linux (SELinux) 449
SELinux Mode 450
SELinux Policy 451
SELinux Booleans 452
SELinux Contexts 454
The audit2allow Command 455
AppArmor 456
aa-disable Command 456
aa-complain Command 457
aa-unconfined Command 457
/etc/apparmor.d/ Directory 457
/etc/apparmor.d/tunables Directory 457
Command-Line Utilities 457
Summary 457
Exam Preparation Tasks 458
Review All Key Topics 458
Define Key Terms 458
Review Questions 459
Contents
Loading page 27...
xxvi CompTIA® Linux+ XK0-005 Cert Guide
Part III: Scripting, Containers and Automation (Obj. 3.1 - 3.5)
Chapter 13 Automating Tasks via Shell Scripting 463
“Do I Know This Already?” Quiz 463
Foundation Topics 466
Shell Script Elements 466
Globbing 467
Environment Variables and Settings 469
The PATH Variable 471
The SHELL Variable 472
Variable Expansion 472
Running a Script 473
Good Script Design 474
Working with Input/Output Streams 475
Standard In 475
Standard Out 475
Standard Error 476
Find Errors on Demand 476
Here Documents 477
Redirection of Streams 478
Redirecting Standard Input 478
Redirecting Standard Output 478
Redirecting Standard Error 479
Redirection Redux 480
Understanding /dev/tty 480
Pipes 481
Executing Multiple Commands 483
Multiple Command Operators 483
Command Substitution 484
Splitting Streams with the tee Command 485
Processing Output with the xargs Command 485
Shell Script Elements 487
Using the Output of Another Command 487
Conditionals 488
Testing Files 490
An Easier Test Syntax 490
Part III: Scripting, Containers and Automation (Obj. 3.1 - 3.5)
Chapter 13 Automating Tasks via Shell Scripting 463
“Do I Know This Already?” Quiz 463
Foundation Topics 466
Shell Script Elements 466
Globbing 467
Environment Variables and Settings 469
The PATH Variable 471
The SHELL Variable 472
Variable Expansion 472
Running a Script 473
Good Script Design 474
Working with Input/Output Streams 475
Standard In 475
Standard Out 475
Standard Error 476
Find Errors on Demand 476
Here Documents 477
Redirection of Streams 478
Redirecting Standard Input 478
Redirecting Standard Output 478
Redirecting Standard Error 479
Redirection Redux 480
Understanding /dev/tty 480
Pipes 481
Executing Multiple Commands 483
Multiple Command Operators 483
Command Substitution 484
Splitting Streams with the tee Command 485
Processing Output with the xargs Command 485
Shell Script Elements 487
Using the Output of Another Command 487
Conditionals 488
Testing Files 490
An Easier Test Syntax 490
Loading page 28...
xxvii
Testing Strings 491
Testing Integers 492
Combining Multiple Tests 493
case Statements 493
switch Statements 495
Loops 496
For Loops 496
Sequences 497
while and until Loops 498
Interacting with Other Programs 498
Returning an Error Code 499
Accepting Arguments 499
Feeling a Bit (awk)ward 500
Translating Files 502
Cutting Columns 502
He sed, She sed 503
Using grep and Friends 505
Getting a grep 505
Examples of Using grep 506
Expanding grep with egrep and fgrep 510
Using Regular Expressions and grep 511
Pasting and Joining 514
Finding Files 515
Summary 517
Exam Preparation Tasks 518
Review All Key Topics 518
Define Key Terms 519
Review Questions 519
Chapter 14 Performing Basic Container Operations 523
“Do I Know This Already?” Quiz 523
Foundation Topics 525
Container Management 525
Installing and Verifying the Container Tools 525
Installing the Container-Tools Package and Dependencies 525
Verifying the Podman and Skopeo Tool Installation 526
Contents
Testing Strings 491
Testing Integers 492
Combining Multiple Tests 493
case Statements 493
switch Statements 495
Loops 496
For Loops 496
Sequences 497
while and until Loops 498
Interacting with Other Programs 498
Returning an Error Code 499
Accepting Arguments 499
Feeling a Bit (awk)ward 500
Translating Files 502
Cutting Columns 502
He sed, She sed 503
Using grep and Friends 505
Getting a grep 505
Examples of Using grep 506
Expanding grep with egrep and fgrep 510
Using Regular Expressions and grep 511
Pasting and Joining 514
Finding Files 515
Summary 517
Exam Preparation Tasks 518
Review All Key Topics 518
Define Key Terms 519
Review Questions 519
Chapter 14 Performing Basic Container Operations 523
“Do I Know This Already?” Quiz 523
Foundation Topics 525
Container Management 525
Installing and Verifying the Container Tools 525
Installing the Container-Tools Package and Dependencies 525
Verifying the Podman and Skopeo Tool Installation 526
Contents
Loading page 29...
xxviii CompTIA® Linux+ XK0-005 Cert Guide
Finding and Pulling a Container Image 526
Finding a Suitable Image 526
Pulling an Image 527
Viewing and Inspecting Images 528
Viewing Local Images 528
Inspecting a Local Image 529
Running an Image as a Container 529
Assigning a Container-Friendly Name 529
Detaching from and Attaching to Containers 530
Exiting and Ending Execution of a Container 530
Removing a Container 531
Viewing Container Logs 531
Exposing and Mapping Ports 532
Container Image Operations 533
build Command 533
push Command 533
pull Command 534
list Command 534
rmi Command 534
Summary 534
Exam Preparation Tasks 535
Review All Key Topics 535
Define Key Terms 535
Review Questions 536
Chapter 15 Performing Basic Version Control Using Git 539
“Do I Know This Already?” Quiz 539
Foundation Topics 541
Version Control Concepts 541
The First Generation 541
The Second Generation 542
What Is a Merge? 542
The Third Generation 543
Using Git for Version Control 546
Installing Git 546
Finding and Pulling a Container Image 526
Finding a Suitable Image 526
Pulling an Image 527
Viewing and Inspecting Images 528
Viewing Local Images 528
Inspecting a Local Image 529
Running an Image as a Container 529
Assigning a Container-Friendly Name 529
Detaching from and Attaching to Containers 530
Exiting and Ending Execution of a Container 530
Removing a Container 531
Viewing Container Logs 531
Exposing and Mapping Ports 532
Container Image Operations 533
build Command 533
push Command 533
pull Command 534
list Command 534
rmi Command 534
Summary 534
Exam Preparation Tasks 535
Review All Key Topics 535
Define Key Terms 535
Review Questions 536
Chapter 15 Performing Basic Version Control Using Git 539
“Do I Know This Already?” Quiz 539
Foundation Topics 541
Version Control Concepts 541
The First Generation 541
The Second Generation 542
What Is a Merge? 542
The Third Generation 543
Using Git for Version Control 546
Installing Git 546
Loading page 30...
xxix
Git Concepts and Features 547
Git Stages 548
Choosing Your Git Repository Host 549
Configuring Git 549
Using git tag 552
Getting the Status of Files 553
The .git Directory 555
Telling Git to Ignore a File 555
Handling Branches 556
Executing Diffs 558
Comparing Versions 560
Dealing with Whitespace 560
Comparing Branches 561
Merging Files 562
Summary 568
Exam Preparation Tasks 569
Review All Key Topics 569
Define Key Terms 569
Review Questions 570
Chapter 16 Understanding Infrastructure as Code 573
“Do I Know This Already?” Quiz 573
Foundation Topics 576
File Formats 576
YAML 576
Key Characteristics of YAML 576
YAML Stream Examples 576
JSON 577
Key Characteristics of JSON 578
JSON Examples 578
Infrastructure as Code Concepts 579
Just Making a Config Change 579
Using Source Control 580
Getting Started with IaC 580
Utilities: Infrastructure as Code 580
Contents
Git Concepts and Features 547
Git Stages 548
Choosing Your Git Repository Host 549
Configuring Git 549
Using git tag 552
Getting the Status of Files 553
The .git Directory 555
Telling Git to Ignore a File 555
Handling Branches 556
Executing Diffs 558
Comparing Versions 560
Dealing with Whitespace 560
Comparing Branches 561
Merging Files 562
Summary 568
Exam Preparation Tasks 569
Review All Key Topics 569
Define Key Terms 569
Review Questions 570
Chapter 16 Understanding Infrastructure as Code 573
“Do I Know This Already?” Quiz 573
Foundation Topics 576
File Formats 576
YAML 576
Key Characteristics of YAML 576
YAML Stream Examples 576
JSON 577
Key Characteristics of JSON 578
JSON Examples 578
Infrastructure as Code Concepts 579
Just Making a Config Change 579
Using Source Control 580
Getting Started with IaC 580
Utilities: Infrastructure as Code 580
Contents
Loading page 31...
30 more pages available. Scroll down to load them.
Preview Mode
Sign in to access the full document!
100%
Study Now!
XY-Copilot AI
Unlimited Access
Secure Payment
Instant Access
24/7 Support
AI Assistant
Document Details
Subject
CompTIA Certifications