Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (2 votes)
129 views

How Linux Works 3rd Edition Brian Ward 2024 scribd download

How

Uploaded by

tenmannaph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
129 views

How Linux Works 3rd Edition Brian Ward 2024 scribd download

How

Uploaded by

tenmannaph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

How Linux Works 3rd Edition Brian Ward

https://textbookfull.com/product/how-linux-works-3rd-
edition-brian-ward/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

How Linux Works. What Every Superuser Should Know 3rd


Edition Brian Ward

https://textbookfull.com/product/how-linux-works-what-every-superuser-
should-know-3rd-edition-brian-ward/

textboxfull.com

How Linux Works What Every Superuser Should Know 3rd


Edition Brian Ward

https://textbookfull.com/product/how-linux-works-what-every-superuser-
should-know-3rd-edition-brian-ward-2/

textboxfull.com

How Linux Works What Every Superuser Should Know Brian


Ward

https://textbookfull.com/product/how-linux-works-what-every-superuser-
should-know-brian-ward/

textboxfull.com

Biology How Life Works 3rd Edition James Morris

https://textbookfull.com/product/biology-how-life-works-3rd-edition-
james-morris/

textboxfull.com
Biology How Life Works 3rd Edition Macmillan Higher
Education

https://textbookfull.com/product/biology-how-life-works-3rd-edition-
macmillan-higher-education/

textboxfull.com

Environmental Hydrology 3rd Edition Andy D. Ward

https://textbookfull.com/product/environmental-hydrology-3rd-edition-
andy-d-ward/

textboxfull.com

How Money Works Dk

https://textbookfull.com/product/how-money-works-dk/

textboxfull.com

How Psychology Works Dk

https://textbookfull.com/product/how-psychology-works-dk/

textboxfull.com

How Space Works 1st Edition Dk

https://textbookfull.com/product/how-space-works-1st-edition-dk/

textboxfull.com
CONTENTS IN DETAIL

REVIEWS FOR HOW LINUX WORKS

TITLE PAGE

COPYRIGHT

ABOUT THE AUTHOR

ACKNOWLEDGMENTS

PREFACE
Who Should Read This Book?
Prerequisites
How to Read This Book
A Hands-on Approach
How This Book Is Organized
What’s New in the Third Edition?
A Note on Terminology

CHAPTER 1: THE BIG PICTURE


1.1 Levels and Layers of Abstraction in a Linux System
1.2 Hardware: Understanding Main Memory
1.3 The Kernel
1.3.1 Process Management
1.3.2 Memory Management
1.3.3 Device Drivers and Management
1.3.4 System Calls and Support
1.4 User Space
1.5 Users
1.6 Looking Forward

CHAPTER 2: BASIC COMMANDS AND DIRECTORY


HIERARCHY
2.1 The Bourne Shell: /bin/sh
2.2 Using the Shell
2.2.1 The Shell Window
2.2.2 cat
2.2.3 Standard Input and Standard Output
2.3 Basic Commands
2.3.1 ls
2.3.2 cp
2.3.3 mv
2.3.4 touch
2.3.5 rm
2.3.6 echo
2.4 Navigating Directories
2.4.1 cd
2.4.2 mkdir
2.4.3 rmdir
2.4.4 Shell Globbing (“Wildcards”)
2.5 Intermediate Commands
2.5.1 grep
2.5.2 less
2.5.3 pwd
2.5.4 diff
2.5.5 file
2.5.6 find and locate
2.5.7 head and tail
2.5.8 sort
2.6 Changing Your Password and Shell
2.7 Dot Files
2.8 Environment and Shell Variables
2.9 The Command Path
2.10 Special Characters
2.11 Command-Line Editing
2.12 Text Editors
2.13 Getting Online Help
2.14 Shell Input and Output
2.14.1 Standard Error
2.14.2 Standard Input Redirection
2.15 Understanding Error Messages
2.15.1 Anatomy of a Unix Error Message
2.15.2 Common Errors
2.16 Listing and Manipulating Processes
2.16.1 ps Command Options
2.16.2 Process Termination
2.16.3 Job Control
2.16.4 Background Processes
2.17 File Modes and Permissions
2.17.1 Modifying Permissions
2.17.2 Working with Symbolic Links
2.18 Archiving and Compressing Files
2.18.1 gzip
2.18.2 tar
2.18.3 Compressed Archives (.tar.gz)
2.18.4 zcat
2.18.5 Other Compression Utilities
2.19 Linux Directory Hierarchy Essentials
2.19.1 Other Root Subdirectories
2.19.2 The /usr Directory
2.19.3 Kernel Location
2.20 Running Commands as the Superuser
2.20.1 sudo
2.20.2 /etc/sudoers
2.20.3 sudo Logs
2.21 Looking Forward

