Important Announcement
PubHTML5 Scheduled Server Maintenance on (GMT) Sunday, June 26th, 2:00 am - 8:00 am.
PubHTML5 site will be inoperative during the times indicated!

Home Explore How Linux Works

How Linux Works

Published by Willington Island, 2021-07-27 02:34:20

Description: Unlike some operating systems, Linux doesn’t try to hide the important bits from you—it gives you full control of your computer. But to truly master Linux, you need to understand its internals, like how the system boots, how networking works, and what the kernel actually does.

In this third edition of the bestselling How Linux Works, author Brian Ward peels back the layers of this well-loved operating system to make Linux internals accessible. This edition has been thoroughly updated and expanded with added coverage of Logical Volume Manager (LVM), virtualization, and containers.

Search

Read the Text Version

date, 182 parallel, 55 dd, 50–51, 93 pipe (see pipe, named) debugfs, 93 SCSI (see SCSI) default gateway, 230–231, 238 serial, 55 default route, 230 socket, 49, 289–290 default.target, 143 terminal, 53–55 default user settings, 343–344 types, 48–49 demand paging, 210 device mapper, 53, 108–110 desktop, 347–348 devtmpfs, 57–58 desktop background, 359 df, 89–91 Desktop Bus. See D–Bus DHCP (Dynamic Host Configuration desktop environment, 350 /dev, 42, 48–66 Protocol), 252–253 /dev/dm–*, 53, 100 diff, 21, 395 /dev/hd*, 53 directory, 16–18, 36 /dev/lp*, 55 /dev/mapper, 53, 100, 105 change, 17 /dev/null, 48–49 create, 17 /dev/nvme*, 53 current, 17, 20, 201 /dev/parport*, 55 errors, 31 /dev/pts, 54 hierarchy, 16–17, 42–44 /dev/sd*, 52–53 home (see home directory) /dev/sg*, 53, 66–67 internal structure, 112–113 /dev/snd, 55 listing contents, 15 /dev/sr*, 53, 67 parent, 17, 112–114 /dev/tty*, 54–55 permissions (see permissions, /dev/vd*, 53 /dev/xvd*, 53, 403 directory) /dev/zero, 50–51 remove, 17–18 device, 47 root, 16–17, 42–43, 117, 120, audio, 55–56 124–125, 144 (see also inode, block, 48–50, 56, 64, 66–67, 69–78, root) disk 96 –97 buffer and cache, 86 character, 49–50, 56 capacity, 72–74 (see also filesystem, creating file, 56 capacity) disk, 48–50 device, 52–53, 69–78 driver, 4, 6–7, 117 device file (see device, disk) file, 42, 48–49, 56–61 format (see filesystem, creating; finding, 51 partition, creating table) information, 49–50, 58, 60–61 geometry, 77–80 initialization, 57–62 monitoring usage, 212–216 major and minor numbers, 49, 58, partition (see partition) PATA, 53 100 quota, 222 monitor, 61 raw access, 71 name, 51–55 SATA, 52, 58–60, 62, 64–66 network, 49 scheduling priority, 215 node (see device, file) schematic, 70–71 optical, 53, 67, 81 SCSI, 52–53, 62–63 solid state, 80 Index   425

