Also available in other formats.
Register your product to gain access to bonus material or receive a coupon.
The smartest, fastest, most effective preparation for the latest Linux+ exam
CompTIA Linux+ XK0-004 Cert Guide, Premium Edition eBook and Practice Test
The exciting new CompTIA Linux+ XK0-004 Cert Guide, Premium Edition eBook and Practice Test is a digital-only certification preparation product combining an eBook with enhanced Pearson Test Prep practice test software. The Premium Edition eBook and Practice Test contains the following items:
About the Premium Edition Practice Test
This Premium Edition contains an enhanced online version of the Pearson Test Prep practice test software with four full practice exams. In addition, it contains all the chapter-opening assessment questions from the book. The online version enables you to access the practice tests that come bundled with our best-selling study guides via the Internet on any desktop, laptop, tablet, or smartphone device with Internet connectivity. The new web-based version also enables you to download the software to your desktop, so you can use the practice test even when you don't have an Internet connection. The desktop version syncs with your online version when an Internet connection is established, to update and track your progress. This integrated learning package offers these additional benefits:
• Enables you to focus on individual topic areas or take complete, timed exams
• Contains direct links from each question to detailed tutorials, to help you understand the concepts behind the questions
• Presents unique sets of exam-realistic practice questions
• Tracks your performance and provides feedback on a module-by-module basis, laying out a complete assessment of your knowledge to help you focus your study where it is needed most
Pearson Test Prep online system requirements:
Browsers: Chrome version 40 and above; Firefox version 35 and above; Safari version 7; Internet Explorer 10, 11; Microsoft Edge; Opera.
Devices: Desktop and laptop computers, tablets running on Android and iOS, smartphones with a minimum screen size of 4.7". Internet access required.
Pearson Test Prep offline system requirements:
Windows 10, Windows 8.1, Windows 7; Microsoft .NET Framework 4.5 Client; Pentium-class 1 GHz processor (or equivalent); 512 MB RAM; 650 MB disk space plus 50 MB for each downloaded practice exam; access to the Internet to register and download exam databases
Introduction xxxvi
Part I: Software Management
Chapter 1 Installing Linux 3
Hardware and Linux Installation 3
Installing Linux as a Study Tool 4
Setting Up a Virtualized Environment 4
Downloading ISO Files 6
Installing an Ubuntu Virtual Machine 8
Installing Ubuntu on a Virtual Machine 10
Getting to the Command Line 11
The Importance of Snapshots 12
Summary 13
Chapter 2 Package Installation and Management 15
“Do I Know This Already?” Quiz 15
Software in a Linux System 18
Shared Libraries 18
Working with Shared Libraries 20
Determining Required Libraries 20
Installing Software from Source 22
Components of a Source Code Install 23
The Makefile 23
Example of a Compilation of Source Code 24
Packages and Package Managers 25
The Most Common Package Types 25
Package Managers 26
Debian Package Management 26
Using Repositories 32
Installing Remote Packages 36
Upgrading the System 38
Removing Packages 39
Graphical Managers 39
RPM and YUM Package Management 40
The RPM Database 40
RPM Package Files 41
The rpm Command 42
Package Management with YUM 52
Configuring YUM 56
Dandified YUM 59
zypper 59
Syncing or Mirroring Repositories 65
Alternative Method of Acquiring Software 65
Summary 66
Chapter 3 Virtualization 73
“Do I Know This Already?” Quiz 73
What Is Virtualization? 75
Types of Virtualization/Hypervisors 75
Local Virtualization 76
Other People’s Linux Boxes 76
Cloud Virtualization 76
Bootstrapping VMs 77
Amazon Machine Images 77
Cloud Installation Tools 77
Template Formats 79
OVA/OVF Templates 80
Configuring Templates 80
YAML Ain’t Markup Language 80
JSON Bourne 80
Container Images 80
Virtualization Storage 81
Thin vs. Thick 81
Persistent Volumes 81
Blobs and Blocks 82
Networking Considerations 82
Bridging 82
Overlay Networks 82
NAT 83
Local 83
Dual-homed 83
Summary 84
Chapter 4 The Boot Process 89
“Do I Know This Already?” Quiz 89
The Linux Boot Process 91
What Is the Boot Process? 91
System Boot Options 91
Boot Loaders 97
Boot Loaders and Files 98
GRUB Legacy 98
GRUB2 99
Common Commands at Boot Time 104
When Kernels Panic 106
Identifying a Kernel Panic 106
Getting More Information 106
Kernel Panic Causes 106
Summary 107
Chapter 5 Managing System Services 111
“Do I Know This Already?” Quiz 111
systemd 113
What’s Different About systemd? 113
Units in systemd 114
systemd Targets and Runlevels 116
Wants and Requires 117
Booting with systemd 117
Commands to Manage systemd 118
Troubleshooting System Boot Times 123
Setting Environment Parameters for systemd Services 123
Setting Hostnames on systemd Systems 123
Down Memory Lane with SysVinit 124
Freshen That Up for You? 125
SysVinit Boot Sequence 126
Managing System Runlevels 127
Determining the Default Runlevel 128
Setting the Default Runlevels 129
Changing Runlevels 129
Shut Down and Reboot from the Command Line 129
Summary 130
Chapter 6 System Performance 135
“Do I Know This Already?” Quiz 135
Managing Processes 137
Viewing Processes 137
What’s the Diff? 138
The free Command 139
Blocks and Buffers 139
Pages, Slabs, and Caches 140
Interpreting Displayed Information from free 140
System Uptime 142
Sending Signals to Processes 142
Killing Processes by PID 144
Killing Processes by Using Other Criteria 144
Finding What Is Using a Resource 146
Job Control 147
Managing Process Priorities 149
Leaving Programs Running After Logout 151
Using screen for Multiple Console Sessions 152
Summary 155
Part II: File Management
Chapter 7 File Manipulation 161
“Do I Know This Already?” Quiz 161
File and Directory Operations 163
Tips for Working with Linux Files 163
Basic Navigation 163
Advanced Navigation 164
Listing Files and Directories 165
Determining File Types 166
Touching Files 168
Copying Files and Directories 169
Copying Objects Between Systems 172
Everything and the Kitchen rsync 173
What’s the Diff? 175
Moving Objects 177
Creating and Removing Directories 179
Removing Objects 180
Where Are Those Files? 180
Getting a grep 184
Which Command Will Run? 188
Researching a Command 189
Linking Files 190
Working with Input/Output Streams 193
Standard In 194
Standard Out 194
Standard Error 194
Here Documents 195
Redirection of Streams 196
Redirecting Standard Input 197
Redirecting Standard Output 197
Redirecting Standard Error 197
Redirection Redux 198
Understanding /dev/tty 199
Pipes 199
Executing Multiple Commands 202
Summary 205
Chapter 8 File Processing 211
“Do I Know This Already?” Quiz 211
Reading File Contents 214
Training the cat Command 214
When cat Goes Backward 215
cat vs. echo 215
more or less? 216
head or tail? 218
Viewing Binary Files Safely 220
Filters 221
Sorting 221
Numbering Lines 222
Cutting Columns 223
Feeling a Bit (awk)ward 223
Translating Files 225
He sed, She sed 225
Using grep and Friends 228
A Tour of the vim Editor 234
The Message Line 234
Editing in vi 234
Searching in vi 240
nano, nano 241
Why nano and not Pico? 241
nano’s Interface 242
That’s a Wrap 243
Summary 243
Chapter 9 File Permissions and Escalation 249
“Do I Know This Already?” Quiz 249
Working with Permissions 252
Permission Trio Bits 252
Manipulating Permissions 254
Octal Notation Mode 255
Special File Permissions 258
Special Bit Permissions 259
Setting the SUID Bit on Files 260
Setting the SGID Bit on Files 261
Setting the SGID Bit on Directories 262
Setting the Sticky Bit 263
Finding Files by Permission 263
Access Control Lists 264
Not Enough Granularity 264
ACLs to the Rescue 265
Viewing ACLs 265
Setting an ACL 265
We All Wear Masks 267
Understanding Permission Problems 267
Default Permissions 268
Using umask 268
Up to the ulimit 270
Changing User Ownership 271
Changing Group Ownership 272
Aging Passwords 273
User Privilege Escalation 274
The su Command 275
The sudo Command 276
The sudoedit Command 277
Summary 278
Chapter 10 SELinux and AppArmor 283
“Do I Know This Already?” Quiz 283
SELinux Configurations 285
SELinux Mode 287
SELinux Policy 288
SELinux Booleans 288
SELinux Contexts 290
AppArmor 292
aa-disable 292
aa-complain 292
aa-unconfined 293
/etc/apparmor.d/ 293
/etc/apparmor.d/tunables 293
Summary 293
Chapter 11 File Compression and Storage 297
“Do I Know This Already?” Quiz 297
Archive and Restore Utilities 299
Using tar 299
Using Compression Utilities 301
Listing Archive Files 307
Using cpio 308
Using the dd Command 309
Compression Tools 310
Backing Up Is Hard to Do 311
Backup Types 312
Other Backup Types 312
Off-Site/Off-System Storage 313
Backups Over the LAN/WAN 313
Everything and the Kitchen rsync 314
Integrity Checks 315
Summary 315
Part III: Account Management
Chapter 12 User and Group Management 321
“Do I Know This Already?” Quiz 321
User Account Fundamentals 324
What Accounts Are What? 324
Group Accounts 327
Group Entries in /etc/group 328
Group Passwords 329
Adding Users and Groups 330
Adding Users with useradd 330
useradd Defaults 331
skel Templates 331
Adding Groups with groupadd 332
Modifying Users and Groups 333
Modifying User Accounts with usermod 333
Modifying Groups with groupmod 334
Removing Users and Groups 335
Removing Users 335
Removing Groups 336
The Shadow Suite 337
Encrypted Passwords and Shadow Fields 337
shadow File Permissions 338
Changing Passwords 339
Aging Passwords 340
User Variables 341
Using Disk Quotas 342
A Login Shell Session 347
A Non-Login Shell Session 348
User Identity Query Options 348
Summary 351
Chapter 13 Account Security 355
“Do I Know This Already?” Quiz 355
Pluggable Authentication Modules (PAMs) 357
Password Policies 357
LDAP Integration 358
User Lockouts 359
The /etc/pam.d Directory 359
pam_tally2 and faillock 359
Secure Shell 360
SSH Components 360
Terminals PTY/TTY 366
Moving Between Terminals 367
securetty 367
Public Key Infrastructure 367
Using TCP Wrappers for Securing Services 369
inetd and TCP Wrappers 369
xinetd and TCP Wrappers 369
The hosts.allow and hosts.deny Files 370
Wrapper Read Order 371
Format of hosts.allow and hosts.deny 371
Sample Configurations 371
Using Rule Options 373
Virtual Private Network (VPN) Clients 374
IPsec 374
SSL and TLS 374
DTLS 375
Transport and Tunnel Modes 375
Summary 376
Chapter 14 Logging Services 381
“Do I Know This Already?” Quiz 381
System Logging 383
systemd and syslog 383
systemd Logging 389
Dealing with Open Files 398
Summary 399
Part IV: Device Management
Chapter 15 Linux Devices 403
“Do I Know This Already?” Quiz 403
Understanding Linux Hardware 405
Types of Devices 406
Peripheral Compatibility 407
Enumerating Your Peripherals 408
The Proc Filesystem 409
Managing Printers and Printing 412
The Print Spooler 412
The CUPS Daemon 413
Configuring CUPS 415
CUPS Maintenance 420
Command Line Tools 422
Troubleshooting Printing 428
Linux Graphical User Interfaces 429
Linux Desktops 430
Accessibility Options 432
Sticky/Repeat Keys 432
Slow/Bounce/Toggle Keys 433
Mouse Keys 433
High Contrast/Large Print Desktop Themes 434
Screen Reader 434
Braille Display 435
Screen Magnifier 435
Onscreen Keyboard 435
Remote Desktop 435
Summary 436
Chapter 16 Hardware Troubleshooting 441
“Do I Know This Already?” Quiz 441
Storage Monitoring and Configuration 444
ioping 444
I/O Scheduling 445
CPU Monitoring and Configuration 446
Basic CPU Load Information 446
Detailed CPU Load Information 448
Memory Monitoring and Configuration 450
Basic Memory Usage Information 450
Detailed Memory Usage Information 451
Out of Memory Killer 452
Swap Space 452
Troubleshooting Additional Hardware Issues 455
Memory 455
Printers 455
Video 455
Communications Ports 456
USB 458
Keyboard Mapping 461
Hardware or Software 461
Commands 462
Summary 465
Chapter 17 Kernel Modules 471
“Do I Know This Already?” Quiz 471
Understanding Kernel Modules 473
Managing Kernel Modules 474
Loading and Unloading Modules Manually 475
The modprobe Command 477
Summary 480
Chapter 18 Storage Concepts 485
“Do I Know This Already?” Quiz 485
Basic Partitions 487
Partitions 487
Filesystem Hierarchy 488
Device Mapper 490
RAID 490
Logical Volume Manager (LVM) 491
Filesystem Types 493
Summary 494
Chapter 19 Storage Configuration 499
“Do I Know This Already?” Quiz 499
Disk Partitioning Tools 501
fdisk 501
parted 504
Managing LVM 505
Managing Software RAID 506
Creating Filesystems 507
The mkfs Command 507
Filesystem Creation Options 508
Advanced Filesystem Commands 510
Filesystem Checker 511
Tuning Filesystems 512
XFS Commands 512
Mounting and Unmounting 513
Viewing Partition and Filesystem Device File Information 514
The Filesystem Table 516
Manually Mounting Filesystems 518
Unmounting Filesystems 518
Space Utilization 519
Using iostat 519
Using du 519
Using df 520
Summary 521
Part V: Network Management
Chapter 20 Network Configuration 527
“Do I Know This Already?” Quiz 527
Conceptual Overview of Networking 529
Necessary Configuration Information 530
IP Addresses 530
Networks and Hosts 531
Address Class Ranges 531
Network Masks 532
Using Default Network Masks 533
Gateway Addresses, or “Do I Dial with the Area Code?” 534
Broadcast Addresses 535
Custom Network Masks 535
Determining a Custom Network Mask 535
Additional Protocols 538
Common Ports 539
IPv6 541
Managing Interfaces 542
Viewing IP Information 542
Red Hat Interface Configuration 544
Debian Interface Configuration 545
Viewing and Configuring Gateway Addresses 546
/etc/netplan 549
/etc/sysctl.conf 550
Network Configuration Utilities 551
Network Utility Examples 552
ss 555
Bonding 566
Aggregation 566
Active/Passive 568
Load Balancing 568
Summary 569
Chapter 21 Network Troubleshooting 575
“Do I Know This Already?” Quiz 575
Key Network Troubleshooting Concepts 577
Network Troubleshooting Tools 578
The traceroute Command 579
The tcpdump Command 582
Wireshark 583
The arp Command 586
The nmap Command 587
The nc Command 591
The whois Command 593
The iftop Command 594
The iperf and ipset Commands 594
Summary 595
Chapter 22 Linux Firewalls 599
“Do I Know This Already?” Quiz 599
The iptables Command 601
Overview of Filtering Packets 601
Important Terms 604
Using iptables to Filter Incoming Packets 605
Filtering by Protocol 607
Multiple Criteria 608
Filtering Based on Destination 608
Changing the Default Policy 609
Revisiting the Original Rules 610
Saving the Rules 610
Using iptables to Filter Outgoing Packets 611
Stateful Rules 612
Logging Rules 612
Implementing NAT 613
Additional Firewall Technologies 614
firewalld 614
ufw 614
Dynamic Rule Sets 615
Summary 618
Part VI: Automation
Chapter 23 Orchestration 623
“Do I Know This Already?” Quiz 623
Automation and Orchestration 625
Agent vs. Agentless 625
Procedures and Attributes 625
Infrastructure Automation 626
Infrastructure as Code 626
Inventory 626
Automated Configuration Management 626
Build Automation 627
Summary 627
Chapter 24 Automate Tasks 631
“Do I Know This Already?” Quiz 631
Job Control 633
Leaving Programs Running After Logout 634
The cron System 635
Configuring crontabs 635
Other Files 640
Restricting Access 642
Running ad hoc Jobs 642
The at Command 643
The batch Command 644
Summary 645
Chapter 25 Manage Localization 651
“Do I Know This Already?” Quiz 651
Time Zones 653
Displaying and Setting System Time 653
Displaying and Setting the Hardware Clock 654
Setting Time Zones 655
The timedatectl Command 656
Character Encoding 656
Representing Locales 657
Fallback Locales 658
Contents of a Locale 659
The localectl Command 660
How Linux Uses the Locale 660
Chapter 26 BASH Scripting Essentials 667
“Do I Know This Already?” Quiz 667
Basics of Scripting 669
Environment Variables and Settings 670
Variable Expansion 672
The PATH Variable 673
Running a Script 674
Good Design 675
Shell Script Commands 675
Using the Output of Another Command 675
Conditionals 676
Testing Files 678
An Easier Test Syntax 679
Testing Strings 680
Testing Integers 680
Combining Multiple Tests 681
Case Statements 682
Loops 683
Interacting with Other Programs 686
Returning an Error Code 687
Accepting Arguments 687
Chapter 27 Git 693
“Do I Know This Already?” Quiz 693
Version Control Concepts 695
The First Generation 695
The Second Generation 696
The Third Generation 697
Installing Git 700
Git Concepts and Features 701
Git Stages 702
Choosing Your Git Repository Host 703
Configuring Git 703
Getting the Status of Files 706
The .git Directory 708
Telling Git to Ignore a File 708
Handling Branches 709
Executing Diffs 711
Comparing Versions 713
Dealing with Whitespace 713
Comparing Branches 714
Merging Files 716
Part VII: Security and Server Management
Chapter 28 Server Roles 727
“Do I Know This Already?” Quiz 727
Server Types 729
NTP 729
SSH 730
Certificate Authority 730
Name Server 730
DHCP 731
SNMP 731
File Servers 731
Authentication Server 732
Proxy 733
VPN 733
Database 733
Print Server 734
Mail Server 734
Server Features 734
Web 734
Logging 735
Containers 735
Monitoring 735
Load Balancer 736
Clustering 736
Summary 736
Chapter 29 Security Best Practices 741
“Do I Know This Already?” Quiz 741
Host Security Best Practices 743
Boot Security 743
Shared IDs 744
Separation of OS Data from Application Data 744
The auditd Daemon 745
CVE Monitoring 745
USB Devices 745
Disk Encryption 745
Restrict cron Access 746
Disable Ctrl+Alt+Del 746
MOTD 746
Authentication Security Best Practices 746
Multifactor Authentication 746
RADIUS 748
TACACS+ 748
LDAP 748
Kerberos 749
Service Security Best Practices 749
SSH Security Policies 749
Enforce Use of PKI 750
Chroot Jail Services 750
Denying Hosts 751
Change Default Ports 751
Disabling or Uninstalling Unused and Unsecure Services 751
SSL/TLS 753
Banners 753
Summary 753
Part VIII: Final Preparation
Chapter 30 Final Preparation 757
Exam Information 757
Getting Ready 759
Tools for Final Preparation 760
Pearson Test Prep Practice Test Software and Questions on the Website 760
Customizing Your Exams 762
Updating Your Exams 763
Chapter-Ending Review Tools 764
Suggested Plan for Final Review/Study 764
Summary 764
Glossary 765
Appendix A Answers to the “Do I Know This Already?” Quizzes and Review Questions 783
Appendix B CompTIA Linux+ XK0-004 Cert Guide Exam Updates 811
Appendix C Study Planner
We've made every effort to ensure the accuracy of this book and its companion content. Any errors that have been confirmed since this book was published can be downloaded below.
Download the errata (52 KB .doc)