symbols b - no starch pressas a resource, 171 boot, 93, 95–96 boot messages, 94–95 compiling,...
TRANSCRIPT
Symbols<, 28<<, 265>, 27–28>>, 27–28[, 256–261$, xxi, 12–13, 22, 290$#, 254$$, 255$0, 255$1, 254$?, 255–256. See also exit code$@, 254–255#, xxi, 13. See also root#!, 249–250, 325|, 19, 27, 39/, 40, 93, 95–97, 99–100*, 17–18, 21, 251–252. See also regular
expressions
Aabstraction, 1–2administrator. See rootalias, 290–291ALSA, 53Apache, 346Apple partition, 73application layer, 191, 229–232archive, 37–39
table of contents, 38testing, 38, 330–331
ARP, 225–226at, 161ATA, 62autoconf, 332–336autotools, GNU, 330, 342. See also
autoconfAvahi, 208, 239awk, 266
Bbasename, 265–266bash, 12. See also Bourne Shell
startup file, 292–295bg, 32/bin, 40/bin/bash. See bash/bin/sh. See Bourne ShellBIOS, 97
boot partition, 108bison, 325blkid, 76block bitmap, 90blockdev, 70block device, 46–48, 53, 61, 63,
65–67, 70/boot, 41, 102–103boot, 93–94. See also init
loader, 93, 97–98chainloading, 106–107filesystem access, 97, 101–102GRUB, 102internals, 107–109multi-stage, 107for systems other than Linux,
106–107messages, 94–95network configuration, 202–203
Bourne Shell, 12basic use, 12–13Bourne-again, 12script (see shell script)
building software, 330–333, 340–342bunzip2, 39bus error, 30BusyBox, 349bzip2, 39
Index
356 Index
CC, 310–311
compiler, 320–321, 340–341preprocessor, 312–313, 321, 335,
341–342case, 262cat, 13cd, 16–17chainloading, 106–107character device, 46–47, 53child process, 175Chrome OS, 308chsh, 12, 21, 166–168chvt, 52, 300CIDR, 195clang, 310CLASSPATH, 327clobber, 27cloud computing, 348CMake, 331, 342command-line editing, 24command substitution, 263–264compiling, 310–311compositing window manager, 305compressing files, 37–39, 277concatenating files, 13configuration file, 40, 149–150configure, 332–336context switch, 5–6control group, 123controlling terminal, 51coreboot, 98coreutils, 332–333, 338cp, 15cpio, 146cpp, 312–313, 321, 335, 341–342CPU, 2–4
multiple, 6, 176time, 171–172, 178–181, 183–185
CPU time, 32cron, 159–161csh, 294
ctrl-C, 14
ctrl-D, 13–14CUPS, 307–308curl, 230–232current working directory, 16, 19–20,
172–173cylinder, 71–72
Ddaemon, 149database, 346–347date, 157–158D-Bus (Desktop Bus), 58, 124–125,
203, 299, 305–307instance, 306monitoring, 306–307
dd, 48–49, 83debugfs, 84debugger, 323–324default gateway, 196, 201demand paging, 182desktop, 297–298
background, 304environment, 299
Desktop Bus. See D–Bus/dev, 40, 46–48device, 45
audio, 53block, 46–48, 53, 61, 63, 65–67, 70character, 46–47, 53copy, 48–49creating file, 53–54disk, 46–48driver, 4, 7, 93file, 40, 46–47, 53–57, 80finding, 48–49information, 47–48, 57–58initialization, 53–58major and minor numbers, 47–49monitor, 57–58name, 47–53network, 47node, 40, 46–47, 53–57, 80optical, 51, 63–64, 73parallel, 52pipe, 47, 53SCSI (see SCSI)serial, 52socket, 47, 247–248terminal, 51–52types, 46–47
/dev/hd*, 51/dev/lp*, 52/dev/null, 46/dev/parport*, 52/dev/pts, 51/dev/sd*, 50–51
Index 357
/dev/sg*, 51, 63–64/dev/snd, 53/dev/sr*, 51, 63–64devtmpfs, 53–55/dev/tty*, 51–52/dev/zero, 48–49df, 81DHCP, 214–215diff, 20, 256, 339directory, 16, 33
change, 16–17create, 17current, 16, 19–20, 172–173errors, 30hierarchy, 16, 40–42home, 17, 40, 154–155internal structure, 88listing contents, 14–15parent, 16, 88–90permissions, 35remove, 17root, 40, 93, 95–97, 99–100
diskaddressing, 71–72buffer, 77cache, 77capacity, 69copy, 48–49device, 50–51, 65–68device file, 46–48format, 68, 74–75geometry, 70–72monitoring usage, 183–187partition (see partition)PATA, 51quota, 188raw access, 48–49, 67SATA, 50–51, 56, 62scheduling priority, 187schematic, 65–66SCSI, 50–51, 59–62solid-state, 72, 91swap 80, 85–86usage, 81
display, 300manager, 300modes, 51–52
dmesg, 49, 94–95, 153. See also kernel: log
DNS (Domain Name Service), 198–199, 206–209
documentation, 25–27Domain Name Service (DNS),
198–199, 206–209dot file, 21, 287DPMS, 305du, 81
Ee2fsck. 80, 82–84echo, 13, 16EDITOR, 295–296effective user ID (euid), 162–165EFI, 97–98, 105–108
ESP, 108–109secure boot, 106
efilinux, 98egrep, 18elapsed time, 178–179Emacs, 24–25embedded system, 348–349encryption, 170, 233–234environment variable, 21–22,
268–269error message, 27–30, 175ESP, 108–109. See also EFI/etc, 40, 149–150/etc/fstab, 50, 77, 79–81/etc/hosts, 207/etc/init.d, 142/etc/inittab, 139–141/etc/ld.so.cache, 316/etc/ld.so.conf, 316/etc/localtime, 158/etc/login.defs, 170/etc/mtab, 78/etc/nologin, 144/etc/nsswitch.conf, 207–209, 346/etc/passwd, 26, 153–155, 164–165, 346/etc/profile, 292/etc/rc.d, 140–142/etc/resolv.conf, 207/etc/services, 211/etc/shadow, 154–155/etc/shells, 155, 166–168Ethernet, 199–200, 225–226
wireless, 226–228euid (effective user ID), 162–165
358 Index
exec(), 7, 174, 268executable, 34–35, 40–41, 78,
310–311, 325exit code, 255–257export, 22
Ffdisk, 68–70fg, 32–33files, 20
comparing with another file, 20compressing, 37–39, 277copying, 15creating empty, 15deleting, 16, 89descriptor, 172–173details, 14–15device, 40, 46–47, 53–57, 80dot, 21, 287errors, 29–30find, 20find text in, 18–19format, 20group, 14–15, 33–34identify, 259–260link, 36, 87–90, 260link count, 89–90listing, 14–15mode, 33–35move, 15open, 172–174owner, 14–15, 33–34permissions (see permissions)redirecting
command input from, 28command output to, 27–28
regular, 33rename, 15sharing
across a network, 278–286with other users, 9–10
socket, 47, 247–248swap, 85temporary, 264–265test, 259–260transfering, 271
with Python, 271rsync, 272SSH, 236–237
type, 33, 35, 46, 173updating timestamp, 15
filesystem, 66–67, 72–73Btrfs, 74, 91capacity, 81check, 82–84CIFS, 285creating, 68, 74–75currently attached, 75–76ext2/ext3/ext4, 73–77, 82–84FAT, 73HFS+, 73hierarchy, 40–42internal structure, 74, 87–90ISO 9660, 73, 78journal, 73, 82–83mount, 75–80, 114, 130–131
options, 77–80NFS, 285–286proc, 40, 79–80, 84read-only, 78–79, 96remount, 79repair, 82–84tmpfs, 84type, 73–74usage, 81user space, 73
interface, 90–91UUID, 50, 76–77, 79, 96, 99–101
find, 20, 267–268finding command, 25firewall, 219–221
rule, 221–223strategy, 223–224
flex, 325for, 262fork(), 7, 123–124, 136–137, 174, 176,
232–233frame, 199free, 85fsck, 80, 82–84FTP, 237, 245
Ggateway, 192, 196gcc, 310gdb, 323–324gdisk, 68GECOS, 154
Index 359
geteuid(), 164–165getty, 52, 120, 135–136, 140, 157Ghostscript, 308glob, 17–18, 21, 251–252. See also
regular expressionGNU autotools, 330, 342. See also
autoconfgparted, 67–69GPT, 67–69, 101grep, 18–19, 256–257group, 10, 154, 156–157
listing, 34permissions, 33–35
groups, 34GRUB, 98
boot command, 102command line, 100–101configuration, 98–99, 102–104devices, 100–101filesystem access, 101–102insmod, 99–100install, 104–106internals, 108–109menu, 98–99, 103on removable media, 105–106root, 99–102
grub-mkconfig, 103–104GTK+, 299guest operating system, 347–348gunzip, 37–39gzip, 37–39
Hhalt, 144–145hard link, 36, 87–90, 260hardware operation, 4head, 21, 71–72header file, 41, 311–312, 335, 337
locating, 341–342help, 25–27here document, 265/home, 40home directory, 17, 40, 154–155host, 190, 198–199host key, 234–236HTTP, 230–232hypervisor, 348
IICMP, 197–198ifconfig, 193–194, 200–202if/then/else, 256–258image, 4include file, 311–313, 335, 336inetd, 237info, 26–27, 43init, 93–95, 112–113. See also systemd;
Upstartidentifying, 114process tracking, 112–113runlevel, 113
systemd, 129System V, 139–142Upstart, 138–139
sequence, 112, 141–143System V, 112–114, 129, 138–143
initctl, 132initramfs, 99–100, 109, 145–146initrd, 146. See also initramfsinode, 82, 87–90, 260
root, 88–90installing software, 329–330, 338interactive shell, 292–294Internet layer, network, 191–192. See
also IPiostat, 185–186iotop, 186–187IP, 192
address, 192–194, 200–202, 216–217
chain, 220–224filter, 219–220forwarding, 216subnet, 192–195
choosing, 216–217mask, 194–195, 201routing between, 215–216table, 220
IPP, 307–308iptables, 221–224IPv4, 192IPv6, 192
JJava, 327–328job control, 32jobs, 32
360 Index
Kkernel, 2–5
as a resource, 171boot, 93, 95–96boot messages, 94–95compiling, 343disk buffer, 77disk cache, 77disk I/O system, 66–67, 86load, 93, 97–98location, 42log, 58–59, 153modules, 42network interface, 47, 200–203parameters, 96–97, 99–100reading partition table, 69–70ring buffer, 94routing table, 196SCSI subsystem, 58–64
kernel mode, 3kernel space, 3keyboard, 302–304kill, 31–32
LLAN, 190layer, 2
network, 189–192LBA, 71–72, 97LDAP, 346ldconfig, 316ldd, 315–316LD_LIBRARY_PATH, 296, 316–317ld.so, 315–316less, 19, 293–294, 296, 336level, 2
in user space, 8–9Lex, 324–325/lib, 40libata, 60, 62library, 40, 336–337
linking against, 313–314, 316–317, 321
shared, 40, 314–317, 334–335, 337system calls, 174–175trace, 176
LILO, 98
linkcount, 89–90farm, 142hard, 36, 87–90, 260symbolic, 35–36
listen, 210–211, 239–240literal, 251–253LLVM, 310, 328ln, 35–36, 87, 89–90loadable kernel modules, 42load average, 180–181LOADLIN, 98localhost, 205, 209locate, 20log, 9. See also kernel, log; syslog
kernel, 58–59, 153syslog, 150–153system, 121Upstart, 134, 138
logger, 153login, 157login shell, 292–294logrotate, 153loops, 262–263lost+found, 83, 90ls, 14–15lsof, 172–174
network, 239Unix domain socket, 248
lsscsi, 50, 59, 63lsusb, 62ltrace, 176
MMAC address, 199–200, 205–206,
225–226main memory. See memorymake, 318–323Makefile
dependency, 318–319, 323organization, 322–323rule, 318–319separator, 319–320staying up-to-date, 320target, 318–319
standard 322, 336man, 25–26. See also manual pagemanual page, 25–27, 42, 290
Index 361
MBR, 67–69, 101boot, 107–108
mDNS, 208/media, 41memory, 3–4
capacity, 85–86, 181insufficient, 84, 86, 181management, 6, 95, 182–183monitoring usage, 183–185page, 182protection, 3swap, 80, 85–86
partitions, 68–69, 85test, 104virtual, 6, 85
Mir, 305mkdir, 17mkfs, 74–75mknod, 53–54mkswap, 85MMU, 6, 182modules, kernel, 42mount, 75–80. See also filesystem:
mountmouse, 303–304multitasking, 5–6mv, 15
NNAT, 216–218netcat, 241–242netstat, 210–211, 238network, 189–191
application layer, 191, 229–232client, 210configuration, 193–194,
200–203, 214 connection, 210–211, 230,
239–241firewall, 219–221
rule, 221–223strategy, 223–224
host, 190, 198–199interface, 47, 200–203Internet layer, 191–192layer, 189–192localhost, 205, 209packet, 190–191
physical layer, 191port, 210–211, 230prefix, 194private, 216–217promiscuous mode, 240route, 195–196, 198router, 190, 192–193, 196–197,
215–216, 218–21server, 210, 232–233simple, 190, 192–193, 214stack, 191transport layer, 191–192troubleshooting, 197–198,
239–242wireless, 202–204
network configuration manager, 203–206
NetworkManager, 203–206, 228Network Time Protocol (NTP),
158–159, 212NFS, 285–286nftables, 220nice value, 179–180nmap, 242–243NTP (Network Time Protocol),
158–159, 212
Oobject file, 311OOM killer, 86open(), 175open source, 329OpenWRT, 219, 349/opt, 41OSS, 53
Ppackage, 333–334, 338, 341–343packet, 190–191page, 182
fault, 182–183table, 6, 182
PAGER, 296pager, 19, 296PAM (Pluggable Authentication
Modules), 165–170parallel port, 52parted, 67–70
362 Index
partition, 50alignment, 72altering table, 67–70Apple, 73capacity, 69, 81extended, 68–69geometry, 70–72logical, 68–69primary, 68reading table, 69–70swap, 68–69, 85system ID, 69table, 66–70viewing, 68–69Windows, 73
passwd, 21, 34, 155–156password
changing, 21, 170file, 26, 153–155, 164–165, 346
patch, 339patchelf, 317path, 16PATH, 22–23, 288–290path
absolute, 16command, 22–23, 288–290relative, 16
pathname. See pathperformance, 171
memory, 86Perl, 19, 326permissions, 30, 33–35
bits, 34changing, 34–35default, 35, 291directory, 35execute, 34–35group, 33–35other, 33–35preserving, 38read, 33–35testing, 260user, 33–35world, 33–35write, 33–35
physical layer, 191, 199–200Pico, 25PID (process ID), 30–32, 177, 255pidstat, 187–188ping, 197–198
pipe, 19, 27, 39named, 47, 53
pkg-config, 336–338Pluggable Authentication Modules
(PAM), 165–170plymouth, 51–52port scan, 242–243printing, 52, 307–308private network, 216–217/proc, 40, 79–80, 84process, 2–4, 30–33, 84
accounting, 188background, 32–33blocked, 185child, 175continue, 32ID, 30–32, 177, 255interface, 40list, 30–31management, 5memory, 6, 86, 172monitoring, 187–188open files, 172–174owner, 9, 162–163priority, 179–180starting new, 7status, 31stop, 31–32terminate, 31–32tracking, 172unexpected termination, 86
.profile, 292prompt (shell), 12–13, 22, 290ps, 30–31, 162–163, 183pseudodevice, 8pseudoterminal, 51pulseaudio, 53pwd, 19–20Python, 325–326
QQt, 299
RRaspberry Pi, 349real-time clock, 157real user ID (ruid), 162–163reboot, 144–145redraw display, 33
Index 363
regular expressions, 19regular file, 33relational database, 347remote login, 233–237renice, 180replication, 347resource monitoring, 178reverse isearch, 33RIP, 308rm, 16rmdir, 17root, 9–10
directory, 40, 93, 95–97, 99–100prompt, 13running programs as, 42–43
route, 195, 201–202route (network), 195–196, 198
configuration, 200–201router, 190, 192–193, 196–197,
215–216, 218–219RPC, 243rsync, 271
bandwidth, 277compression, 277copying
from remote host, 277to remote host, 271–274
exact copy, 273–274excluding files, 275–276verifying transfer, 276–277
rsyslogd, 151–153ruid (real user ID), 162–163runlevel, 113
System V, 139–142systemd, 129Upstart, 138–139
run-parts, 143runtime
information, 41library search path, 316
SSamba, 278–285
client, 283–285sar, 188SATA, 59–60saved user ID, 163/sbin, 41scheduling tasks, 159–161
SCons, 342scp, 237screen, 32scripting language, 325–327SCSI, 50, 58–64
disk, 50–51, 59–62generic, 51, 63–64ID, 58–59listing device information, 50,
59, 63sector, 71–72security, 162–170
in command path, 289network, 243–245
sed, 266–267segmentation fault, 30serial port, 52
USB, 52server role, 8–9setuid, 34, 78, 162–163sftp, 237shadow password, 154–155shared library, 40, 314–317,
334–335, 337system calls, 174–175trace, 176
shebang, 249–250, 325shell, 12. See also Bourne Shell
change, 12, 21editing commands, 24prompt, 12–13, 22, 290quoting, 251–253user, 154–155variables, 21–22, 31, 253
special variables, 253–255window, 12, 32–33, 51
shell script, 12, 249–250arguments, 254–255arithmetic, 261, 268, 270conditional, 256–257include, 269limitations, 250, 270loops, 262–263name, 255permission, 250PID, 255reading user input, 269string test, 260–262
shortcut. See symbolic linkshutdown, 144–145
364 Index
signal, 31–32, 264–265single-user mode, 96, 113, 146–147socket, 246–247
device, 47, 247–248Unix domain, 247–248
solid-state disk (SSD), 72, 91sort, 21sound, 53source code, 310special characters, 23–24splash screen, 51–52, 94, 96SQL, 347SSD (solid-state disk), 72, 91SSH, 119, 136–137, 233–237standard error, 27–28, 33, 160standard I/O, 13–14
input, 14, 19, 28, 33, 37, 49output, 14, 19, 27–28, 33, 37,
49, 160redirection, 27–28
startup. See bootstartup file, 287–290
example, 293–295order, 291–295
stat, 89–90stat(), 90state, 4static library, 314stderr, 27–28, 33, 160stdin, 14, 19, 28, 33, 37, 49stdio, 13–14, 310–311
redirection, 27–28stdout, 14, 19, 27–28, 33, 37, 49, 160strace, 137, 174–175stream, 19, 27–28, 46–49
edit, 266–267ID (in shell), 28I/O, 13–14search, 18–19, 256–257
su, 42–43subnet, 192–195
choosing, 216–217mask, 194–195, 201routing between, 215–216
subshell, 268–269sudo, 43, 163superblock, 74, 83, 90superserver, 237superuser. See root
swap, 80, 85–86partitions, 68–69, 85
swapoff, 85swapon, 85symbolic link, 35–36sync, 77/sys. See sysfssyscall. See system callsysfs, 45, 47–48, 55, 84SYSLINUX, 98syslog, 150–153system call, 4, 7–8
trace, 174–175system clock, 157–159systemctl, 116, 118, 120–121systemd, 112–114
activating unit, 120, 123, 128configuration, 117–120creating unit, 122–123deactivating unit, 123dependency, 114–117disabling unit, 123enabling unit, 119–120, 123job, 121–122log, 121mount unit, 81, 114, 118on-demand resource, 124–129operating, 120–122parallel unit activation, 125–127process tracking, 123–124service unit, 114, 119, 127–129socket unit, 127–128, 237specifier, 120startup, 114System V compatibility, 129target unit, 114unit, 114–115
file, 118–120instance, 128
variable, 120system messaging, 151system time, 178–179System V init, 112–114, 129, 138–143
Ttail, 21tar, 37–39, 269
Index 365
TCP, 209–213, 218filtering, 222–224interacting with service, 230–232
tcpdump, 240–241TCP wrapper, 238tcsh, 292–295telnet, 230, 233, 241, 245tempfs, 84temporary file, 264–265terminal, 51–52. See also shell: window
controlling, 51device, 51–52virtual, 51–52, 113, 135–136, 300
test, 256–261text editor, 24–25, 295–296text search, 18–19thrash, 181. See also memory:
insufficientthread, 176–178time, 178–179. See also CPU time;
elapsed time; system timetime (of day), 157–159time slice, 5/tmp, 41toolkit, 299top, 172, 178–179touch, 15traceroute, 198transport layer, 209. See also network,
application layertroubleshooting, 151–153tune2fs, 77
Uudev, 45, 48–50, 53–58
configuration and rules, 55–56event, 55, 58
udevadm, 48–50, 57–58, 70udevd, 53–58, 77udisks-daemon, 58UDP, 209, 212, 218, 240UEFI, 97–98, 105–108
ESP, 108–109secure boot, 106
uevent, 55, 58umask, 35, 291umount, 76–77
Unix, 11Unix domain socket, 247–248unlinking, 89. See also files: deletingunxz, 39unzip, 39Upstart, 112–113, 130
configuration, 133–135event, 112, 130–131, 133–135, 137job, 130–133, 137–138log, 134, 138mounting filesystems, 130–131,
133–134operation, 137–138process tracking, 136–137runlevel, 138–139startup, 130–131System V compatibility, 138–139
uptime, 180USB, 61–62
listing device information, 62relationship to SCSI, 50, 60–62serial port, 52
user, 9–10authentication, 164–170authorization, 164changing, 42–43environment, 287–288ID, 9, 153–155, 162–164identification, 164–165management, 154–157mode, 3process (see process)regular, 12root (see root)
user space, 2–3filesystem, 73
interface, 90–91organization, 8–9start, 93, 95–96, 111–112
userland. See user spaceusername, 9, 153–155/usr, 41–42/usr/lib, 314/usr/local, 41, 334, 338/usr/share, 41UTC, 157–158UUID, 50, 76–77, 79, 96, 99–101
366 Index
V/var, 41/var/log, 151–153VFS, 73, 90vi, 24–25vipw, 155–156virtual console, 51–52, 113,
135–136, 300virtual machine, 327, 347–348virtual memory, 6, 85. See also
memory: managementvmstat, 183–185
Wwallpaper. See desktop backgroundwarning messages, 29Wayland, 305web application, 346web server, 271, 346WEP, 228while, 262–263who -r, 113widget, 299wildcard. See globwindow manager, 298–299Windows
boot, 106–107file sharing, 278–285partition, 73password, 280–281printer sharing, 283
wireless network, 202–204. See also Ethernet: wireless
worker process, 232–233WPA, 228
Xxargs, 267–268xev, 302X event, 301–302xinetd, 237xinput, 303–304XKB, 304xlsclients, 301xmodmap, 302, 304xset, 305X Window System
application, 299client, 298, 301diagnostics, 301–305display (see display)event, 301–302future, 305input, 302–304network transparency, 300–301preferences, 302–305server, 51, 298–300tunneling, 233–234, 301window manager, 298–299
xwininfo, 301xz, 39
YYacc, 324–325
Zzcat, 39zip, 39
How Linux Works, 2nd Edition is set in New Baskerville, TheSansMono Condensed, Futura, and Dogma. The book was printed and bound by Edwards Brothers Malloy in Ann Arbor, Michigan. The paper is 60# Husky Opaque, which is certified by the Sustainable Forestry Initiative (SFI).
The book uses a RepKover 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 with tape. The cover is not actually glued to the book’s spine, and when open, the book lies flat and the spine doesn’t crack.