disk (continued) /etc/login.defs, 197 swap (see swap) /etc/mtab, 86–87 usage (see filesystem, usage) /etc/nologin, 162 virtual, 53 /etc/nsswitch.conf, 246 /etc/passwd, 27, 36, 177–179, 192–193 display manager, 355 /etc/profile, 340 display modes, 54–55 /etc/rc.d, 157–161 dmesg, 118. See also kernel, log /etc/resolv.conf, 245 dmsetup, 109. See also device mapper /etc/services, 249–250 DNS (Domain Name Service), 235, /etc/shadow, 177, 179, 197 /etc/shells, 179, 193–195 243–246 /etc/sudoers, 45 dnsmasq, 245 eth0, 236 Docker, 406–414 Ethernet, 235–236, 264–265 documentation, 26–28 Domain Name Service. See DNS bridge, 236 dot file, 22, 336 wireless, 266–268 DPMS (Display Power Management euid. See effective user ID exec, 311 Signaling), 359 exec(), 7, 203, 311 du, 90–91 executable, 36–37, 42–43, 87, 292, dual-stack network, 233 Dynamic Host Configuration Protocol 365–367, 380 exit, 298 (DHCP), 252–253 exit code, 298 export, 23 E expr, 311 ext4. See filesystem, ext2/ext3/ext4 echo, 13, 16 EDITOR, 344 F effective user ID, 189–190 EFI. See UEFI fail2ban, 276–277 efilinux, 123 fdisk, 72–73, 75–78 egrep, 19 fg, 34–35 elapsed time, 207 FHS (Filesystem Hierarchy Standard), Emacs, 26 emulator, 402 42 encryption, 197–198, 273–274 file env, 292, 380 environment variable, 22–23, 311 compare with another file, 21 EOF (end-of-file) message, 14 compress, 39–41, 321–322 error message, 29–30, 204 copy, 15 (see also file transfer) ESP (EFI System Partition). See UEFI, create empty, 16 delete, 16, 113–114 ESP descriptor (see file descriptor) /etc, 42, 141, 167, 176–177 details, 15 /etc/fstab, 52, 85, 88–89 device (see device, file) /etc/group, 180 dot (see dot file) /etc/hosts, 244 errors, 30–31 /etc/init.d, 159 find, 21 /etc/inittab, 157–158 find text in, 19–20 /etc/ld.so.cache, 369 format, 21 /etc/ld.so.conf, 369 group, 15, 35–37 /etc/localtime, 182 426   Index

link, 38, 111–114, 303 overlay, 94, 410–411 link count, 113–114 proc (see /proc) listing, 15 read-only, 86, 121 mode, 35–37 (see also permissions) remount, 87–88 move, 16 repairing, 91–93 open, 200–202 resizing, 97, 107 owner, 15, 35–37 squashfs, 94 permissions (see permissions) tmpfs, 93–94 redirect command input from, 29 types, 81–82 redirect command output to, 28–29 usage, 89–91 regular, 35 user space, 81, 115, 333–334 rename, 15 UUID (universally unique sharing across a network, 323–334 sharing with other users, 9 identifier), 85, 88, 96, socket (see device, socket) 120–121, 124–126 swap, 97 XFS, 81 temporary, 43, 307 Filesystem Hierarchy Standard (FHS), 42 test, 301–303 find, 21, 310 type, 35, 38, 48, 201 finding appropriate command, 26–27 update timestamp, 16 firewall, 259–264 file (command), 21 rule, 261–262 file descriptor, 201, 203–204 strategy, 262–264 file transfer, 315–316 flex, 379 choosing method, 316 folder. See directory rsync (see rsync) for, 305 SSH (secure shell), 278 fork(), 7, 147–148, 203, 205, 272 with Python, 316 frame (Ethernet), 236 filesystem, 70–71, 80 free, 96 boot loader access (see boot loader, fsadm, 107 fsck, 88, 91–93 filesystem access) fsuid, 190 Btrfs, 81–82 FTP, 278, 287 capacity, 89–91 FUSE (File System in User Space). cgroup, 219 (see also cgroup) See filesystem, user space checking, 91–93 CIFS, 331 G creating, 82–83, 105 currently attached, 84 gateway, 227, 230–231 ext2/ext3/ext4, 81–85, 91–93 gcc, 364 FAT, 81 GECOS, 178 HFS+, 81 geteuid(), 191–192 hierarchy, 42–44 getty, 54, 143, 158, 181 internal structure, 82, 111–115 Ghostscript, 361–362 ISO 9660, 81 glob, 18–19, 22, 293–294. See also journal, 81, 91–93 mount, 83–89, 140 regular expression mounting, 105 global unicast address, 232–233 mount options, 86–87 GNOME, 350 NFS (Network File System), 332–333 gnome–shell, 351–352 GNU Autotools, 386, 399. See also autoconf Index   427