CHAPTER 3: DEVICES
3.1 Device Files
3.2 The sysfs Device Path
3.3 dd and Devices
3.4 Device Name Summary
3.4.1 Hard Disks: /dev/sd*
3.4.2 Virtual Disks: /dev/xvd*, /dev/vd*
3.4.3 Non-Volatile Memory Devices: /dev/nvme*
3.4.4 Device Mapper: /dev/dm-*, /dev/mapper/*
3.4.5 CD and DVD Drives: /dev/sr*
3.4.6 PATA Hard Disks: /dev/hd*
3.4.7 Terminals: /dev/tty*, /dev/pts/*, and /dev/tty
3.4.8 Serial Ports: /dev/ttyS*, /dev/ttyUSB*, /dev/ttyACM*
3.4.9 Parallel Ports: /dev/lp0 and /dev/lp1
3.4.10 Audio Devices: /dev/snd/*, /dev/dsp, /dev/audio,
and More
3.4.11 Device File Creation
3.5 udev
3.5.1 devtmpfs
3.5.2 udevd Operation and Configuration
3.5.3 udevadm
3.5.4 Device Monitoring
3.6 In-Depth: SCSI and the Linux Kernel
3.6.1 USB Storage and SCSI
3.6.2 SCSI and ATA
3.6.3 Generic SCSI Devices
3.6.4 Multiple Access Methods for a Single Device

CHAPTER 4: DISKS AND FILESYSTEMS


4.1 Partitioning Disk Devices
4.1.1 Viewing a Partition Table
4.1.2 Modifying Partition Tables
4.1.3 Creating a Partition Table
4.1.4 Navigating Disk and Partition Geometry
4.1.5 Reading from Solid-State Disks
4.2 Filesystems
4.2.1 Filesystem Types
4.2.2 Creating a Filesystem
4.2.3 Mounting a Filesystem
4.2.4 Filesystem UUID
4.2.5 Disk Buffering, Caching, and Filesystems
4.2.6 Filesystem Mount Options
4.2.7 Remounting a Filesystem
4.2.8 The /etc/fstab Filesystem Table
4.2.9 Alternatives to /etc/fstab
4.2.10 Filesystem Capacity
4.2.11 Checking and Repairing Filesystems
4.2.12 Special-Purpose Filesystems
4.3 Swap Space
4.3.1 Using a Disk Partition as Swap Space
4.3.2 Using a File as Swap Space
4.3.3 Determining How Much Swap You Need
4.4 The Logical Volume Manager
4.4.2 Working with LVM
4.4.3 The LVM Implementation
4.5 Looking Forward: Disks and User Space
4.6 Inside a Traditional Filesystem
4.6.1 Inode Details and the Link Count
4.6.2 Block Allocation
4.6.3 Working with Filesystems in User Space

CHAPTER 5: HOW THE LINUX KERNEL BOOTS


5.1 Startup Messages
5.2 Kernel Initialization and Boot Options
5.3 Kernel Parameters
5.4 Boot Loaders
5.4.1 Boot Loader Tasks
5.4.2 Boot Loader Overview
5.5.1 Exploring Devices and Partitions with the GRUB
Command Line
5.5.2 GRUB Configuration
5.5.3 GRUB Installation
5.6 UEFI Secure Boot Problems
5.7 Chainloading Other Operating Systems
5.8 Boot Loader Details
5.8.1 MBR Boot
5.8.2 UEFI Boot
5.8.3 How GRUB Works
CHAPTER 6: HOW USER SPACE STARTS
6.2 Identifying Your init
6.3 systemd
6.3.1 Units and Unit Types
6.3.2 Booting and Unit Dependency Graphs
6.3.3 systemd Configuration
6.3.4 systemd Operation
6.3.5 systemd Process Tracking and Synchronization
6.3.6 systemd Dependencies
6.3.7 systemd On-Demand and Resource-Parallelized
Startup
6.3.8 systemd Auxiliary Components
6.4 System V Runlevels
6.5 System V init
6.5.1 System V init: Startup Command Sequence
6.5.2 The System V init Link Farm
6.5.3 run-parts
6.5.4 System V init Control
6.5.5 systemd System V Compatibility
6.6 Shutting Down Your System
6.7 The Initial RAM Filesystem
6.8 Emergency Booting and Single-User Mode
6.9 Looking Forward

CHAPTER 7: SYSTEM CONFIGURATION: LOGGING,


SYSTEM TIME, BATCH JOBS, AND USERS
7.1 System Logging
7.1.1 Checking Your Log Setup
7.1.2 Searching and Monitoring Logs
7.1.3 Logfile Rotation
7.1.4 Journal Maintenance
7.1.5 A Closer Look at System Logging
7.2 The Structure of /etc
7.3 User Management Files
7.3.1 The /etc/passwd File
7.3.2 Special Users
7.3.3 The /etc/shadow File
7.3.4 Manipulating Users and Passwords
7.3.5 Working with Groups
7.4 getty and login
7.5 Setting the Time
7.5.1 Kernel Time Representation and Time Zones
7.5.2 Network Time
7.6 Scheduling Recurring Tasks with cron and Timer Units
7.6.1 Installing Crontab Files
7.6.2 System Crontab Files
7.6.3 Timer Units
7.6.4 cron vs. Timer Units
7.7 Scheduling One-Time Tasks with at
7.7.1 Timer Unit Equivalents
7.8 Timer Units Running as Regular Users
7.9 User Access Topics
7.9.1 User IDs and User Switching
7.9.2 Process Ownership, Effective UID, Real UID, and
Saved UID
7.9.3 User Identification, Authentication, and Authorization
7.9.4 Using Libraries for User Information
7.10 Pluggable Authentication Modules
7.10.1 PAM Configuration
7.10.2 Tips on PAM Configuration Syntax
7.10.3 PAM and Passwords
7.11 Looking Forward

CHAPTER 8: A CLOSER LOOK AT PROCESSES AND


RESOURCE UTILIZATION
8.1 Tracking Processes
8.2 Finding Open Files with lsof
8.2.1 Reading the lsof Output
8.2.2 Using lsof
8.3 Tracing Program Execution and System Calls
8.3.1 strace
8.3.2 ltrace
8.4 Threads
8.4.1 Single-Threaded and Multithreaded Processes
8.4.2 Viewing Threads
8.5.1 Measuring CPU Time
8.5.2 Adjusting Process Priorities
8.5.3 Measuring CPU Performance with Load Averages
8.5.4 Monitoring Memory Status
8.5.5 Monitoring CPU and Memory Performance with
vmstat
8.5.6 I/O Monitoring
8.5.7 Per-Process Monitoring with pidstat
8.6 Control Groups (cgroups)
8.6.1 Differentiating Between cgroup Versions
8.6.2 Viewing cgroups
8.6.3 Manipulating and Creating cgroups
8.6.4 Viewing Resource Utilization
8.7 Further Topics
CHAPTER 9: UNDERSTANDING YOUR NETWORK AND ITS
CONFIGURATION
9.1 Network Basics
9.2 Packets
9.3 Network Layers
9.4 The Internet Layer
9.4.1 Viewing IP Addresses
9.4.2 Subnets
9.4.3 Common Subnet Masks and CIDR Notation
9.5 Routes and the Kernel Routing Table
9.6 The Default Gateway
9.7 IPv6 Addresses and Networks
9.7.1 Viewing IPv6 Configuration on Your System
9.7.2 Configuring Dual-Stack Networks
9.8 Basic ICMP and DNS Tools
9.8.1 ping
9.8.2 DNS and host
9.9 The Physical Layer and Ethernet
9.10 Understanding Kernel Network Interfaces
9.11.1 Manually Configuring Interfaces
9.11.2 Manually Adding and Deleting Routes
9.12 Boot-Activated Network Configuration
9.13 Problems with Manual and Boot-Activated Network
Configuration
9.14 Network Configuration Managers
9.14.1 NetworkManager Operation
9.14.2 NetworkManager Interaction
9.14.3 NetworkManager Configuration
9.15 Resolving Hostnames
9.15.1 /etc/hosts
9.15.2 resolv.conf
9.15.3 Caching and Zero-Configuration DNS
9.15.4 /etc/nsswitch.conf
9.16 Localhost
9.17 The Transport Layer: TCP, UDP, and Services
9.17.1 TCP Ports and Connections
9.17.2 UDP
9.18 Revisiting a Simple Local Network
9.19 Understanding DHCP
9.19.1 Linux DHCP Clients
9.19.2 Linux DHCP Servers
9.20 Automatic IPv6 Network Configuration
9.21 Configuring Linux as a Router
9.22 Private Networks (IPv4)
9.23 Network Address Translation (IP Masquerading)
9.24 Routers and Linux
9.25 Firewalls
9.25.1 Linux Firewall Basics
9.25.2 Setting Firewall Rules
9.25.3 Firewall Strategies
9.26 Ethernet, IP, ARP, and NDP
9.27 Wireless Ethernet
9.27.1 iw
9.27.2 Wireless Security
9.28 Summary

CHAPTER 10: NETWORK APPLICATIONS AND SERVICES


10.1 The Basics of Services
10.2 A Closer Look
10.3 Network Servers
10.3.1 Secure Shell
10.3.2 The sshd Server
10.3.3 fail2ban
10.3.4 The SSH Client
10.4 Pre-systemd Network Connection Servers: inetd/xinetd
10.5 Diagnostic Tools
10.5.1 lsof
10.5.2 tcpdump
10.5.3 netcat
10.5.4 Port Scanning
10.6 Remote Procedure Calls
10.7 Network Security
10.7.1 Typical Vulnerabilities
10.7.2 Security Resources
10.8 Looking Forward
10.9 Network Sockets
10.10 Unix Domain Sockets

CHAPTER 11: INTRODUCTION TO SHELL SCRIPTS


11.1 Shell Script Basics
11.1.1 Limitations of Shell Scripts
11.2 Quoting and Literals
11.2.1 Literals
11.2.2 Single Quotes
11.2.3 Double Quotes
11.2.4 Literal Single Quotes
11.3 Special Variables
11.3.1 Individual Arguments: $1, $2, and So On
11.3.2 Number of Arguments: $#
11.3.3 All Arguments: $@
11.3.4 Script Name: $0
11.3.5 Process ID: $$
11.3.6 Exit Code: $?
11.4 Exit Codes
11.5 Conditionals
11.5.1 A Workaround for Empty Parameter Lists
11.5.2 Other Commands for Tests
11.5.3 elif
11.5.4 Logical Constructs
11.5.5 Testing Conditions
11.5.6 case
11.6 Loops
11.6.1 for Loops
11.6.2 while Loops
11.7 Command Substitution
11.8 Temporary File Management
11.9 Here Documents
11.10 Important Shell Script Utilities
11.10.1 basename
11.10.2 awk
11.10.3 sed
11.10.4 xargs
11.10.5 expr
11.10.6 exec
11.11 Subshells
11.12 Including Other Files in Scripts
11.13 Reading User Input
11.14 When (Not) to Use Shell Scripts

CHAPTER 12: NETWORK FILE TRANSFER AND SHARING


12.1 Quick Copy
12.2 rsync
12.2.1 Getting Started with rsync
12.2.2 Making Exact Copies of a Directory Structure
12.2.3 Using the Trailing Slash
12.2.4 Excluding Files and Directories
12.2.5 Checking Transfers, Adding Safeguards, and
Using Verbose Mode
12.2.6 Compressing Data
12.2.7 Limiting Bandwidth
12.2.8 Transferring Files to Your Computer
12.2.9 Further rsync Topics
12.3.1 File Sharing Usage and Performance
12.3.2 File Sharing Security
12.4 Sharing Files with Samba
12.4.1 Server Configuration
12.4.2 Server Access Control
12.4.3 Passwords
12.4.4 Manual Server Startup
12.4.5 Diagnostics and Logfiles
12.4.6 File Share Configuration
12.4.7 Home Directories
12.4.8 Printer Sharing
12.4.9 The Samba Client
12.5 SSHFS
12.6 NFS
12.7 Cloud Storage
12.8 The State of Network File Sharing

CHAPTER 13: USER ENVIRONMENTS


13.1 Guidelines for Creating Startup Files
13.2 When to Alter Startup Files
13.3 Shell Startup File Elements
13.3.1 The Command Path
13.3.2 The Manual Page Path
13.3.3 The Prompt
13.3.4 Aliases
13.3.5 The Permissions Mask
13.4 Startup File Order and Examples
13.4.1 The bash Shell
13.4.2 The tcsh Shell
13.5 Default User Settings
13.5.1 Shell Defaults
13.5.2 Editor
13.5.3 Pager
13.6 Startup File Pitfalls
13.7 Further Startup Topics

CHAPTER 14: A BRIEF SURVEY OF THE LINUX DESKTOP


AND PRINTING
14.1 Desktop Components
14.1.1 Framebuffers
14.1.2 The X Window System
14.1.3 Wayland
14.1.4 Window Managers
14.1.5 Toolkits
14.1.6 Desktop Environments
14.1.7 Applications
14.2 Are You Running Wayland or X?
14.3 A Closer Look at Wayland
14.3.1 The Compositing Window Manager
14.3.2 libinput
14.3.3 X Compatibility in Wayland
14.4 A Closer Look at the X Window System
14.4.1 Display Managers
14.4.2 Network Transparency
14.4.3 Ways of Exploring X Clients
14.4.4 X Events
14.4.5 X Input and Preference Settings
14.5 D-Bus
14.5.1 System and Session Instances
14.5.2 D-Bus Message Monitoring
14.6 Printing
14.6.1 CUPS
14.6.2 Format Conversion and Print Filters
14.7 Other Desktop Topics

CHAPTER 15: DEVELOPMENT TOOLS


15.1 The C Compiler
15.1.1 Compiling Multiple Source Files
15.1.2 Linking with Libraries
15.1.3 Working with Shared Libraries
15.1.4 Working with Header (Include) Files and
Directories
15.2 make
15.2.1 A Sample Makefile
15.2.2 Built-in Rules
15.2.3 Final Program Build
15.2.4 Dependency Updates
15.2.5 Command-Line Arguments and Options
15.2.6 Standard Macros and Variables
15.2.7 Conventional Targets
15.2.8 Makefile Organization
15.3 Lex and Yacc
15.4 Scripting Languages
15.4.1 Python
15.4.2 Perl
15.4.3 Other Scripting Languages
15.5 Java
15.6 Looking Forward: Compiling Packages

CHAPTER 16: INTRODUCTION TO COMPILING SOFTWARE


FROM C SOURCE CODE
16.1 Software Build Systems
16.2 Unpacking C Source Packages
16.3 GNU Autoconf
16.3.1 An Autoconf Example
16.3.2 Installation Using a Packaging Tool
16.3.3 configure Script Options
16.3.4 Environment Variables
16.3.5 Autoconf Targets
16.3.6 Autoconf Logfiles
16.3.7 pkg-config
16.4 Installation Practice
16.4.1 Where to Install
16.5 Applying a Patch
16.6 Troubleshooting Compiles and Installations
16.6.1 Specific Errors
16.7 Looking Forward
CHAPTER 17: VIRTUALIZATION
17.1 Virtual Machines
17.1.1 Hypervisors
17.1.2 Hardware in a Virtual Machine
17.1.3 Common Uses of Virtual Machines
17.1.4 Drawbacks of Virtual Machines
17.2 Containers
17.2.1 Docker, Podman, and Privileges
17.2.2 A Docker Example
17.2.3 LXC
17.2.4 Kubernetes
17.2.5 Pitfalls of Containers
17.3 Runtime-Based Virtualization

INDEX
Reviews for How Linux Works

“If you are interested in Linux, How Linux


Works: What Every Superuser Should Know is a
must-read title.”
—L I

“Lots to offer on almost every aspect of the Linux


architecture.”
—E L U

“You’ll get an essential understanding of what’s


going on under the hood without getting bogged
down in minutiae—making this a very refreshing
(and wholly recommended) addition to the Linux
literature.”
—P B , - U M E
U

“Dives straight into the transparent depths of


Linux-based operating systems and shows us how
all the pieces fit together.”
—D W

“Earns its place on the shelf as an essential


reference.”
—T M P
HOW LINUX WORKS
3rd Edition

What Every Superuser Should Know

by Brian Ward

San Francisco
How Linux Works, 3rd Edition. Copyright © 2021 by Brian Ward.
All rights reserved. No part of this work may be reproduced or transmitted in any
form or by any means, electronic or mechanical, including photocopying,
recording, or by any information storage or retrieval system, without the prior
written permission of the copyright owner and the publisher.
Publisher: William Pollock
Executive Editor: Barbara Yien
Production Editor: Rachel Monaghan
Developmental Editors: Larry Wake and Jill Franklin
Cover and Interior Design: Octopod Studios
Technical Reviewers: Jordi Gutiérrez Hermoso and Petros Koutoupis
Copyeditor: Rachel Monaghan
Compositor: Cody Gates, Happenstance Type-O-Rama
Proofreader: James M. Fraleigh
For information on book distributors or translations, please contact No Starch
Press, Inc. directly:
No Starch Press, Inc.
245 8th Street, San Francisco, CA 94103
phone: 1-415-863-9900; info@nostarch.com
www.nostarch.com
The Library of Congress has catalogued the first edition as follows:

Ward, Brian.
How Linux works : what every superuser should know / Brian Ward.
p. cm.
Includes index.
ISBN 1-59327-035-6
1. Linux. 2. Operating systems (Computers). I. Title.
QA76.76.O63 W3654 2004
005.4’32--dc22
2004002692

No Starch Press and the No Starch Press logo are registered trademarks of No
Starch Press, Inc. Other product and company names mentioned herein may be
the trademarks of their respective owners. Rather than use a trademark symbol
with every occurrence of a trademarked name, we are using the names only in an
editorial fashion and to the benefit of the trademark owner, with no intention of
infringement of the trademark.
The information in this book is distributed on an “As Is” basis, without warranty.
While every precaution has been taken in the preparation of this work, neither the
author nor No Starch Press, Inc. shall have any liability to any person or entity
with respect to any loss or damage caused or alleged to be caused directly or
indirectly by the information contained in it.
About the Author
Brian Ward has been working with Linux since 1993. He is also the
author of The Linux Kernel HOWTO, The Book of VMware (No
Starch Press), and The Linux Problem Solver (No Starch Press).

About the Technical Reviewers


Jordi Gutiérrez Hermoso is a GNU/Linux user and developer
with almost two decades of experience, with occasional contributions
in various circles of the free software communities, such as GNU
Octave and Mercurial. His professional work has allowed him to
collaborate with and learn about diverse topics such as digital
cryptographic signatures, medical imaging, and most recently
greenhouse gas accounting and ecological map data, all built entirely
with Linux and other free software. When he is not near a computer
he enjoys swimming, mathematics, and knitting.
Petros Koutoupis is currently a senior performance software
engineer at HPE (formerly Cray Inc.) for its Lustre High
Performance File System division. He is also the creator and
maintainer of the RapidDisk Project (www.rapiddisk.org). Petros
has worked in the data storage industry for well over a decade and
has helped pioneer the many technologies unleashed in the wild
today.
ACKNOWLEDGMENTS

Contributions to this book come from not just those who were
involved in the development process, but also those without whom I
wouldn’t know anything about Linux. These include James Duncan,
Douglas N. Arnold, Bill Fenner, Ken Hornstein, Scott Dickson, Dan
Ehrlich, Felix Lee, and Gregory P. Smith. Previous editions included
help from Karol Jurado, Laurel Chun, Serena Yang, Alison Law, Ri-
ley Hoffman, Scott Schwartz, Dan Sully, Dominique Poulain, Donald
Karon, and Gina Steele.
This third edition benefits from the excellent work of Barbara
Yien, Rachel Monaghan, Jill Franklin, Larry Wake, Jordi Gutiérrez
Hermoso, and Petros Koutoupis. As the publisher of No Starch Press,
Bill Pollock has been instrumental in this book since the first edition.
And once more, Hsinju Hsieh has put up with me for another revi-
sion.
PREFACE

Your system shouldn’t be a mystery. You should be able to make your


software do what you want it to do without “magic” incantations or
rituals. The key to attaining this power lies in understanding the
fundamentals of what the software does and how it works, and that’s
what this book is all about. You should never have to fight with a
computer.
Linux is a great platform for learning because it doesn’t try to hide
anything from you. In particular, you can find most system
configuration details in easy-to-read plaintext files. The only tricky
part is figuring out which parts are responsible for what and how
they all fit together.

Who Should Read This Book?


Your interest in learning how Linux works may have come from any
number of sources. In the professional realm, operations and
DevOps folks need to know nearly everything that you’ll find in this
book. Linux software architects and developers should also know this
material in order to make the best use of the operating system.
Researchers and students, often running their own Linux systems,
will also find that this book provides useful explanations for why
things are set up the way they are.
Then there are the tinkerers—people who just love to play around
with their computers for fun, profit, or both. Want to know why
certain things work while others don’t? Want to know what happens
if you move something around? You’re probably a tinkerer.

Prerequisites
Although Linux is beloved by programmers, you don’t need to be a
programmer to read this book; you need only basic computer-user
knowledge. That is, you should be able to bumble around a GUI
(especially the installer and settings interface for a Linux
distribution) and know what files and directories (folders) are. You
should also be prepared to check additional documentation on your
system and on the web. The most important thing you need is to be
ready and willing to play around with your computer.

How to Read This Book


Building the requisite knowledge is a challenge in tackling any
technical subject. Explaining how software systems work can get
really complicated. Too much detail can bog down readers and make
important concepts difficult to grasp (the human brain just can’t
process so many new ideas at once), but too little detail can leave
readers in the dark and unprepared for later material.
I’ve designed most chapters to tackle the most important material
first: the basic information that you’ll need in order to progress. In
places, I’ve simplified things in order to keep focus. As a chapter
progresses, you’ll see much more detail, especially in the last few
sections. Do you need to know those bits right away? In most cases,
no; I note this where applicable. If your eyes start to glaze over when
you’re faced with a lot of extra details about concepts you just
learned, don’t hesitate to skip ahead to the next chapter or take a
break. The nitty-gritty will still be there waiting for you.

A Hands-on Approach
However you choose to proceed through this book, you should have a
Linux machine in front of you, preferably one that you’re confident
abusing with experiments. You might prefer to play around with a
virtual installation—I used VirtualBox to test much of the material in
this book. You also should have superuser (root) access, but try to
use a regular user account most of the time. You’ll mostly work at the
command line, in a terminal window or a remote session. If you
haven’t worked much in that environment, no problem; Chapter 2
will bring you up to speed.
Commands in this book typically look like this:

$ ls /
[some output]

Enter the text in bold; the nonbolded text that follows is what the
machine spits back. The $ is the prompt for a regular user account. If
you see a # as a prompt, you need to be superuser. (More on that in
Chapter 2.)
How This Book Is Organized
I’ve grouped the book’s chapters into three basic parts. The first is
introductory, giving a bird’s-eye view of the system and then offering
hands-on experience with some tools you’ll need for as long as you
run Linux. Next, you’ll explore each part of the system in more detail,
from device management to network configuration, following the
general order in which the system starts. Finally, you’ll get a tour of
some pieces of a running system, learn some essential skills, and get
some insight into the tools that programmers use.
With the exception of Chapter 2, most of the early chapters heavily
involve the Linux kernel, but you’ll work your way into user space as
the book progresses. (If you don’t know what I’m talking about here,
don’t worry; I’ll explain in Chapter 1.)
The material is meant to be as distribution-agnostic as possible.
Having said this, it can be tedious to cover all variations in systems
software, so I’ve tried to cover the two major distribution families:
Debian (including Ubuntu) and RHEL/Fedora/CentOS. I’ve also
focused on desktop and server installations. A significant amount of
material carries over into embedded systems, such as Android and
OpenWRT, but it’s up to you to discover the differences on those
platforms.

What’s New in the Third Edition?


The second edition was published during a time of transition for
Linux systems. Several traditional components were in the process of
being replaced, which made handling some subjects tricky, because
readers could encounter a wide variety of configurations. Now,
however, those new pieces (systemd in particular) have near-
universal adoption, so I’ve been able to streamline a fair amount of
the discussion.
I’ve retained the emphasis on the kernel’s role in a Linux system.
This material has proven popular, and you probably interact with the
kernel more than you realize.
I’ve added a new chapter introducing virtualization. Although
Linux has always been popular on virtual machines (such as cloud
services), that type of virtualization lies outside the scope of this
book, because the way the system operates on a virtual machine is
almost the same as on “bare metal” hardware. So, the discussion here
primarily focuses on deciphering the terminology you’ll encounter.
However, containers have gained in popularity since the second
edition was published, and they also fit here, because they basically
consist of a bunch of Linux features like the ones described
throughout the rest of the book. Containers make heavy use of
cgroups, which also get new treatment in this third edition.
Other subjects (not necessarily related to containers) I happily
expanded on are the Logical Volume Manager, the journald logging
system, and IPv6 in the networking material.
Though I’ve added a significant amount of content, the book is still
a reasonable size. I want to provide the information you need to get
on the fast track, and that includes explaining certain details along
the way that can be hard to grasp, but I don’t want you to have to
become a weightlifter in order to pick up this book. Once you master
the important subjects here, you should have no trouble seeking out
and understanding more details.
The first edition included historical information that I removed
later to improve focus. If you’re interested in Linux and how it relates
to the history of Unix, pick up Peter H. Salus’s The Daemon, the Gnu,
and the Penguin (Reed Media Services, 2008). It does a great job of
explaining how the software we use has evolved over time.

A Note on Terminology
The names of certain operating system elements have caused a fair
amount of debate historically—even the word Linux itself. Should it
be “Linux,” or should it be “GNU/Linux” to reflect that the operating
system also contains pieces from the GNU Project? Throughout this
book, I’ve tried to use the most common, least awkward names
possible.
Another Random Scribd Document
with Unrelated Content
instantly aware that it would no longer engage itself securely in
whatever mechanism usually kept it fast there—in short that, having
first refused to open, it now refused to shut. And if the Prince were
not yet clear of the passage down below, if the fastenings of the door
into the West Bow, for instance, were rusty from disuse, as well they
might be, he would yet be taken.
There was a final crash from below; the door was undoubtedly
down and the invaders in the house. If only the existence of the
sliding panel could be concealed for a few moments longer! To stand
before it sword in hand (as was Ewen’s impulse) were only to
advertise its presence. He looked round in desperation. Perhaps the
corner of the escritoire, pressed well against the line of carving,
would eliminate that betraying crack in the woodwork? Yes, the
escritoire was sufficiently heavy to keep the panel in place, and,
provided that it was not itself moved away from its position, all might
yet be well . . . though not for him, who must now throw himself to
the wolves to keep the secret inviolate.
To ensure that the writing-table stayed as he had put it he must
be near it, and have a reasonable excuse, too, for his position. The
most natural was the best; so, throwing off his hat and cloak, he
pulled up a chair, sat down—unfortunately this necessitated his
having his back to the door—and, seizing a sheet of paper and a
quill, began hastily to write a letter. His heart might be beating faster
than usual, but his hand, as he saw with pleasure, was quite steady.
“My dear Aunt Margaret,—I told you in my last Letter of the
Victory gain’d——” They were coming up the stairs now, and at the
noise of their approach he realised how unnatural it would look to be
found writing a letter in the midst of such a disturbance as had been
going on below. He let his head sink forward on his arm as if he were
overcome by sleep; and so was sitting when a second or two later
the door was flung violently open, heavy feet came tumbling in, and
there was a triumphant shout of “Here’s one o’ them, sir.”
Ewen judged it time to wake. He lifted his head and turned in his
chair with a start; and then sprang to his feet in simulated
astonishment. “Soldiers! What are you doing here?”
There were a sergeant and three men of Lascelles’ regiment in
Lady Easterhall’s drawing-room, and the sergeant advanced
resolutely towards the tall gentleman in amber satin. “’Tis for us to
ask that of you, sir.” Then he stopped, his face lighting up with a sort
of incredulous joy. “Lord, it’s him himself!” he exclaimed. “Call the
officer quick, one of ye! Bide where ye are, sir,” he said with a
mixture of triumph and respect. “If ye don’t stir ye’ll not be harmed.”
Ewen saw that the man took him for the Prince—a mistake well
worth encouraging if possible, though it was not very likely that an
officer from the Castle would make the same mistake. In any case
he had no intention of stirring from his place; as it was he imagined
that the crack of the panel was widening behind his back, and dared
not turn his head to look. What would be the end of this? Edinburgh
Castle and captivity, at the best; perhaps a fate even less agreeable.
Ah, here was the officer pushing eagerly through the soldiers
round the doorway. One glance at the figure in front of the escritoire
and that eagerness was wiped away.
“That is not the Prince, you fool!” he said to the sergeant. “What
was he doing when you came in—did he offer any resistance?”
Through the sergeant’s reply that the gentleman was sitting at the
table and seemed to be asleep, Ewen was striving not to manifest a
surprise which, this time, was perfectly genuine. For, however he
had become part of the marooned garrison of Edinburgh Castle, his
captor was no officer of Lascelles’ regiment from that fortress; he
was Captain Keith Windham of the Royal Scots.
CHAPTER III

But Ewen’s own powder, satin and lace were, apparently, as good as
a disguise to him, for it was quite clear that Captain Windham had
not recognised in this fine gentleman the tartan-clad victor of Loch
Oich side, nor even his seven days’ host—no, even though he was
now looking at his capture more directly, and saying, with military
abruptness, “You are my prisoner, sir!”
Ewen drew himself up. “By what right, if you please?” he
demanded. “By what right indeed do you break at all into a private
house? The Lord Provost shall know of this to-morrow,” he went on,
with a sudden idea of passing himself off as an ordinary peaceful
burgess. “The Lord Provost shall know of it, and will require an
explanation from General Guest.”
Alas, his voice, at any rate, was not unfamiliar, like his hair and
costume. Captain Windham suddenly strode forward, gave an
exclamation, and recoiled a little. “What! It is you, Ardroy! Then I
know that the Pretender’s son is in this house, for you are one of his
aides-de-camp! Sergeant, leave a couple of men here, and search
the next floor with the others; I will follow in a moment.”
“Is that your pretext for breaking into an old lady’s house at this
hour of night?” asked Ewen with a fine show of indignation, as the
sergeant withdrew. “Surely you know the way to Holyrood House,
Captain Windham—though in truth it may not be so easy to force an
entrance there!”
In spite of his anxiety he was able to view with pleasure Captain
Windham’s visible annoyance at this speech.
“Mr. Cameron,” said the soldier, with a steely light in his eyes, “I
am not to be played with like this! The Pretender’s son, with three
companions, was seen to enter this house a short while——”
“I am sorry to disappoint you, sir,” broke in Ewen, “but it was I
who entered with three companions. As you see, I have just been
mistaken anew for the Prince. My three friends have left—yes, those
are their wineglasses on the table—Lady Easterhall has retired, and
I was beginning to write a letter when I fell into the doze which your
noisy and illegal entry has cut short.”
“I don’t believe you,” said Keith starkly, though at the mention of
the letter his eyes had strayed for a second to the escritoire—and
Ewen immediately wished he had not called attention to it. “Nor do I
believe that our informant mistook you for the Pretender’s son; tall
though he is, you are much taller. He is somewhere hidden in this
house.”
“Tall . . . taller . . .” observed Ewen meditatively. “Ah, yes, I was
forgetting your opportunities of observation at Glenfinnan. I suppose
you were able to tell them his exact height at Fort William after you
had so craftily given me the slip.”
This effort at provoking an argument about the ethics of that
action was unsuccessful, though he could see that his late prisoner
did not relish the expression which he had applied to it. But Captain
Windham merely repeated, with more emphasis, “He is somewhere
hidden in this house!”
“If so, then perhaps you will have the good fortune to find and
recognise him,” said Ewen with an air of levity. “Or if not His Royal
Highness, one of the other two, perhaps.”
“I have no doubt I shall,” replied Keith shortly. “Meanwhile—your
sword, if you please, Mr. Cameron!”
This object Ewen had not the slightest intention of surrendering.
But any kind of parley with the enemy gained time, which was the
important matter. So, after a long look at the floor, as though seeking
counsel there, he put his hand to the hilt, and very slowly drew the
small-sword from its velvet sheath. But, once the blade was out, his
fingers retained their grip.
“After all, I find that I dislike making you an unconditional gift of
it,” he announced coolly, while the candle light played menacingly up
and down the steel. “But I cannot prevent your taking it, Captain
Windham—if you think it worth the trouble.” And with his free hand
he tucked his lace ruffle out of the way.
But, as he had expected—half hoped, yet half feared, for at
bottom he was pining for a fight—the Prince’s pursuer did not wish to
engage either himself or his men in personal conflict while part of the
house still remained unexplored. “I’ll deal with you later, Mr.
Cameron,” he replied curtly, and turned to the soldiers. “See that the
prisoner does not move from that spot, men. I am going to fasten the
door.” He went out and, sure enough, could be heard to bolt the door
on the outside.
Ewen smiled to himself to think how little he desired to quit his
self-chosen position. “You’ll not object to my sitting down, I hope?”
he observed politely to his two guardians, and, turning round the
chair from which he had risen—casting, too, a quick glance at the
panel behind him, still in place—he sat down, facing his gaolers, his
sword across his knees. Though they had no orders to that effect, he
thought it just possible that they might attempt to disarm him, but
they showed no sign of such a desire, standing stiffly by the door
with their muskets and screwed bayonets, and glancing nervously at
him out of the corners of their eyes, mere young north-country
English lads, overawed by his dress and his air. Had they not been
there, however, he could have decamped through the secret door,
and what a charming surprise that would have been for Captain
Windham when he returned—Fassefern House the other way round!
But on second thoughts Ewen was obliged to admit to himself that
this withdrawal would not have been feasible in any case, because
he could not close the panel from the inside.
Meanwhile Captain Windham, in pursuit of a prey already (please
God!) out of the snare, was presumably searching Lady Easterhall’s
bedchamber, and, a still more delicate matter, Miss Cochran’s. Ewen
could not suppose that the task would be to his liking, and the
thought of his opponent’s embarrassment afforded him much
pleasure, as he sat there with one silk-stockinged leg crossed over
the other. His ill-temper had gone. Too young a man to have at all
enjoyed the rôle of disapproving critic forced upon him this evening,
with his two elders covertly sneering at his prudence, and even the
Prince amused at him, he was more than relieved to be free of his
ungrateful part. Events had most amply justified his attitude, and
now, with rising spirits, he was free to try what his wits—and
perhaps, in the end, his arm—could accomplish against Captain
Windham and his myrmidons. It was true that, short of getting
himself killed outright, he did not see much prospect of escaping
imprisonment in the Castle, but at any rate he might first have the
satisfaction of a good fight—though it was to be regretted that he
had not his broadsword instead of this slender court weapon. Still, to
get the chance of using it against what he knew to be overwhelming
odds was better than having to submit to being told that he had an
old head on young shoulders!
Sooner than he had expected he heard returning feet, and now
Captain Windham and he would really come to grips! It was by this
time, he guessed, some twenty minutes since the Prince had slipped
down the stair, and, provided that there had been no difficulty about
exit, he must be almost back at Holyrood House by this time. But
one could not be sure of that. And in any case Ewen had no mind to
have the way he took discovered. Here, at last, was an opportunity
of repaying to Captain Windham the discomfiture which he had
caused him last August over his expired parole, perhaps even of
wiping out, somehow, the insult of the money which he had left
behind. The young man waited with rather pleasurable anticipations.
And Captain Windham came in this time, as Ewen knew he
would, with an overcast brow and a set mouth. He was followed in
silence by the sergeant and five men, so that the room now
contained nine soldiers in all.
“Ah, I was afraid that you would have no luck,” observed Ewen
sympathetically. He was still sitting very much at his ease, despite
his drawn sword. “A pity that you would not believe me. However,
you have wasted time.”
Keith Windham shot a quick, annoyed, questioning glance at him,
but made no reply. His gaze ran rapidly round Lady Easterhall’s
drawing-room, but there was in it no article of furniture large enough
to afford a hiding-place to a man, and no other visible door. He
turned to the two soldiers whom he had left there. “Has the prisoner
made any suspicious movement?”
“He has not moved from yonder chair,” he was assured in a
strong Lancashire accent.
“And yet this is the room they were in,” muttered the Englishman
to himself, looking at the disordered chairs and the used
wineglasses. After frowning for a moment he started to tap the
panelling on his side of the room, a proceeding which made Ewen
uneasy. Had they heard up at the Castle of the existence of a secret
passage somewhere in this house? It was unpleasantly possible. But
when Captain Windham came to the three windows giving on to the
Grassmarket he naturally desisted. And the farther side of the room
—that where Ewen and his writing-table were situated—faced,
obviously, down the close by which the soldiers had entered, so (if
the Highlander followed his reasoning correctly) Captain Windham
concluded that there was no room there for a hiding-place, and did
not trouble to sound the wall.
Ewen, however, judged it time to rise from his chair. “I told you,
Captain Windham, that my friends had gone,” he remarked, brushing
some fallen powder off his coat. “Will you not now take your own
departure, and allow an old lady to resume the rest which I suppose
you have just further disturbed?”
He saw with satisfaction that the invader (who was, after all, a
gentleman) did not like that thrust. However, the latter returned it by
responding dryly: “You can render that departure both speedier and
quieter, Mr. Cameron, by surrendering yourself without resistance.”
“And why, pray, should I be more accommodating than you were
last August?” enquired Ewen with some pertinence.
Keith Windham coloured. “To bring back the memory of that day,
sir, is to remind me that you then put me under a deep obligation,
and to make my present task the more odious. But I must carry it
out. Your sword, if you please!”
Ewen shrugged his shoulders in the way Miss Cameron
condemned as outlandish. “I had no intention, sir, of reminding you
of an obligation which I assure you I had never regarded as one. But
why should I render your task, as you call it, more pleasant? And
why make a task of it at all? The Prince, as you see, is not here, and
Generals Guest and Preston will find me a very disappointing
substitute.”
Keith Windham came nearer and dropped his voice. His face
looked genuinely troubled. “I wish, Ardroy, for your own sake, that
you would let me take you unharmed! Take you I must; you are a
chieftain and the Prince’s aide-de-camp, as I happen to know. It is
the fortune of war, as it was last August, when our positions were
reversed. So, for the sake of the courtesy and hospitality which I
then received from you——”
“My sorrow!” burst out Ewen. “Must my past good conduct, as
you are pleased to consider it, lead to my undoing now? . . . And I
very much doubt whether our positions are reversed, and whether
any further disturbance—and you have made not a little already—do
not bring the guard from the West Bow about your ears. If I might
give advice in my turn, it would be to get back to the Castle while yet
you can!”
“Thank you,” said Keith with extreme dryness; “we will. Sergeant,
have your men secure the prisoner.”
He stood back a little. Ewen had already decided in the event of a
fight to abandon his post by the writing-table, where, on one side at
least, he could be taken in flank, and where any shifting of the table
itself, highly probable in a struggle, would cause the panel to reveal
its secret. (Not that that would greatly matter now.) Immediately the
Englishman stepped back, therefore, he darted across the room and
ensconced himself in the corner by the nearest window, hastily
wrapping his cloak, which he had snatched up for the purpose, round
his left arm. His eyes sparkled; he was going to have his fight!
“I am ready,” he remarked cheerfully, seeing the much slower
preparations of his assailants. “Is it to be a charge with the bayonet,
or are you going to use the butt, my friends?”
“You’ll not use either!” said Keith sharply to his men. “I do not
wish this gentleman injured.”
“Then make him put up his sword, sir,” retorted the sergeant in
justifiable indignation. “Else it’s ourselves will be injured, I’m
thinking!”
Ewen was about to endorse this opinion when a familiar and
most welcome sound came to him through the closed window behind
him. No mistaking that strain; and that the soldiers should hear it too
he turned a little and dashed his elbow, protected by the curtain,
through the nearest pane of glass. In it flowed, wailing and
menacing, the Cameron rant: ‘Sons of the dogs, come hither, come
hither and you shall have flesh . . .’
“I think you had best call off your men altogether, Captain
Windham, if they are to save their own skins!” And in the uneasy
silence which he had procured Ewen added, with some exultation, “It
is my own clan, the Camerons; they are coming down the West Bow
into the Grassmarket. There will not be much left of you, my good
fellows, if you so much as scratch me!” And, seeing the effect of his
words, he tugged aside the curtain, flung open the partly shattered
casement, and called out in Gaelic to the line of kilted figures just
emerging from the West Bow.
The long yell of the slogan answered him as he swung quickly
back on guard. But there was no need of his sword. Prestonpans
had taught the Castle garrison exaggerated terror of those who
uttered such cries. The soldiers, the sergeant included, were already
huddling towards the door, and Keith Windham was not in time to get
between them and the exit. He stamped his foot in fury.
“Do your duty, you dirty cowards!” he shouted, pointing at the
figure by the window. But a second heartshaking yell came up from
the Grassmarket: ‘Chlanna nan con, thigibh an so, thigibh an so . . .’
Perfectly deaf to their officer’s objurgations, the English soldiers
were occupied only with the question of which should be first from
the room. Keith seized the last fugitive by the collar, but the only
result of this appeal to force was that the man, who was very
powerful, shook him off, thrust him back with small regard for his
rank, and banged the door behind himself. Captain Windham, livid,
threw himself upon the handle to pluck it open again—but the knob
merely turned in his hand. The violent slam had evidently shot to the
bolt on the outside. Hunter and quarry—only now it was hard to
know which was which—were equally prisoners.
Ewen, over at the window, laughed aloud; he could not help it.
“You seem always to be unfortunate in your men, Captain Windham,”
he remarked, and, shaking the cloak off his left arm, slid his blade
back into the scabbard. “I fear it is I who shall have to ask you for
your sword. Would you prefer to give it up to me before the guard
arrives?”
He got it . . . but not in the fashion which he had expected. Keith,
quite beside himself with mortification and rage, had already
whipped out his weapon while Ewen, with bent head, was sheathing
his own, and now, really blind to the fact that the Highlander was for
the moment defenceless and off his guard, Captain Windham sprang
furiously at him without warning of any sort. Ewen had no chance to
draw again, no space to spring aside, no time for anything but to
catch wildly at the blade in the hope of diverting it. At the cost of a
badly cut right hand he succeeded in saving himself from being
spitted, and the deflected point, sliding through his clutching fingers,
went by his hip into the panelling where, both men loosing their hold
at the same moment, the weapon stuck for the fraction of a second,
and then fell ringing to the floor.
Horrified and sobered, Keith had sprung back; Ewen, after a first
instinctive movement to catch him by the throat, had checked
himself, and, clasping his bleeding hand tightly with the other, leant
back against the wall and looked at him with a mixture of sternness
and enquiry. His breath was coming rather quickly, but, compared
with his assailant, he was the image of calm.
“My God!” stammered the Englishman, as white as a sheet. “I
never saw . . .” He indicated Ardroy’s sheathed sword. “I might have
killed you. . . .” He took a long breath and drew a hand across his
eyes. Still looking at him curiously his victim fished out his lace-
bordered handkerchief and began to wrap it round his palm, a very
inadequate precaution, for in a moment the cambric was crimson.
In another Keith was at his side. “How deeply is it cut? Let me . .
.” And he pulled out his own more solid handkerchief.
“I don’t know,” answered Ewen composedly, putting back his
Mechlin ruffle, which had slipped down again. “Pretty deeply, it
seems.” He surrendered his hand. “Thanks; over mine then—tie it
tighter still.”
“Good God, I might have killed you!” said Keith again under his
breath as he bandaged and knotted. “I . . . I lost my temper, but, as
Heaven’s my witness, I thought you had your sword out.”
“Why, so I had, a moment earlier,” replied Ewen. “You did not
intend murder, then?”
“I deserve that you should think so,” murmured the soldier, still
very much shaken. “Perhaps as it is I have disabled you for life.”
Ewen had nearly retorted, “Why should that trouble you?” but he
was so much astonished at the depth of feeling in his enemy’s tone
that he merely stared at his bent head as he tied the last knot.
“These handkerchiefs are not enough,” said Keith suddenly,
relinquishing the wounded hand. He pushed aside the little brass
gorget at his neck, untied and unwound his own lace cravat, and
bound that over all. Then he stood back.
“You will soon get attention now, Ardroy. Keep your hand up, so. .
. . There is my sword.” He made a jerky movement towards the floor,
and walking abruptly away to the hearth, stood there with his back
turned.
For a moment or two Ewen also stood quite still where he was,
looking at that back. That Captain Windham was ashamed of his
attack on a practically unarmed man he could understand; he would
have had precisely the same scruples in his place, and he would
certainly have felt the same rage and humiliation had he been
deserted by his followers in so disgraceful a manner (though he
could not imagine Highlanders ever acting so). And, observing the
dejection revealed in Captain Windham’s attitude, where he stood
with bowed head and folded arms by the dying fire, and the complete
absence in him of any of that mocking irony with which he himself
had more than once made acquaintance at Ardroy, Ewen began to
feel less vindictive about the incident of the guineas. Captain
Windham, being an Englishman, did not understand Highland pride,
and had probably never intended any insult at all. And now, with this
sudden turning of the tables, he was again a prisoner, made in rather
an absurd and ignominious fashion. Ewen could find it in his heart to
be sorry for him. And what would be the advantage of yet another
prisoner? The officers taken at Gladsmuir had had to be paroled and
sent away. . . .
He picked up the fallen sword, faintly smeared with red along its
edges, and went over to the hearth.
“Captain Windham!”
The scarlet-clad figure turned. “Your Camerons are very tardy!”
he said with a bitter intonation. “Or are those yells all we are to know
of them?” It was indeed sufficiently surprising that the rescuers had
not entered the house some minutes ago, particularly as the door
was broken open.
Ewen listened. “I think that they are possibly chasing . . . a
retreating enemy. But in any case”—he held out Keith’s sword—“I
cannot stomach taking advantage of your being left in the lurch by
those rascals. Put on your sword again, and I’ll convey you safely
out of the house.”
A dull flush swept over the English soldier’s face. “You mean that
I am to run the gauntlet of those caterans, when they return, under
your protection? No; I have been humiliated enough this evening; it
would be less galling to go as a prisoner. Keep my sword; ’tis the
second of mine you have had, Mr. Cameron.”
Yes, he was sore, and no wonder! Ewen decided that he would
not even mention the objectionable guineas. “I cannot hold this
sword much longer,” he said lightly, “having but the one hand at
present.—No, the caterans shall not see you at all, Captain
Windham, and you shall go alone. Only, for Heaven’s sake, be quick,
for some of them must soon be here!”
Bewildered, half reluctant, Keith closed his fingers on the hilt held
out to him, and Ewen drew him to the escritoire on the right of the
hearth. When he pushed it aside the panel behind slid slowly back.
Keith Windham stood before the gap momentarily speechless.
“That, then——” he began at last, thickly.
“Yes, that is the way my friends went. But you can use the same
road. It comes out, I understand, in the West Bow; there you will
have to trust to chance, but it seems a dark night. Here, take my
cloak,”—he went and picked it up—“’twill cover your uniform. And
you must have a candle to light you down.”
To these directions and the proffered candlestick and cloak the
baffled hunter paid no heed. “Your friends!” he said between his
teeth. “The Pretender’s son, you mean! He was here this evening,
then, in this very room!”
“Yes, but he was gone a little time before you entered,” answered
Ewen soothingly. “I was only troubled lest the door should slide open
and betray the path he took. But ’tis of no moment now.”
“No, it’s of no moment now!” repeated Windham bitterly. Wrath,
reluctant admiration, disappointment and concern for what he had so
nearly done—and not in fair fight—to the man before him strove
openly in his tone as he went on: “Is this your revenge for——”—he
pointed to the swathed right hand—“and for my outwitting you last
August? It’s a sharp one, for all that it’s generous. . . . Yes, you have
fairly outmanœuvred me, Ardroy, with your secret stair and your
clansmen so pat to the moment, like a stage play! But I warn you
that this mumming will turn to grim earnest some day; there’ll be a
bloody curtain to the comedy, and you will regret that ever you
played a part in it!”
“That depends, does it not, on how many more battles of
Gladsmuir we have?” retorted Ewen, with a smile on his lips and a
sparkle in his eyes. “But go—go!” for at last there had come a rush of
feet up the stairs, and the rescue party (oblivious of the bolt) were
hammering upon the door with cries. He thrust the candlestick and
the cloak—the Prince’s cloak—into the Englishman’s hands, calling
out something in Gaelic over his shoulder the while. “Go—they’ll
have the door down in another minute!”
He almost pushed Captain Windham into the aperture, pressed
the spring, and wedged the returning panel with the table, only a
second or two before the unfortunate door of Lady Easterhall’s
drawing-room fell inwards with a crash, and Cameron kilts plunged
over it.
CHAPTER IV

Walking home with her father next day up the crowded


Canongate after rain, Miss Alison Grant suddenly became aware of
a tall Highland officer striding up the street some way ahead. From
the occasional glimpses of him, which were all that she was able to
obtain in the moving throng, it seemed to be her betrothed; but, if so,
he was carrying his right arm in a sling. This was disturbing.
Moreover Ewen, if it were he—and at any rate the officer was a
Cameron—was walking at such a pace that Alison and her parent
would never overtake him, unless indeed he were on his way to visit
them where they lodged in Hyndford’s Close, a little beyond the
Netherbow.
“Papa,” whispered Alison, “let us walk quicker; yonder’s Ewen,
unless I am much mistaken, on his way to wait upon us, and he must
not find us from home.”
They quickened their pace, without much visible effect, when lo!
their quarry was brought to a standstill by two gentlemen coming
downwards who encountered and stopped him.
“Now let us go more slowly, sir,” suggested Alison, dragging at
her father’s arm. To which Mr. Grant, complying, said, “My dear, to
be alternately a greyhound and a snail is hard upon a man of my
years, nor do I understand why you should be stalking Ardroy in this
fashion.”
“Ewen is rather like a stag,” thought Alison; “he carries his head
like one.—Papa,” she explained, “I want to know—I must know—why
he wears his arm in a sling! Look, now that he has turned a little you
can see it plainly. And, you remember, he disappeared so strangely
last night.”
And now, crawl as they would, they must pass the three
gentlemen, who made way for them instantly, not to turn the lady
with her hooped petticoats into the swirling gutter. As Ewen—for it
was he—raised his bonnet with his left hand, Alison cast a swift and
comprehensive glance over him, though she did not pause for the
fraction of a second, but, acknowledging his salutation and those of
his companions, went on her way with dignity.
But she walked ever slower and slower, and when she came to
the narrow entrance of their close she stopped. Yet even then she
did not look back down the Canongate.
“Papa, did you hear, those gentlemen were asking Ewen what
had befallen him. I heard something about ‘disturbance’ and
‘Grassmarket’. You saw his hand was all bandaged about. He looked
pale, I thought. What can he have been at last night—not fighting a
duel, surely!”
“Well, my dear, here he is, so he can tell us—that is, if he is
disposed to do so,” observed Mr. Grant. “Good day, Ardroy; were
you coming in-bye?”
“I intended it, later on,” replied Ewen with more truth than tact,
“but——”
“But now you see that you behove to at this moment,” finished
Alison with determination, looking very significantly at his arm; and
Ewen, without another word, went obediently up the close with them,
secretly admired from above by a well-known Whig lady who
happened to be at her window, and who remarked to her maid that
the Jacobite Miss lodging overhead had a braw lover, for all he was
a wild Hielandman.
And presently the wild Hielandman was standing in the middle of
Mr. Grant’s parlour, and the Jacobite Miss was declaring that she
could shake him, so little could she get out of him. “They say you can
ask anything of a Cameron save butter,” she said indignantly, “but it’s
clear that there are other things too you’ll never get from them!”
Ewen smiled down at her, screwing up his eyes in the way she
loved. He was a little pale, for the pain of his cut hand had kept him
wakeful, but he was not ill-pleased with life this afternoon.
“Yes, other people’s secrets, to wit,” he said teasingly; and then,
feigning to catch himself up, “My sorrow, have I not the unlucky
tongue to mention that word in a woman’s hearing! What I have told
you, m’eudail, is the truth; I had an encounter last night with some of
the Castle garrison, and my hand, as I say, was hurt—scratched,
that is, as I warrant you have sometimes scratched yourself with a
needle or a bodkin.”
“The needle’s never been threaded whose scratch required as
much bandaging as that!” retorted Alison, with her eyes on the
muffled member in the sling. “And what was yon I heard as I passed
about a disturbance in the Grassmarket?”
“Has she not the ears of a hare?” observed Ewen to Mr. Grant.
“’Tis true, there was a disturbance in the Grassmarket.”
“If that is so, then I’ll learn more of it before the day’s out,”
deduced Alison with satisfaction. “And you, sir, that ought to know
better, brawling in the town at such an hour! I thought the Prince had
summoned you last night. Not that I remarked your absence from the
ball,” she added. “I was quite unaware of it, I assure you, in the
society of my cousins of Glenmoriston.”
Ewen looked across at Mr. Grant and smiled. “My dear,”
protested the old gentleman, “an encounter with the Castle garrison
can scarce be called brawling. We are, it may be said, at war with
them.”
“But are they not all as mild as milk up there now that the Prince
has lifted the blockade?” enquired Alison. “And how could Ewen
have met any of them in the Grassmarket? The poor men dare not
show their faces there; the place is hotching with Camerons and
MacDonalds!”
“Who said I met them in the Grassmarket?” retorted Ewen. “But
never fret, Miss Curiosity; some day I’ll be free to tell you where it
was.”
“Wherever it was,” said Miss Grant with decision, “I’ll be bound
’twas you provoked the disturbance!”
Her lover continued to smile at her with real amusement. In a
sense there was truth in this last accusation. “It’s a fine character
you give me, indeed! I think I’d best be taking my leave until you
appreciate me better!” And he put out his left hand to take his bonnet
from the table where he had laid it. Something sparkled on the hand
as he moved it.
“Who gave you that ring?” exclaimed Alison. “Nay, that I have a
right to know!”
Ewen put his hand behind him. “No woman, Alison.”
“Then you can tell me who it was. . . . Come, Eoghain mhóir, if
there be a mystery over the ring also, why, you should not be
wearing it for all the world to see!”
“That’s true,” said Ardroy, and he relinquished his hand. “Yes, you
can take it off. ’Tis not so plain as it looks, neither. There is a spring
beneath.”
“Oh!” breathed Alison, her eyes very wide. The chased gold
centre of the ring had moved aside in the midst of the rose
diamonds, and it was a tiny miniature of the Prince which she held.
“Ewen, he gave you this?”
“I did not steal it, my dear. Yes, he gave it me this morning.”
“For . . . on account of what happened last night?”
Ewen nodded. “For my prudence. You see, the Prince does not
write me down so turbulent as you do.”
There was something like tears in Alison’s eyes. “Prudence? No!
It was because you gained that ‘needle-scratch’ for him!” She kissed
the ring, and, taking the strong, passive hand, slipped it on again. “I
will not plague you any more. Does the wound pain you, dearest
heart?”

But next day Hector Grant came into possession of the story,
more or less correct, which was flying about Edinburgh, and
presented his sister with a fine picture of her lover, alone against a
score of the Castle redcoats, standing with his back to the secret
stair hewing down the foe until his sword broke in his hand, and the
Cameron guard rushed in only just in time to save him. And, Alison
unveiling this composition to the hero himself at their next meeting,
Ewen was constrained in the interests of truth to paint out this
flamboyant battle-piece and to substitute a more correct but
sufficiently startling scene. Alison certainly found his sober account
quite lurid enough.
“And you let the English officer go, after that!” she exclaimed
breathlessly. “But, Ewen dearest, why?”
“For one reason, because ’twas such curst ill luck that his men
should run away for the second time!” replied Ewen, settling his
silken sling more comfortably.
“For the second time?”
“I have not yet told you who the officer was. Cannot you guess?”
“Surely ’twas not . . . Captain Windham . . . here in Edinburgh?”
“It was Captain Windham himself. I have no notion how he got
here; it must have been before we took the town. But I was sorry for
him, poor man, and it was quite plain that he had no real intention of
killing me; indeed he was greatly discomposed over the affair. So
you must not lay that to his charge, Alison.”
“And so you have met again!” said Alison slowly, her eyes
fastened on her lover. (‘A great service’ . . . ‘a bitter grief’ . . . This
was neither.) “It was not then because of your foster-father’s
prophecy that you let him go?”
And now Ewen stared at her. “Faith, no, darling, for I had clean
forgot about it. Dhé! It begins to fulfil itself then!”
Bright and cold, or wet and windy, the October days went by in
Edinburgh. Ewen’s hand healed, and that secret fear which he had
mentioned to no one save Dr. Cameron, who dressed it, that he
would never be able to grip a broadsword again, passed also. And
having waited upon Lady Easterhall and Miss Cochran a day or two
after the fracas to ask how they did (not that he had omitted to
reassure himself of this on the night itself, before he left) he then, by
the old lady’s desire, carried Alison to visit them also. And it is
possible that Miss Cochran envied Miss Grant.
But up at the Castle the days went a great deal more slowly,
particularly for Captain Keith Windham, who had little to do but to
pace the battlements and look down, as he was doing this morning,
when October was almost sped, on that unrivalled vista of which he
was now heartily sick, and remember all the mortifications,
professional as well as personal, which he had suffered there since
the end of August, when he had made his way thither from Fort
William with the news of the Highland advance. For after the startling
tidings of Cope’s avoidance of the rebels, leaving the road open
before them to Edinburgh, Keith, secure but chafing, had endured
the spectacle of vain attempts by the frightened citizens to repair and
man the walls, and to raise a body of volunteers (almost immediately
disbanded lest their lives should be endangered), and the sight of
two regiments of His Majesty’s dragoons in full flight along the Lang
Dykes with no man pursuing. Finally, to complete and symbolise the
great scandal and shock of Cope’s lightning defeat, he had with his
own eyes seen, struck defiantly into the outer gate of the Castle, the
dirk of the single Jacobite officer who on that occasion had chased a
party of terrified troopers thither like rabbits to their burrow.
On top of all this had come his own personal humiliation and
disappointment, and of this Ewen Cameron and no other had been
the cause. The soldiers of Lascelles’ regiment who had so
shamefully deserted the officer in charge of them had been severely
punished, but this did little to heal the very sore place in Captain
Windham’s memory. Sometimes it was only anger which coloured
his recollections of that scene in Lady Easterhall’s house, sometimes
it was shame. Sometimes he wondered if he had not permanently
injured Ardroy, and though, as a loyal subject of King George, he
ought no doubt to have been glad of the possibility, in view of how
the hurt had been inflicted and of the Highlander’s subsequent
behaviour, the idea filled him with a feeling far removed from
satisfaction. And even worse might easily have come of his
onslaught. Keith was inclined to shudder still when he thought of that
contingency, and not merely because, with Ewen dead or dying on
the floor, he himself would have received short shrift from the
Camerons when they broke in.
How nearly he had succeeded in capturing the Prince he
supposed he would never know, but there was no doubt that it was
Ardroy who had destroyed whatever chance he might have had.
Chosen as Keith had been to lead the flying raid that evening
because he was the only officer in the Castle who had seen Charles
Edward Stuart face to face, he could then have blessed Fate for
having sent him to Glenfinnan. Thus, he had reflected as they
marched stealthily down the close, does profit come out of the
unpleasant. Already he saw his name in every news sheet as the
captor of the Pretender’s son. . . . Alas, he had merely come anew
into collision with the same stubborn and generous character, and
once again, though their positions this time had seemed to be
reversed, he had had the worst of it. And on this occasion the
Highlander had shown him a new and unsuspected side of himself,
for it was Ardroy who had played with him, sitting so coolly in front of
that table on which hung the secret. God! if he had only guessed!
And so Keith had come back empty-handed, with the knowledge
that but for Ardroy’s quixotry he would not have come back at all.
Huddled in his enemy’s own cloak (for its real ownership, luckily for
his peace of mind, he never discovered), pushed ignominiously to
safety down the very passage by which his quarry had eluded him,
he had been ever since weighed down by a debt which was wellnigh
a grievance. There were times when he almost regretted that he had
not remained and been made prisoner . . . and always times when
he asked himself why Ewen Cameron had acted as he did. He was
sure that he himself would not have been so foolish. The days of
chivalry were over; one did not go about in this century behaving like
the knights in the old romances. An enemy was an enemy—at least
to a professional soldier—and it was one’s business to treat him as
such.
The cursed part of it was that people who were insane enough to
behave as Ardroy had behaved somehow attained a position of
superiority which was distinctly galling. And galling also was it to
realise, as Keith Windham suddenly did at this moment, how much
time he spent in speculating what that curious young man might be
doing down there in the city spread out like a map. . . . Strange that
he had not at first recognised him that night—extraordinarily
handsome Ardroy had looked, and devilish cool he had kept, too, in
a tight place! . . . Fool that he was, he was at it again. Keith turned
from the battlements, glad of a diversion, for he had become aware
of the approach of a wheeled chair, which he knew to contain the
aged but spirited form of General Preston.
General George Preston, deputy-governor of Edinburgh Castle
since 1715, to whom, old and infirm though he was, it was likely that
his Hanoverian Majesty owed it that that fortress had not been
surrendered to the invaders, was a veteran of Marlborough’s wars,
bearing in fact souvenirs of Ramillies which had ever since affected
his health and his prospects of promotion. He was eighty-six years of
age, even older than General Guest (now, since Cope’s flight,
commander-in-chief); but whereas that warrior had scarcely left his
quarters since he had removed for safety into the Castle, Preston,
during the more strenuous days of the ‘blockade’, had caused
himself to be wheeled round in a chair every two hours to supervise
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like