HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Here are all the CompTIA Linux+/LPIC-1 Linux commands you need in one condensed, portable resource. The CompTIA Linux+/LPIC-1 Portable Command Guide is filled with valuable, easy-to-access information and is portable enough to use wherever your work takes you.
The guide summarizes all Linux+/LPIC-1 certification-level Linux commands, keywords, command arguments, and associated prompts, and provides tips and examples of how to apply them to real-world scenarios. Configuration examples throughout the book provide you with a better understanding of how these commands are used in real-world environments.
This book reflects topics in today’s CompTIA LX0-103 & LX0-104 and LPI 101-400 & 102-400 exams. Use this quick reference resource to help you memorize commands and concepts as you work to pass any of these CompTIA or LPI certification exams.
The book is organized into these parts:
Exam LX0-103/LPI 101-400
Part I: System Architecture
Part II: Linux Installation and Package Management
Part III: GNU and Unix Commands
Part IV: Devices, Linux Filesystems, Filesystem Hierarchy Standard
Exam LX0-104/LPI 102-400
Part V: Shells, Scripting, and Data Management
Part VI: User Interfaces and Desktops
Part VII: Administrative Tasks
Part VIII: Essential System Services
Part IX: Networking Fundamentals
Part X: Securityuick, offline access to all CompTIA
Introduction xxvi
Part I: System Architecture
CHAPTER 1 Determine and Confi gure Hardware Settings 1
/sys 1
Key Files and Directories in /sys 1
/proc 1
Key Files and Directories in /proc 2
/dev 2
Key Files in /dev 2
modprobe 3
Key Options for the modprobe Command 3
lsmod 3
Output of the lsmod Command 3
lspci 4
Key Options for the lspci Command 4
lsusb 5
Key Options for the lsusb Command 5
CHAPTER 2 Boot the System 7
The Boot Sequence 7
Common Commands for the Boot Loader 8
Options for the Kernel at Boot Time 8
SysVinit 9
Systemd 10
Upstart 11
Boot Events in the Log Files 11
dmesg 12
CHAPTER 3 Change Runlevels / Boot Targets and Shut Down or Reboot System 13
Set the Default Runlevel or Boot Target 13
Change between Runlevels / Boot Targets, Including Single-User Mode 14
Shut Down and Reboot from the Command Line 14
Alert Users Before Switching Runlevels / Boot Targets or Other Major System Events 15
Properly Terminate Processes 15
/etc/inittab 16
shutdown 16
init 16
/etc/init.d/ 16
telinit 16
systemd 16
systemctl 16
/etc/systemd/ 16
/usr/lib/systemd/ 16
wall 16
Part II: Linux Installation and Package Management
CHAPTER 4 Design Hard Disk Layout 19
Allocate Filesystems and Swap Space to Separate Partitions or Disks 19
Tailor the Design to the Intended Use of the System 19
Ensure the /boot Partition Conforms to the Hardware Architecture Requirements for Booting 20
Knowledge of Basic features of LVM 20
/ (root) Filesystem 22
/var Filesystem 22
/home Filesystem 23
/boot Filesystem 23
Swap Space 23
Mount Points 23
Partitions 23
CHAPTER 5 Install a Boot Manager 25
Providing Alternative Boot Locations and Backup Boot Options 25
Install and Configure a Boot Loader Such As GRUB Legacy 25
Perform Basic Configuration Changes for GRUB 2 26
Interact with the Boot Loader 26
menu.lst, grub.cfg, and grub.conf 28
grub-install 30
grub-mkconfig 30
MBR 31
CHAPTER 6 Manage Shared Libraries 33
Identify Shared Libraries 33
Identify the Typical Locations of System Libraries 33
Load Shared Libraries 33
ldd 34
ldconfig 34
/etc/ld.so.conf 35
LD_LIBRARY_PATH 36
CHAPTER 7 Use Debian Package Management 37
Install, Upgrade, and Uninstall Debian Binary Packages 37
Find Packages Containing Specific Files or Libraries that May or May Not Be Installed 37
Obtain Package Information Such As Version, Content, Dependencies, Package Integrity, and Installation Status (Whether or Not the Package Is Installed) 38
/etc/apt/sources.list 38
dpkg 39
dpkg-reconfigure 39
apt-get 40
apt-cache 40
aptitude 41
CHAPTER 8 Use RPM and YUM Package Management 43
Install, Reinstall, Upgrade, and Remove Packages Using RPM and YUM 43
Obtain Information on RPM Packages Such As Version, Status, Dependencies, Integrity, and Signatures 43
Determine What Files a Package Provides, as Well as Find Which Package a Specific File Comes From 44
rpm 44
rpm2cpio 45
/etc/yum.conf 46
/etc/yum.repos.d/ 46
yum 47
yumdownloader 48
Part III: GNU and Unix Commands
CHAPTER 9 Work on the Command Line 49
Use Single Shell Commands and One-Line Command Sequences to Perform Basic Tasks on the Command Line 49
Use and Modify the Shell Environment, Including Defining, Referencing, and Exporting Environment Variables 50
Use and Edit Command History 51
Invoke Commands Inside and Outside the Defined Path 52
bash 52
echo 52
env 53
export 53
pwd 54
set 55
unset 55
man 55
uname 57
history 57
.bash_history 58
CHAPTER 10 Process Text Streams Using Filters 59
cat 59
cut 60
expand 60
fmt 61
head 62
join 62
less 62
nl 63
od 63
paste 63
pr 64
sed 64
sort 66
split 67
tail 67
tr 68
unexpand 69
uniq 69
wc 69
CHAPTER 11 Perform Basic File Management 71
Copy, Move, and Remove Files and Directories Individually 71
Copy Multiple Files and Directories Recursively 72
Remove Files and Directories Recursively 72
Use Simple and Advanced Wildcard Specifications in Commands 72
Using find to Locate and Act on Files Based on Type, Size, or Time 72
Usage of tar, cpio, and dd 72
cp 72
find 73
mkdir 75
mv 75
ls 76
rm 77
rmdir 77
touch 77
tar 78
cpio 78
dd 79
file 79
gzip 79
gunzip 80
bzip2 80
xz 81
File Globbing 81
CHAPTER 12 Use Streams, Pipes, and Redirects 83
Redirecting Standard Input, Standard Output, and Standard Error 83
Pipe the Output of One Command to the Input of Another Command 84
Use the Output of One Command as Arguments to Another Command 85
Send Output to Both STDOUT and a File 86
tee 86
xargs 86
CHAPTER 13 Create, Monitor, and Kill Processes 89
Run Jobs in the Foreground and Background 89
Signal a Program to Continue Running After Logout 90
Monitor Active Processes 90
Select and Sort Processes for Display 90
Send Signals to Processes 90
& 90
bg 90
fg 91
jobs 91
kill 91
nohup 92
ps 92
top 93
free 94
uptime 95
pgrep 95
pkill 95
killall 96
CHAPTER 14 Modify Process Execution Priorities 97
Know the Default Priority of a Job that Is Created 97
Run a Program with Higher or Lower Priority than the Default 97
Change the Priority of a Running Process 97
nice 97
ps 98
renice 98
top 98
CHAPTER 15 Search Text Files Using Regular Expressions 99
Create Simple Regular Expressions Containing Several Notational Elements 99
Use Regular Expression Tools to Perform Searches through a Filesystem or File Content 99
grep 100
egrep 101
fgrep 101
sed 101
regex(7) 102
CHAPTER 16 Perform Basic File Editing Operations Using vi 105
Navigate a Document Using vi 105
Use Basic vi Modes 105
Insert, Edit, Delete, Copy, and Find Text 106
vi 106
/, ? 106
h, j, k, l 107
i, o, a 107
c, d, p, y, dd, yy 108
ZZ, :w!, :q!, :e! 109
Part IV: Devices, Linux Filesystems, and the Filesystem Hierarchy Standard
CHAPTER 17 Create Partitions and Filesystems 111
Manage MBR Partition Tables 111
Use Various mkfs Commands to Create Various Filesystems, Such As ext2/ext3/ext4, XFS, and VFAT 112
Awareness of ReiserFS and btrfs 112
Basic Knowledge of gdisk and parted with GP 113
fdisk 113
gdisk 114
parted 115
mkfs 116
mkswap 117
swapon 117
CHAPTER 18 Maintain the Integrity of Filesystems 119
Verify the Integrity of Filesystems 119
Monitor Free Space and Inodes 119
Repair Simple Filesystem Problems 119
du 119
df 120
fsck 120
e2fsck 121
mke2fs 121
debugfs 121
dumpe2fs 122
tune2fs 122
XFS Tools (Such As xfs_metadump and xfs_info) 123
CHAPTER 19 Control Mounting and Unmounting of Filesystems 125
Manually Mount and Unmount Filesystems 125
Configure Filesystem Mounting on Bootup 125
Configure User-Mountable Removable Filesystems 125
/etc/fstab 125
/media 126
mount 126
umount 127
CHAPTER 20 Manage Disk Quotas 129
Set Up a Disk Quota for a Filesystem 129
Edit, Check, and Generate User Quota Reports 130
quota 130
edquota 131
repquota 132
quotaon 132
CHAPTER 21 Manage File Permissions and Ownership 133
Manage Access Permissions on Regular and Special Files As Well As Directories 133
Use Access Modes Such As suid, sgid, and the Sticky Bit to Maintain Security 133
Know How to Change the File Creation Mask 134
Use the Group Field to Grant File Access to Group Members 134
chmod 134
umask 136
chown 136
chgrp 137
CHAPTER 22 Create and Change Hard and Symbolic Links 139
Create Links 139
Identify Hard and/or Soft Links 139
Copying Versus Linking Files 139
Hard Links 139
Soft Links 140
Use Links to Support System Administration Tasks 140
ln 141
ls 142
CHAPTER 23 Find System Files and Place Files in the Correct Location 143
Understand the Correct Locations of Files Under the FHS 143
Find Files and Commands on a Linux System 144
Know the Location and Purpose of Important Files and Directories as Defined in the FHS 144
find 144
locate 146
updatedb 147
whereis 147
which 147
type 148
/etc/updatedb.conf 148
Part V: Shell Scripting and Data Management
CHAPTER 24 Customize and Use the Shell Environment 151
Set Environment Variables (For Example, PATH) at Login or When Spawning a New Shell 151
Write Bash Functions for Frequently Used Sequences of Commands 153
Maintain Skeleton Directories for New User Accounts 153
Set Command Search Path with the Proper Directory 153
source 154
/etc/bash.bashrc 154
/etc/profile 154
env 154
export 155
set 155
unset 155
~/.bash_profile 155
~/.bash_login 156
~/.profile 156
~/.bashrc 156
~/.bash_logout 156
Function 156
Alias 157
Lists 157
CHAPTER 25 Customize or Write Simple Scripts 159
Use Standard sh Syntax (Loops, Tests) 159
Use Command Substitution 159
Test Return Values for Success or Failure or Other Information Provided by a Command 160
Perform Conditional Mailing to the Superuser 160
Correctly Select the Script Interpreter through the Shebang (#!) Line 160
Manage the Location, Ownership, Execution and suid-rights of scripts 161
for 161
while 161
test 162
if 163
read 164
seq 164
exec 164
CHAPTER 26 SQL Data Management 165
Use of Basic SQL Commands 165
Perform Basic Data Manipulation 165
insert 165
update 166
select 166
delete 166
from 166
where 167
group by 167
order by 167
join 167
Part VI: User Interfaces and Desktops
CHAPTER 27 Install and Confi gure X11 169
Verify that the Video Card and Monitor Are Supported by an X Server 169
Awareness of the X Font Server 169
Basic Understanding and Knowledge of the X Window Configuration File 169
/etc/X11/xorg.conf 169
xhost 171
DISPLAY 171
xwininfo 172
xdpyinfo 174
X 174
CHAPTER 28 Set Up a Display Manager 175
Basic Configuration of LightDM 175
Turn the Display Manager On or Off 175
Change the Display Manager Greeting 175
Awareness of XDM, KDM, and GDM 176
lightdm 176
/etc/lightdm 176
CHAPTER 29 Accessibility 177
Basic Knowledge of Keyboard Accessibility Settings (AccessX) 177
Basic Knowledge of Visual Settings and Themes 177
Basic Knowledge of Assistive Technology (AT) 178
Sticky/Repeat Keys 178
Slow/Bounce/Toggle Keys 179
Mouse Keys 179
High Contrast/Large Print Desktop Themes 179
Screen Reader 180
Braille Display 180
Screen Magnifier 180
On-Screen Keyboard 180
Orca 180
GOK 180
emacspeak 180
Part VII: Administrative Tasks
CHAPTER 30 Manage User and Group Accounts and Related System Files 181
Add, Modify, and Remove Users and Groups 181
Manage User/Group Info in Password/Group Databases 181
Create and Manage Special-Purpose and Limited Accounts 181
/etc/passwd 182
/etc/shadow 183
/etc/group 184
/etc/skel/ 184
chage 184
getent 185
groupadd 185
groupdel 185
groupmod 185
passwd 186
useradd 186
userdel 187
usermod 187
CHAPTER 31 Automate System Administration Tasks by Scheduling Jobs 189
Manage cron and at Jobs 189
Configure User Access to cron and at Services 189
Configure anacron 191
/etc/cron.{d,daily,hourly,monthly,weekly}/ 191
/etc/at.deny 192
/etc/at.allow 192
/etc/crontab 192
/etc/cron.allow 193
/etc/cron.deny 193
/var/spool/cron/ 193
crontab 193
at 195
atq 195
atrm 195
anacron 196
/etc/anacrontab 196
CHAPTER 32 Localization and Internationalization 199
Configure Locale Settings and Environment Variables 199
Configure Timezone Settings and Environment Variables 199
/etc/timezone 200
/etc/localtime 200
/usr/share/zoneinfo/ 200
LC_* 201
LC_ALL 202
LANG 202
TZ 202
/usr/bin/locale 202
tzselect 202
timedatectl 205
date 205
iconv 206
UTF-8 206
ISO-8859 207
ASCII 207
Unicode 207
Part VIII: Essential System Services
CHAPTER 33 Maintain System Time 209
Set the System Date and Time 209
Set the Hardware Clock to the Correct Time in UTC 209
Configure the Correct Timezone 209
Basic NTP Configuration 209
Knowledge of Using the pool.ntp.org Service 210
Awareness of the ntpq Command 210
/usr/share/zoneinfo/ 210
/etc/timezone 210
/etc/localtime 210
/etc/ntp.conf 210
date 211
hwclock 211
ntpd 211
ntpdate 212
pool.ntp.org 212
CHAPTER 34 System Logging 213
Configuration of the Syslog Daemon 213
Understanding of Standard Facilities, Priorities, and Actions 213
Configuration of logrotate 213
Awareness of rsyslog and syslog-ng 214
syslog.conf 214
syslogd 215
klogd 216
/var/log/ 216
logger 216
logrotate 216
/etc/logrotate.conf 217
/etc/logrotate.d/ 218
journalctl 219
/etc/systemd/journald.conf 219
/var/log/journal/ 220
CHAPTER 35 Mail Transfer Agent (MTA) Basics 221
Create Email Aliases 221
Configure Email Forwarding 221
Knowledge of Commonly Available MTA Programs (postfix, sendmail, qmail, exim) (no configuration) 221
newaliases 222
mail 222
mailq 223
postfix 223
sendmail 223
exim 223
qmail 223
~/.forward 223
sendmail Emulation Layer Commands 224
CHAPTER 36 Manage Printers and Printing 225
Basic CUPS Configuration (for Local and Remote Printers) 225
Manage User Print Queues 226
Troubleshoot General Printing Problems 227
Add and Remove Jobs from Configured Printer Queues 228
CUPS Configuration files, Tools, and Utilities 228
/etc/cups/ 228
lpd Legacy Interface (lpr, lprm, lpq) 228
Part IX: Networking Fundamentals
CHAPTER 37 Fundamentals of Internet Protocols 229
Demonstrate an Understanding of Network Masks and CIDR Notation 229
Knowledge of the Differences Between Private and Public “Dotted Quad” IP Addresses 230
Knowledge About Common TCP and UDP Ports and Services (20, 21, 22, 23, 25, 53, 80, 110, 123, 139, 143, 161, 162, 389, 443, 465, 514, 636, 993, 995) 231
Knowledge About the Differences and Major Features of UDP, TCP, and ICMP 232
Knowledge of the Major Differences Between IPv4 and IPv6 233
Knowledge of the Basic Features of IPv6 233
/etc/services 233
IPv4, IPv6 234
Subnetting 234
TCP, UDP, ICMP 234
CHAPTER 38 Basic Network Confi guration 235
Manually and Automatically Configure Network Interfaces 235
Basic TCP/IP Host Configuration 235
Setting a Default Route 235
/etc/hostname 235
/etc/hosts 236
/etc/nsswitch.conf 236
ifconfig 236
ifup 237
ifdown 238
ip 238
route 239
ping 239
CHAPTER 39 Basic Network Troubleshooting 241
Manually and Automatically Configure Network Interfaces and Routing Tables to Include Adding, Starting, Stopping, Restarting, Deleting, or Reconfiguring Network Interfaces 241
Change, View, or Configure the Routing Table and Correct an Improperly Set Default Route Manually 241
ifconfig 242
ip 242
ifup 242
ifdown 242
route 242
host 242
hostname 242
dig 243
netstat 244
ping 244
ping6 244
traceroute 245
traceroute6 245
tracepath 246
tracepath6 246
netcat 246
CHAPTER 40 Confi gure Client-Side DNS 247
Query Remote DNS Servers 247
Configure local name resolution and use remote DNS servers 247
Modify the Order in Which Name Resolution Is Done 247
/etc/hosts 247
/etc/resolv.conf 247
/etc/nsswitch.conf 248
host 248
dig 248
getent 248
Part X: Security
CHAPTER 41 Perform Security Administration Tasks 249
Audit a System to Find Files with the suid/sgid Bit Set 249
Set or Change User Passwords and Password-Aging Information 250
Being Able to Use nmap and netstat to Discover Open Ports on a System 250
Set Up Limits on User Logins, Processes, and Memory Usage 250
Determine Which Users Have Logged in to the System or Are Currently Logged In 250
Basic sudo Configuration and Usage 250
find 250
passwd 250
fuser 250
lsof 251
nmap 252
chage 253
netstat 253
sudo 253
/etc/sudoers 253
su 254
usermod 254
ulimit 255
who, w, last 256
CHAPTER 42 Set Up Host Security 259
Awareness of Shadow Passwords and How They Work 259
Turn Off Network Services Not in Use 259
Understand the Role of TCP Wrappers 260
/etc/nologin 261
/etc/passwd 261
/etc/shadow 261
/etc/xinetd.d/ 261
/etc/xinetd.conf 262
/etc/inetd.d/ 262
/etc/inetd.conf 262
/etc/inittab 263
/etc/init.d/ 263
/etc/hosts.allow 263
/etc/hosts.deny 263
CHAPTER 43 Securing Data with Encryption 265
Perform Basic OpenSSH 2 Client Configuration and Usage 265
Understand the Role of OpenSSH 2 Server Host Keys 265
Perform Basic GnuPG Configuration, Usage, and Revocation 265
Understand SSH Port Tunnels (Including X11 Tunnels) 266
ssh 266
ssh-keygen 267
ssh-agent 268
ssh-add 268
~/.ssh/id_rsa and id_rsa.pub 268
~/.ssh/id_dsa and id_dsa.pub 268
/etc/ssh/ssh_host_rsa_key and ssh_host_rsa_key.pub 269
/etc/ssh/ssh_host_dsa_key and ssh_host_dsa_key.pub 269
~/.ssh/authorized_keys 269
ssh_known_hosts 269
gpg 270
~/.gnupg/ 271
APPENDIX Create Your Own Journal 273
9780789757111, TOC, 8/3/17