gparted, 72 include file. See header file GPT (Globally Unique Identifier inetd, 279 info (GNU), 28 Partition Table), 72–73, 126 init, 118–120, 138–139. See also systemd grep, 19–20, 300 group, 10, 178, 180 container, 413–414 identifying, 139 listing, 36 process tracking, 158 (see also permissions (see permissions, group) groups, 36 systemd, process tracking) GRUB, 123–135 runlevel (see runlevel) boot command, 127 System V, 139, 156–161 command line, 126–127 System V sequence, 158–159 configuration, 124–125, 127–129 Upstart, 139 devices, 124–126 initramfs, 124–125, 135, 163–164 filesystem access, 126–127 initrd, 164. See also initramfs insmod, 124–125 inode, 91–92, 111–115, 303 installing, 130–131 root, 112–113 internals, 134–135 installing software, 385–386, 394–395 menu, 123–125, 128–129 interactive shell, 340–342 on removable media, 131 interface ID (IPv6), 232 root, 124–128 internet layer. See network, internet layer grub-mkconfig, 127–129 iostat, 214–215 GTK+, 350 iotop, 216–217 guest (operating system), 403 ip (command), 228–230, 232–233, gunzip, 39–41 gzip, 39–41 237–238, 264–265 IP (internet protocol), 226 H address, 227–228, 237–238 halt, 162–163 chain, 259–260 hard link. See file, link filter, 259–262 hardware operation, 4 forwarding, 255 head, 21 masquerading, 256 header file, 44, 371–372, 391, 393–394 subnet (see subnet) table, 259–260 locating, 398 IPP (Internet Print Protocol), 361 help, 26–28 iptables, 261–264 here document, 308 IPv4, 226, 231. See also IP /home, 42 IPv6, 226–227, 231–233, 235, 238, 247, home directory, 17, 42, 178 host, 224, 235 253–254, 266 host key, 274–276 iw, 267 HTTP, 270–272 hypervisor, 402–403 J I jar, 382 Java, 382, 404 I/O monitoring, 214–216 job control, 34–35 ICMP, 234–235, 254 jobs, 34 if/then/else, 299–300 journalctl, 46, 51, 118–119, 145, ifconfig, 228. See also ip image, 4. See also container, image 169–172, 175, 186–187 journald, 154, 156, 168–169, 173, 175, 186 –187 428   Index

K libata, 64–66 libinput, 352–353 KDE, 350 library, 42 Kerberos, 333–334 kernel, 2–5 C, 366 linking against, 366–367, 370, 377, as a resource, 199 boot, 117, 119–123 390–391, 393–394 boot messages, 118–119 shared (see shared library) compiling, 399 static, 367–368 disk buffer and cache (see disk, Lightweight Directory Access Protocol buffer and cache) (LDAP), 178 disk I/O system, 71, 111 LILO, 123 image location, 44, 125 link load, 117, 121–122 log, 51, 61, 172 count (see file, link count) mode, 3 farm, 159 modules, 44 hard (see file, link) network interface (see network, symbolic (see symbolic link) link-local address, 232–233, 254 interface) listening (on network port), 248–249, parameters, 120–122, 124–125 reading partition table (see 279–280, 288–289 literal, 293–295 partition, reading table) LLMNR (Link-Local Multicast Name ring buffer, 118–119 routing table, 230 Resolution), 245 SCSI subsystem, 62–67 LLVM project, 364, 383 space, 3 ln, 38–39, 111, 113, 115. See also link, thread, 4 keyboard, 357–359 hard; link, symbolic kill, 33–34 lo, 247 Kubernetes, 415 loadable kernel modules. See kernel, L modules load average, 208–210 LAN (local area network), 224 LOADLIN, 123 lastlog, 169 local area network (LAN), 224 layer, 2 localhost, 242, 247 locate, 21 network (see network, layer) log, 9, 167–168. See also kernel, log; LBA (Logical Block Addressing), 79, journald; journalctl 122 autoconf, 392–393 LDAP (Lightweight Directory Access facility/severity/priority, 174–175 message, 168 Protocol), 178 monitoring, 172 ldconfig, 369 Samba, 328 LD_LIBRARY_PATH, 344, 369–371 structured data, 175 ld.so, 369–370 sudo, 46 ldd, 368–369 systemd unit (see systemd, unit log) less, 20, 341–344 logger, 186 level, 2 logical volume. See LVM Logical Volume Manager (LVM). See in user space, 8–9 Lex, 379 LVM /lib, 42 login, 181 Index   429

