ENGLISH

How Linux works : what every superuser should know, 2ed

Book information

Publisher
No Starch Press
Year
2015
Language
english
Format
PDF
Filesize
5 MB (5314521 bytes)
Edition
2
Pages
394\394
Topic
Computers\\Operating Systems
Time added
2020-01-10 08:59:40

Description

Brief Contents ......Page 6 Contents in Detail ......Page 8 Preface......Page 20 A Hands-On Approach ......Page 21 What’s New in the Second Edition?......Page 22 A Note on Terminology......Page 23 Acknowledgements......Page 24 Chapter 1: The Big Picture......Page 26 1.1 Levels and Layers of Abstraction in a Linux System......Page 27 1.3 The Kernel......Page 29 1.3.1 Process Management......Page 30 1.3.2 Memory Management......Page 31 1.3.4 System Calls and Support......Page 32 1.4 User Space......Page 33 1.5 Users......Page 34 1.6 Moving Forward......Page 35 Chapter 2: Basic Commands and Directory Hierarchy......Page 36 2.2.1 The Shell Window......Page 37 2.2.3 Standard Input and Standard Output......Page 38 2.3.1 ls......Page 39 2.3.4 touch......Page 40 2.4.1 cd......Page 41 2.4.4 Shell Globbing (Wildcards)......Page 42 2.5.1 grep......Page 43 2.5.3 pwd......Page 44 2.5.6 find and locate......Page 45 2.8 Environment and Shell Variables......Page 46 2.9 The Command Path......Page 47 2.10 Special Characters......Page 48 2.12 Text Editors......Page 49 2.13 Getting Online Help......Page 50 2.14.1 Standard Error......Page 52 2.15.1 Anatomy of a UNIX Error Message......Page 53 2.15.2 Common Errors......Page 54 2.16 Listing and Manipulating Processes......Page 55 2.16.2 Killing Processes......Page 56 2.16.4 Background Processes......Page 57 2.17 File Modes and Permissions......Page 58 2.17.1 Modifying Permissions......Page 59 2.17.2 Symbolic Links......Page 60 2.17.3 Creating Symbolic Links......Page 61 2.18.2 tar......Page 62 2.18.3 Compressed Archives (.tar.gz)......Page 63 2.18.5 Other Compression Utilities......Page 64 2.19 Linux Directory Hierarchy Essentials......Page 65 2.19.2 The /usr Directory......Page 66 2.20.1 sudo......Page 67 2.21 Looking Forward......Page 68 Chapter 3: Devices......Page 70 3.1 Device Files......Page 71 3.2 The sysfs Device Path......Page 72 3.3 dd and Devices......Page 73 3.4 Device Name Summary......Page 74 3.4.1 Hard Disks: /dev/sd*......Page 75 3.4.4 Terminals: /dev/tty*, /dev/pts/*, /dev/tty......Page 76 3.4.6 Parallel Ports: /dev/lp0, /dev/lp1......Page 77 3.4.8 Creating Device Files......Page 78 3.5.1 devtmpfs......Page 79 3.5.2 udevd Operation and Configuration......Page 80 3.5.4 Monitoring Devices......Page 82 3.6 In-Depth: SCSI and the Linux Kernel......Page 83 3.6.1 USB Storage and SCSI......Page 86 3.6.2 SCSI and ATA......Page 87 3.6.4 Multiple Access Methods for a Single Device......Page 88 Chapter 4: Disks and Filesystems......Page 90 4.1 Partitioning Disk Devices......Page 92 4.1.1 Viewing a Partition Table......Page 93 4.1.2 Changing Partition Tables......Page 94 4.1.3 Disk and Partition Geometry......Page 95 4.2 Filesystems......Page 97 4.2.1 Filesystem Types......Page 98 4.2.2 Creating a Filesystem......Page 99 4.2.3 Mounting a Filesystem......Page 100 4.2.4 Filesystem UUID......Page 101 4.2.6 Filesystem Mount Options......Page 102 4.2.8 The /etc/fstab Filesystem Table......Page 104 4.2.9 Alternatives to /etc/fstab......Page 105 4.2.10 Filesystem Capacity......Page 106 4.2.11 Checking and Repairing Filesystems......Page 107 4.2.12 Special-Purpose Filesystems......Page 109 4.3.2 Using a File as Swap Space......Page 110 4.4 Moving Forward: Disks and User Space......Page 111 4.5 Inside a Traditional Filesystem......Page 112 4.5.1 Viewing Inode Details......Page 114 4.5.2 Working With Filesystems in User Space......Page 115 4.5.3 The Evolution of Filesystems......Page 116 Chapter 5: How the Linux Kernel Boots......Page 118 5.1 Startup Messages......Page 119 5.2 Kernel Initialization and Boot Options......Page 120 5.3 Kernel Parameters......Page 121 5.4.1 Boot Loader Tasks......Page 122 5.5 GRUB Introduction......Page 123 5.5.1 Exploring Devices and Partitions with the GRUB Command Line......Page 125 5.5.2 GRUB Configuration......Page 127 5.5.3 GRUB Installation......Page 129 5.7 Chainloading Other Operating Systems......Page 131 5.8.1 MBR Boot......Page 132 5.8.3 How GRUB Works......Page 133 Chapter 6: How User Space Starts......Page 136 6.1 Introduction to init......Page 137 6.2 System V Runlevels......Page 138 6.4.1 Units and Unit Types......Page 139 6.4.2 systemd Dependencies......Page 140 6.4.3 systemd Configuration......Page 142 6.4.4 systemd Operation......Page 145 6.4.5 Adding Units to systemd......Page 147 6.4.6 systemd Process Tracking and Synchronization......Page 148 6.4.7 systemd On-Demand and Resource-Parallelized Startup......Page 149 6.4.9 systemd Auxiliary Support......Page 154 6.5.1 Upstart Startup Sequence......Page 155 6.5.2 Upstart Jobs......Page 156 6.5.3 Upstart Configuration......Page 158 6.5.4 Upstart Operation......Page 162 6.5.6 Upstart Runlevels and System V Compatibility......Page 163 6.6 System V init......Page 164 6.6.1 System V init: Startup Command Sequence......Page 166 6.6.2 The System V init Link Farm......Page 167 6.6.4 Controlling System V init......Page 168 6.7 Shutting Down Your System......Page 169 6.8 The Initial RAM Filesystem......Page 170 6.9 Emergency Booting and Single-User Mode......Page 171 Chapter 7: System Configuration: Logging, System Time, Batch Jobs, and Users......Page 174 7.2 System Logging......Page 175 7.2.2 Configuration Files......Page 176 7.3.1 The /etc/passwd File......Page 178 7.3.4 Manipulating Users and Passwords......Page 180 7.3.5 Working with Groups......Page 181 7.5 Setting the Time......Page 182 7.5.2 Network Time......Page 183 7.6 Scheduling Recurring Tasks with cron......Page 184 7.6.1 Installing Crontab Files......Page 185 7.7 Scheduling One-Time Tasks with at......Page 186 7.8.1 Process Ownership, Effective UID, Real UID, and Saved UID......Page 187 7.9.1 Using Libraries for User Information......Page 189 7.10 PAM......Page 190 7.10.1 PAM Configuration......Page 191 7.10.2 Notes on PAM......Page 194 7.11 Looking Forward......Page 195 Chapter 8: A Closer Look at Processes and Resource Utilization......Page 196 8.2.1 Reading the lsof Output......Page 197 8.2.2 Using lsof......Page 198 8.3.1 strace......Page 199 8.4.1 Single-Threaded and Multithreaded Processes......Page 201 8.4.2 Viewing Threads......Page 202 8.6 Measuring CPU Time......Page 203 8.7 Adjusting Process Priorities......Page 204 8.8.1 Using uptime......Page 205 8.9 Memory......Page 206 8.9.2 Page Faults......Page 207 8.10 Monitoring CPU and Memory Performance with vmstat......Page 208 8.11.1 Using iostat......Page 210 8.11.2 Per-Process I/O Utilization and Monitoring: iotop......Page 211 8.12 Per-Process Monitoring with pidstat......Page 212 8.13 Further Topics......Page 213 Chapter 9: Understanding Your Network and Its Configuration......Page 214 9.1.1 Packets......Page 215 9.2 Network Layers......Page 216 9.3 The Internet Layer......Page 217 9.3.1 Viewing Your Computer's IP Addresses......Page 218 9.3.2 Subnets......Page 219 9.4 Routes and the Kernel Routing Table......Page 220 9.4.1 The Default Gateway......Page 221 9.5.1 ping......Page 222 9.5.3 DNS and host......Page 223 9.7 Understanding Kernel Network Interfaces......Page 224 9.8 Introduction to Network Interface Configuration......Page 225 9.8.1 Manually Adding and Deleting Routes......Page 226 9.10 Problems with Manual and Boot-Activated Network Configuration......Page 227 9.11.1 NetworkManager Operation......Page 228 9.11.3 NetworkManager Configuration......Page 229 9.12 Resolving Hostnames......Page 231 9.12.2 resolv.conf......Page 232 9.12.4 /etc/nsswitch.conf......Page 233 9.14 The Transport Layer: TCP, UDP, and Services......Page 234 9.14.2 Establishing TCP Connections......Page 235 9.14.3 Port Numbers and /etc/services......Page 236 9.14.5 UDP......Page 237 9.16.1 The Linux DHCP Client......Page 239 9.17 Configuring Linux as a Router......Page 240 9.18 Private Networks......Page 241 9.19 Network Address Translation (IP Masquerading)......Page 242 9.20 Routers and Linux......Page 243 9.21 Firewalls......Page 244 9.21.1 Linux Firewall Basics......Page 245 9.21.2 Setting Firewall Rules......Page 246 9.21.3 Firewall Strategies......Page 248 9.22 Ethernet, IP, and ARP......Page 250 9.23 Wireless Ethernet......Page 251 9.23.1 iw......Page 252 9.24 Summary......Page 253 Chapter 10: Network Applications and Services......Page 254 10.1.1 A Closer Look......Page 255 10.2 Network Servers......Page 257 10.3 Secure Shell (SSH)......Page 258 10.3.1 The SSHD Server......Page 259 10.3.2 The SSH Client......Page 261 10.4 The inetd and xinetd Daemons......Page 262 10.5 Diagnostic Tools......Page 263 10.5.1 lsof......Page 264 10.5.2 tcpdump......Page 265 10.5.3 netcat......Page 266 10.5.4 Port Scanning......Page 267 10.7 Network Security......Page 268 10.7.1 Typical Vulnerabilities......Page 269 10.8 Looking Forward......Page 270 10.9 Sockets: How Processes Communicate with the Network......Page 271 10.10.1 Advantages for Developers......Page 272 10.10.2 Listing Unix Domain Sockets......Page 273 11.1 Shell Script Basics......Page 274 11.1.1 Limitations of Shell Scripts......Page 275 11.2.1 Literals......Page 276 11.2.3 Double Quotes......Page 277 11.3 Special Variables......Page 278 11.3.3 All Arguments: [email protected] 279 11.4 Exit Codes......Page 280 11.5 Conditionals......Page 281 11.5.2 Using Other Commands for Tests......Page 282 11.5.4 && and || Logical Constructs......Page 283 11.5.5 Testing Conditions......Page 284 11.5.6 Matching Strings with case......Page 286 11.6.2 The while Loop......Page 287 11.7 Command Substitution......Page 288 11.8 Temporary File Management......Page 289 11.10.1 basename......Page 290 11.10.3 sed......Page 291 11.10.4 xargs......Page 292 11.11 Subshells......Page 293 11.13 Reading User Input......Page 294 11.14 When (Not) to Use Shell Scripts......Page 295 Chapter 12: Moving Files Across the Network......Page 296 12.2.1 rsync Basics......Page 297 12.2.2 Making Exact Copies of a Directory Structure......Page 298 12.2.3 Using the Trailing Slash......Page 299 12.2.4 Excluding Files and Directories......Page 300 12.2.5 Transfer Integrity, Safeguards, and Verbose Modes......Page 301 12.2.8 Transferring Files to Your Computer......Page 302 12.4 Sharing Files with Samba......Page 303 12.4.2 Server Access Control......Page 304 12.4.3 Passwords......Page 305 12.4.6 Configuring a File Share......Page 307 12.4.9 Using the Samba Client......Page 308 12.4.10 Accessing Files as a Client......Page 309 12.5 NFS Clients......Page 310 12.6 Further Network File Service Options and Limitations......Page 311 Chapter 13: User Environments......Page 312 13.3 Shell Startup File Elements......Page 313 13.3.1 The Command Path......Page 314 13.3.4 Aliases......Page 315 13.4 Startup File Order and Examples......Page 316 13.4.1 The bash Shell......Page 317 13.4.2 The tcsh Shell......Page 319 13.5.2 Editor......Page 320 13.7 Further Startup Topics......Page 321 Chapter 14: A Brief Survey of the Linux Desktop......Page 322 14.1.1 Window Managers......Page 323 14.2 A Closer Look at the X Window System......Page 324 14.2.2 Network Transparency......Page 325 14.3.1 X Events......Page 326 14.3.2 Understanding X Input and Preference Settings......Page 327 14.5 D-Bus......Page 330 14.5.2 Monitoring D-Bus Messages......Page 331 14.6.1 CUPS......Page 332 14.7 Other Desktop Topics......Page 333 Chapter 15: Development Tools......Page 334 15.1 The C Compiler......Page 335 15.1.2 Header (Include) Files and Directories......Page 336 15.1.3 Linking with Libraries......Page 338 15.1.4 Shared Libraries......Page 339 15.2.1 A Sample Makefile......Page 343 15.2.3 Final Program Build......Page 344 15.2.5 Command-Line Arguments and Options......Page 345 15.2.6 Standard Macros and Variables......Page 346 15.2.8 Organizing a Makefile......Page 347 15.3 Debuggers......Page 348 15.4 Lex and Yacc......Page 349 15.5 Scripting Languages......Page 350 15.5.3 Other Scripting Languages......Page 351 15.6 Java......Page 352 15.7 Moving Forward: Compiling Packages......Page 353 Chapter 16: Introduction to Compiling Software from C Source Code......Page 354 16.2 Unpacking C Source Packages......Page 355 16.2.1 Where to Start......Page 356 16.3.1 An Autoconf Example......Page 357 16.3.2 Installing Using a Packaging Tool......Page 358 16.3.4 Environment Variables......Page 359 16.3.7 pkg-config......Page 361 16.4.1 Where to Install......Page 363 16.5 Applying a Patch......Page 364 16.6.1 Specific Errors......Page 365 16.7 Looking Forward......Page 367 Chapter 17: Building on the Basics......Page 370 17.2 Databases......Page 371 17.3 Virtualization......Page 372 17.5 Embedded Systems......Page 373 17.6 Final Remarks......Page 374 Bibliography......Page 376 Index ......Page 380 Updates......Page 393

Similar books