loginctl, 188 separator, 375 login shell, 340–342 standard target, 378, 392 logrotate, 172–173 staying up-to-date, 375–376 loop. See shell script, loop target, 374 lost+found, 92, 114 man, 26–28 ls, 15 manual page, 26–28, 44, 338. See also lsof, 200–202 man network, 280–281 MBR (Master Boot Record), 72–73, 126 Unix domain socket, 290 lsscsi, 52, 63, 66 boot, 130–131, 133 lsusb, 65 mDNS, 245 ltrace, 204 /media, 43 LV (logical volume). See LVM, logical memory, 3–4 volume capacity, 94–96, 209–210 LVM (Logical Volume Manager), insufficient, 94–96, 209–210 management, 6, 119, 210–214 52–53, 96–110 monitoring usage, 212–214 advantages, 96–97 page (see page) constructing system, 102–105 problems, 31–32 creating filesystem, 105 protection, 3 device names, 100 swap (see swap) devices, 73–74 test, 129 implementation, 107–110 virtual (see virtual memory) listing, 97–100 mkdir, 17 logical volume, 96–100 mkfs, 82–83 logical volume, arrangement, mknod, 56 mkswap, 96–97 109–110 MMU (memory management unit), 6, logical volume, creating, 104–105 logical volume, removing, 106–107 210–211 physical extent, 99 modules. See kernel, modules physical volume, 96–99, 101–103 mount, 83–89. See also filesystem, mount physical volume, creating, 103 mouse, 358 physical volume, metadata, 101, multitasking, 5–6 mv, 16 108 resizing, 106–107, 110 N scanning volumes, 108 schematic, 96–97 namespace. See network, namespace; volume group, 96–99, 101–103 process, namespace volume group, creating, 103 LXC, 414–415 nano, 26, 344 NAT (Network Address Translation), M 255–258 MAC address, 235–237, 243, 264–265 NDP (Neighbor Discovery Protocol), main memory. See memory make, 373–379 266 Makefile netcat, 282–283 Netplan, 239 dependency, 373–375, 377, 379 netstat, 248–249, 279 organization, 378–379 network, 223–224 rule, 374, 377 application layer, 225, 269–272 client, 248–249 430   Index

configuration, 237–243, 252–254 nobody (user), 178 (see also network configuration nslookup, 245 manager) NTP (Network Time Protocol), connection, 248–249, 270–271, 281 182–183, 251 container (see container, NVMe (Non-Volatile Memory Express), networking) 53, 63 firewall (see firewall) host (see host) O interface, 49, 236–238, 411–412 internet layer, 225–235 (see also IP) object file, 365–366 layer, 223, 225–227 OOM killer, 96 localhost (see localhost) open(), 203–204 namespace, 411–412 open source, 385–386 packet (see packet) OpenWRT, 258 physical layer, 226, 235–236 operating system–level virtualization, port, 248–250, 270 prefix, 228 406 private (see private network) /opt, 43 promiscuous mode, 281 OSS (Open Sound System), 55–56 route, 230–231 router (see router) P security, 285–287 server, 248–249, 272 package, 390, 394–395, 399–400 simple, 224, 227, 252 packet, 224–225 stack, 225 page, 210–213 transport layer, 225–226, 247 page fault, 211–212 troubleshooting, 234–235, PAGER, 344 pager, 20, 344 279–284 page table, 6, 210 wireless (see wireless network) PAM (Pluggable Authentication Network Address Translation (NAT), Modules), 192–198 255–258 parallel port, 55 network configuration manager, paravirtualization, 403 parted, 72–73, 75–76 240–243 partition, 52, 57, 70, 82 Network Information Service (NIS), alignment, 79–80 178 altering table, 75–76 network layer, 225–226. See also Apple (see filesystem, HFS+) capacity, 72–74 (see also filesystem, network, internet layer NetworkManager, 240–243, 267–268 capacity) network mask. See subnet, mask creating table, 76–78 Network Time Protocol (NTP), extended, 72–73 logical, 72–73 182–183, 251 primary, 72–73 NFS (Network File System). See reading table, 74–76 swap, 72–73, 96 (see also swap) filesystem, NFS system ID, 72–74 nftables, 259 table, 70–79 nice value, 208 viewing, 72–75 NIS (Network Information Service), Windows (see filesystem, FAT) passwd, 22, 35–36, 179 178 nmap, 284 Index   431

password PostScript, 360–362 change, 22 predictable network interface device file (see /etc/passwd) name, 236 password change, 197–198 printing, 55, 360–362 password file. See /etc/passwd private network, 255–257 patch, 395–396 /proc, 42, 88, 93 patchelf, 370 /proc/devices, 51 PATH. See path, command process, 3–4, 32–35, 93 path accounting, 222 absolute, 17 background, 34–35 command, 23–24, 337–338 blocked, 213 relative, 17 child, 204, 413–414 pathname. See path continue, 33–35 pattern matching, 18–20 grouping (see cgroup) PE. See LVM, physical extent ID, 32–34, 201, 205–206, 220, 298 performance, 199–200, 210 interface, 42 memory, 95–96 listing, 32–33 Perl, 20, 381 log messages, 169 permissions, 31, 35–37 management, 5–6 bits, 35–37 memory, 6, 96, 200, 210–212 changing, 36–37 monitoring, 216 default, 37, 339–340 namespace, 410 directory, 37 open files, 200–202 execute, 35–37 owner, 9, 189–190 group, 35–37 parent, 413–414 other, 35–37 priority, 207–208 preserving, 40 ready to run, 208–210 read, 35–37 starting new, 7 testing, 302–303 status, 32 user, 35–37 stop, 33–35 world (see permissions, other) terminate, 33–34 write, 35–37 tracking, 200 physical layer. See network, physical layer unexpected termination, 96 physical volume (PV). See LVM, .profile, 340 prompt. See shell, prompt physical volume ps, 32–33, 190, 212 Pico, 26 pseudodevice, 8 PID. See process, ID pseudoterminal, 54 pidstat, 216 pseudo-user, 178–179 ping, 234–235 public key encryption, 274 pipe, 20, 28–29, 41 pulseaudio, 56 PV (physical volume). See LVM, physical named, 49, 56 pkg–config, 393–394 volume Pluggable Authentication Modules pwd, 20 Python, 292, 380–381, 417–418 (PAM), 192–198 plymouth, 54 Q Podman, 406–407, 411 port. See network, port Qt, 350 port scan, 284 432   Index

R saved user ID, 190 /sbin, 43 read, 312 scheduling class, 215 real-time clock, 181 scheduling tasks, 183–188 real user ID, 189–190 SCons, 399 reboot, 162–163 scp, 278 redraw display, 35 screen, 34 regular expression, 19–20 scripting language, 380–382 regular file. See file, regular SCSI (Small Computer System remote login, 273–278 renice, 208 Interface), 52–53, 62–67 rescue image or CD, 164–165 disk (see disk, SCSI) resolvectl, 246 generic, 53, 66–67 resolved. See system-resolved ID, 62–63 resource listing device information, 52, 63, limiting, 216–222, 406 66 utilization, 207, 216, 221 sector, 79 resource monitoring, 206 secure shell. See SSH reverse isearch, 35 security, 191–198 RIP (Raster Image Processor), 361–362 rm, 16 application, 405 rmdir, 17–18 in command path, 338 root, 9, 178–179. See also directory, root file sharing, 323–324, 331–334 running programs as, 44–46 network (see network, security) root directory. See directory, root sed, 309–310 route, 230. See also network, route segmentation fault, 31–32 router, 224, 227, 233, 254–259 serial port, 55 RPC (remote procedure call), 284–285 server role, 8–9 rsync, 317 setuid, 36, 87, 189–191 bandwidth, 322 sftp, 278 compression, 321–322 shadow password. See /etc/shadow copying from remote host, 322 shared library, 42, 367–371, 390–391 copying to remote host, 317–322 system calls, 203 exact copy, 318–319 trace, 204 excluding files, 320 shebang, 292, 380 verifying transfer, 321 shell, 12–14. See also Bourne Shell rsyslogd, 169, 175 change, 12, 22 ruid. See real user ID default, 343–344 /run, 43 editing commands, 25 runlevel, 156–157 process ID, 33, 298 run-parts, 160–161 prompt, 12–13, 22, 338–339 runtime-based virtualization, 417–418 quoting, 293–295 runtime information, 43 special variable, 295–298 runtime library search path, 369, 394 user, 178–179 variable, 22–23, 33, 295 S window, 13, 35, 54 shell script, 12, 291–292 Samba, 324–330 arguments, 296–297 client, 329–330 arithmetic, 303–304, 311, 313 conditional, 299–304 sar, 222 Index   433

shell script (continued) stat() system call, 115 include, 312 state, 4 limitations, 292–293, 312–313 stateless (network) configuration, loop, 305–306 name, 297 253–254 permission, 292 static library. See library, static reading user input, 312 stderr. See standard error string test, 303 stdin. See standard input stdio. See standard I/O shift, 296 stdout. See standard output shortcut. See symbolic link strace, 202–205 shutdown, 159, 162–163 stream, 14, 20, 28–29, 49 signal, 33–34 edit (see sed) in shell script, 307 ID (in shell), 29 single-user mode, 121, 156, 164–165 search (see grep) Small Computer System Interface. See subnet, 227–229, 236 choosing, 255–256 SCSI mask, 228–230, 238 socket, 288–290 routing between, 254–256 subshell, 311–312 device (see device, socket) sudo, 13, 45–46, 190 Unix domain (see Unix domain superblock, 82, 92, 114 superserver, 279 socket) superuser. See root socket unit. See systemd, socket unit swap, 88, 94–96, 212–214 sort, 22 partition (see partition, swap) sound, 55–56 swapoff, 95 source code, 364 swapon, 94–95 sourcing, 312 symbolic link, 38–39, 302 special characters, 24–25 sync, 86 splash screen, 54, 118, 120 /sys, 43, 49–50. See also sysfs SSD (solid-state disk). See disk, solid syscall. See system call sysctl, 255 state sysfs, 49–50, 58, 93 SSH (secure shell), 272–278 SYSLINUX, 123 syslog, 168–169, 174–176 systemd unit, 142–143 system call, 4, 7 SSHFS, 331–332 trace, 202–205 SSID, 266 system clock, 181–183 standard error, 29, 35 systemctl, 142, 144–147, 149 standard I/O, 14 systemd, 118, 139–140 activating unit, 146 redirection, 28–29 conditional dependencies, 150 standard input, 14, 20, 29, 35, 39, 51 configuration, 141–143 standard output, 14, 20, 28–29, 35, 39, Conflicts dependency, 149 creating (adding) unit, 146–147 51 deactivating unit, 147 startup. See boot dependency, 140–141, 147–155 startup file, 335–336 enabling unit, 147, 150–151 bash, 340–342 command path, 337–338 example, 341–343 order, 340–342 problems, 344 tcsh, 342–343 stat command, 113–114 434   Index

instance, 154 telnet, 270, 273, 287 job, 145–146 tempfs. See filesystem, tmpfs mount unit, 89, 140, 144 temporary file. See file, temporary on-demand resource, 151–154 terminal, 53–54. See also shell, window operation, 144–147 parallel unit activation, 154–156 controlling (see controlling process tracking, 143, 147–148 terminal) reload unit configuration, 145 Requires dependency, 148–151 device (see device, terminal) Requisite dependency, 149 virtual (see virtual console) service unit, 140, 142–143, 186 test, 299–304 socket unit, 140, 142, 152–154, 279 text editor, 25–26, 344 specifier, 143, 153–154 text search, 19–20 System V compatibility, 161 thrash, 209–211. See also memory, target unit, 140, 146–147, 150–151 timer unit, 185–188 insufficient unit, 140–148 thread, 204–206 unit cgroup, 144 time, 207, 211–212. See also CPU, time; unit file, 142–143, 146–147, system time; elapsed time 150–151, 185–186 time (of day), 181–183 unit listing, 144–145 timer unit. See systemd, timer unit unit log, 144–145 time slice, 5 unit startup order, 140–141, timesyncd, 182–183 time zone, 182 148–149 TLS (Transport Layer Security), 226, unit status, 144, 146 variable, 143 287 Wants dependency, 146, 148–151 /tmp, 43 systemd- (prefix), 156 toolkit, 350 systemd–analyze, 140–141, 149 top, 200, 205–208 systemd-boot, 123 touch, 16 systemd-resolved, 156, 245 Transmission Control Protocol. See systemd-run, 188 system time, 207 TCP System V init. See init, System V transport layer. See network, application system virtual machine, 402 layer T Transport Layer Security. See TLS troubleshooting, 168 tail, 21 tune2fs, 85 TAP interface, 412 tar, 39–41, 312 U TCP (Transmission Control Protocol), udev, 48, 51–52, 56–62, 109 247–251, 279–281 configuration and rules, 58–60 filtering, 262–264 event (see uevent) interacting with service, 270–272 wrapper, 279 udevadm, 50–51, 60–61, 76 tcpdump, 281–283 udevd, 56–62, 85, 156, 163 tcsh, 342–343 udisksd, 62 telinit, 161 UDP (User Datagram Protocol), 250–251, 279–281 UEFI (Unified Extensible Firmware Interface), 121–122, 130–132 ESP (EFI System Partition), 133–135 secure boot, 131–132 Index   435

uevent, 58, 61 organization, 8–9 umask, 37, 339–340 start, 117–118, 120, 137–139 umount, 84 Unified Extensible Firmware Interface. (see also init) /usr, 43–44 See UEFI /usr/lib, 367 Universal Coordinated Time (UTC), /usr/local, 44, 390, 395 /usr/share, 44 181–183 UTC (Universal Coordinated Time), Universally Unique Identifier (UUID), 181–183 52 UUID (Universally Unique Identifier), Unix, 11–12 Unix domain socket, 289–290 52 unlink, 114. See also file, delete filesystem (see also filesystem, unxz, 41 unzip, 41 UUID) uplink, 224. See also default gateway Upstart, 139 V uptime, 209 USB /var, 43 /var/log, 169 listing device information, 65 VFS (Virtual File System), 81, 115 relationship to SCSI, 52, 64–65 vi, 26 serial port, 55 vipw, 179 user, 9 virtual, 401 change, 44–46 VirtualBox, 402–403 id (see user ID) virtual console, 54–55, 158, 355 management, 177–180 virtual disk. See disk, virtual name (see username) virtual interface (network), 411–412 regular, 12 virtual machine, 53, 382, 402–405 root (see root) virtual memory, 6, 96, 401. See also user authentication, 192–198. See also memory, management PAM; /etc/passwd vmstat, 212–214 user authorization, 193. See also PAM volume group. See LVM, volume group User Datagram Protocol (UDP), W 250–251, 279–281 user environment, 335–336 wait(), 413 user ID, 9, 177–179, 189–190 wallpaper. See desktop background user identification, 191–192 warning messages, 30 userland. See user space Wayland, 349–350 user mode, 3 username, 9, 177–179 compositor, 349–352 user process. See process input, 352–353 user space, 3 window manager, 349 X compatibility, 353–354 and filesystems, 111 web server, 316 and LVM, 107 WEP (Wired Equivalent Privacy), 268 and user IDs, 179, 191–192 Weston, 351–352, 354 creating filesystems in, 82 while, 305–306 filesystem (see filesystem, user who, 156 widget, 350 space) WiFi Protected Access (WPA), 268 436   Index

wildcard. See glob xlsclients, 356 windowing system (determining), 351 xset, 359 window manager, 349–350 X Window System Windows application, 350 boot, 132 client, 348–349, 355–356 file sharing, 324–330 diagnostics, 356–357 partition (see filesystem, FAT) display, 354 password, 326–327 event, 356–357 printer sharing, 329 input, 357–359 Wired Equivalent Privacy (WEP), 268 network transparency, 355 wireless network, 240–241. See also preferences, 357–359 server, 54, 348–349, 354–355 Ethernet, wireless tunneling, 273, 355 wlan0, 236, 267 Wayland compatibility, 354 worker process, 272 window manager (see window WPA (WiFi Protected Access), 268 wtmp, 169 manager) xwininfo, 356 X xz, 41 xargs, 310 Y XDG Desktop Entry, 142 Xen, 403 Yacc, 379 xev, 356–357 X event. See X Window System, event Z xinetd, 279 xinput, 357–358 zcat, 41 XKB (X keyboard extension), 358–359 zip, 41 Index   437

How Linux Works, 3rd edition, is set in New Baskerville, Futura, Dogma, and TheSansMono Condensed. The book was printed and bound by Sheridan Books, Inc. in Chelsea, Michigan. The paper is 60# Finch Offset, which is certified by the Forest Stewardship Council (FSC). The book uses a layflat binding, in which the pages are bound together with a cold-set, flexible glue and the first and last pages of the resulting book block are attached to the cover. The cover is not actually glued to the book’s spine, and when open, the book lies flat and the spine doesn’t crack.

RESOURCES Visit https://nostarch.com/howlinuxworks3/ for errata and more information. More no-nonsense books from NO STARCH PRESS THE LINUX COMMAND LINE, THE LINUX PROGRAMMING YOUR LINUX TOOLBOX 2ND EDITION INTERFACE by julia evans A Complete Introduction A Linux and Unix System $29.95 Programming Handbook isbn 978-1-59327-977-6 by william shotts 504 pp., $39.95 by michael kerrisk isbn 978-1-59327-952-3 1552 pp., $99.95 isbn 978-1-59327-220-3 THE SECRET LIFE OF ALGORITHMIC THINKING KILL IT WITH FIRE PROGRAMS A Problem-Based Introduction Manage Aging Computer Systems Understand Computers— (And Future Proof Modern Ones) Craft Better Code by daniel zingaro 408 pp., $49.95 by marianne bellotti by jonathan e. steinhart isbn ISBN 978-1-7185-0080-8 248 pp., $19.99 504 pp., $44.95 isbn 978-1-7185-0118-8 isbn 978-1-59327-970-7 phone: email: 800.420.7240 or [email protected] 415.863.9900 web: www.nostarch.com

Never before has the world relied so heavily on the Internet to stay connected and informed. That makes the Electronic Frontier Foundation’s mission—to ensure that technology supports freedom, justice, and innovation for all people— more urgent than ever. For over 30 years, EFF has fought for tech users through activism, in the courts, and by developing software to over- come obstacles to your privacy, security, and free expression. This dedication empowers all of us through darkness. With your help we can navigate toward a brighter digital future. LEARN MORE AND JOIN EFF AT EFF.ORG NO STARCH PRESS

COVERS LINUX SYSTEMD-BASED F O R T H E SUPERUSER INSTALLATIONS Unlike some operating systems, Linux doesn’t try to hide NEW TO THIS EDITION the important parts from you—it gives you full control of your computer. But to truly master Linux, you need to • Hands-on coverage of the LVM, journald understand its internals, like how the system boots, how logging system, and IPv6 networking works, and what the kernel actually does. • Additional chapter on virtualization, featuring In this third edition of the bestselling How Linux Works, containers and cgroups author Brian Ward peels back the layers of this well-loved operating system to make Linux internals • Expanded discussion of systemd accessible. This edition has been thoroughly updated and expanded with added coverage of the Logical You’ll also explore the kernel and examine key Volume Manager (LVM), virtualization, and containers. user-space processes, including system calls, input and output, and filesystem maintenance. With its You’ll learn: combination of background, theory, real-world examples, and thorough explanations, How Linux • How Linux boots, from boot loaders to init (systemd) Works will teach you what you need to know to take control of your operating system. • How the kernel manages devices, device drivers, and processes ABOUT THE AUTHOR Brian Ward has been working with Linux since 1993. • How networking, interfaces, firewalls, and servers He is the author of The Linux Kernel HOWTO, as well work as The Book of VMware and The Linux Problem Solver (both No Starch Press). • How development tools work and relate to shared libraries • How to write effective shell scripts THE FINEST IN GEEK ENTERTAINMENT™ 3RD EDITION www.nostarch.com $49.99 ($65.99 CDN)


Like this book? You can publish your book online for free in a few minutes!
Create your own flipbook