How Linux Works

Book description

How Linux Works describes the inside of the Linux system for systems administrators, whether they maintain an extensive network in the office or one Linux box at home. Some books try to give you copy-and-paste instructions for how to deal with every single system issue that may arise, but How Linux Works actually shows you how the Linux system functions so that you can come up with your own solutions. After a guided tour of filesystems, the boot sequence, system management basics, and networking, author Brian Ward delves into open-ended topics such as development tools, custom kernels, and buying hardware, all from an administrator's point of view. With a mixture of background theory and real-world examples, this book shows both "how" to administer Linux, and "why" each particular technique works, so that you will know how to make Linux work for you.

Table of contents

  1. How Linux Works
    1. PREFACE
      1. Prerequisites
      2. Kernel Chapter
      3. Acknowledgments
    2. 1. THE BASICS
      1. About /bin/sh
      2. Using the Shell
      3. Basic Commands
        1. ls
        2. cp
        3. mv
        4. touch
        5. rm
        6. echo
      4. Using Directory Commands
        1. cd
        2. mkdir
        3. rmdir
        4. Shell Wildcards
      5. Intermediate Commands
        1. grep
        2. more and less
        3. pwd
        4. diff
        5. file
        6. find
        7. head and tail
        8. sort
      6. Changing Your Password and Shell
        1. chsh
      7. Dot Files
      8. Environment and Shell Variables
      9. The Command Path
      10. Special Characters
      11. Command-Line Editing
      12. Text Editors
      13. Getting Online Help
      14. Shell Input and Output
        1. Standard Error
        2. Standard Input Redirection
      15. Understanding Error Messages
        1. Common Errors
          1. No such file or directory
          2. File exists
          3. Not a directory, Is a directory
          4. No space left on device
          5. Permission denied
          6. Operation not permitted
          7. Segmentation fault, Bus error
      16. Processes
        1. Killing Processes
        2. Job Control
        3. Background Processes
      17. File Modes and Permissions
        1. Modifying Permissions
        2. Symbolic Links
      18. Archiving and Compressing Files
        1. Compressed Archives (.tar.gz)
        2. Other Compression Utilities
    3. 2. DEVICES, DISKS, FILESYSTEMS, AND THE KERNEL
      1. Directory Hierarchy
        1. The Essential Root Subdirectories
        2. Other Root Subdirectories
        3. The /usr Directory
      2. The Kernel
      3. Devices
        1. dd and Devices
        2. Device Name Summary
          1. Hard Disks: /dev/hd*
          2. SCSI Disks: /dev/sd*
          3. Terminals: /dev/tty*, /dev/pts/*, /dev/tty
          4. Serial Ports: /dev/ttyS*
          5. Floppy Disks: /dev/fd*
          6. Parallel Ports: /dev/lp0, /dev/lp1
          7. Audio Devices: /dev/dsp, /dev/audio, /dev/mixer, /dev/snd/*, etc.
        3. Creating Device Files
          1. devfs
        4. Partitioning Disk Devices
      4. Filesystems
        1. Filesystem Types
        2. Creating a Filesystem
          1. Creating ext3 Filesystems
        3. Mounting a Filesystem
        4. Filesystem Buffering
        5. Filesystem Mount Options
          1. Short Options
          2. Long Options
        6. The /etc/fstab Filesystem Table
        7. Filesystem Capacity
        8. Checking and Repairing Filesystems
          1. Checking ext3 Filesystems
          2. The Worst Case
        9. Special-Purpose Filesystems
      5. Swap and Virtual Memory
        1. Using a Disk Partition as Swap Space
        2. Using a File as Swap Space
        3. How Much Swap Do You Need?
    4. 3. HOW LINUX BOOTS
      1. init
        1. Runlevels
          1. respawn
          2. ctrlaltdel
          3. sysinit
        2. How Processes in Runlevels Start
        3. Adding and Removing Services
        4. Controlling init
        5. Shutting Down
      2. Boot Loaders
        1. LILO
        2. GRUB
        3. Other Boot Loaders
        4. Single-User Mode and Emergency Booting
      3. Virtual Consoles
    5. 4. ESSENTIAL SYSTEM FILES, SERVERS, AND UTILITIES
      1. System Logging
      2. A Glance at /etc
      3. User Management Files
        1. Manipulating Users and Passwords
          1. Changing /etc/passwd as the Superuser
        2. Working with Groups
      4. getty and login
      5. Setting the Time
        1. Time Zones
        2. Network Time
      6. Scheduling Recurring Tasks with cron
        1. Installing Crontab Files
        2. System Crontab Files
      7. Scheduling One-Time Tasks with at
      8. Tracking Individual Processes
        1. Finding Open Files with lsof
        2. Tracing Program Execution with strace and ltrace
      9. Adjusting Process Priorities
      10. Monitoring System Performance
      11. Running Commands as the Superuser
        1. Real UID and Effective UID
    6. 5. CONFIGURING YOUR NETWORK
      1. Network Layers
      2. The Internet Layer
        1. More on Subnets
      3. Basic ICMP Tools
      4. Configuring Interfaces and the Host-to-Network Layer
      5. Configuring a Default Gateway
      6. Resolving Hostnames
      7. Using DHCP Clients
      8. PPP Connections
        1. Testing Your Serial Port and Modem
        2. Starting pppd with Options Files
        3. Chat Scripts
        4. PAP and CHAP
          1. PAP
          2. CHAP
        5. Options Files
        6. PPP Directory Permissions
      9. Broadband Connections
        1. Routers
        2. PPP Over Ethernet (PPPoE)
      10. Ethernet Networks
        1. Ethernet and IP
        2. Private Networks
      11. Configuring Routes
      12. The Transport Layer: TCP, UDP, and Services
      13. Firewalls
        1. Firewall Strategies
        2. IP Tables Reference
      14. Network Address Translation (IP Masquerading)
      15. Wireless Ethernet
        1. A Lecture on Wireless Security
    7. 6. NETWORK SERVICES
      1. The Basics of Services
      2. Stand-Alone Servers
      3. The inetd Daemon
        1. TCP Wrapper: tcpd, /etc/hosts.allow, /etc/hosts.deny
        2. xinetd
      4. Secure Shell (SSH)
        1. Installing OpenSSH
        2. The SSHD Server
          1. Host Keys
          2. Starting the SSH Server
        3. The SSH Client
          1. SSH File Transfer Clients
          2. SSH Clients for Non-Unix Platforms
      5. Diagnostic Tools
        1. lsof
        2. tcpdump
        3. Netcat
      6. Remote Procedure Call (RPC)
      7. Network Security
        1. Where Linux Distributions Stand
        2. Typical Vulnerabilities
        3. Port Scanning
        4. Security Resources
    8. 7. INTRODUCTION TO SHELL SCRIPTS
      1. Shell Script Basics
        1. Limitations of Shell Scripts
      2. Quoting
      3. Special Variables
        1. $1, $2, ...
        2. $#
        3. $@
        4. $0
        5. $$
        6. $?
      4. Exit Codes
      5. Conditionals
        1. && and || Logical Constructs
        2. Testing Conditions
          1. File Tests
          2. String Tests
          3. Arithmetic Tests
        3. Matching Strings with case
      6. Loops
      7. Command Substitution
      8. Temporary File Management
      9. Here Documents
      10. Important Shell Script Utilities
        1. basename
        2. awk
        3. sed
        4. xargs
        5. expr
        6. exec
      11. Subshells
      12. Including Other Files in Scripts
      13. Reading User Input
      14. Too Much?
    9. 8. DEVELOPMENT TOOLS
      1. The C Compiler
        1. Multiple Source Files
        2. Header (Include) Files and Directories
          1. What Is the C Preprocessor (cpp)?
        3. Linking with Libraries
        4. Shared Libraries
          1. Listing Shared Library Dependencies
          2. How ld.so Finds Shared Libraries
          3. Linking Programs Against Shared Libraries
          4. Problems with Shared Libraries
        5. Make
          1. Staying Up to Date
          2. Command-Line Options
          3. Standard Macros and Variables
          4. Conventional Targets
          5. Organizing a Makefile
      2. Debuggers
      3. Lex and Yacc
      4. Scripting Languages
        1. Perl
        2. Python
        3. Other Scripting Languages
      5. Java
      6. Assembly Code and How a Compiler Works
    10. 9. COMPILING SOFTWARE FROM SOURCE CODE
      1. Unpacking Source Packages
        1. Where to Start
      2. GNU Autoconf
        1. configure Script Options
        2. Environment Variables
        3. Autoconf Targets
        4. Autoconf Log Files
      3. Other Systems
        1. Custom Makefiles
        2. Imake
          1. X Resource Files
        3. pkg-config
      4. Installation Practice
        1. Where to Install
          1. Encap
          2. Should You Compile Shared Libraries?
          3. Encap, pkg-config, and Shared Libraries
      5. Applying a Patch
      6. Troubleshooting Compiles and Installations
        1. Specific Errors
    11. 10. MAINTAINING THE KERNEL
      1. Do You Need to Build Your Own Kernel?
      2. What You Need to Build a Kernel
      3. Getting the Source Code
        1. Unpacking the Source Archive
        2. A Look Around the Kernel Source
        3. Distribution Kernels
      4. Configuring and Compiling the Kernel
            1. When Should You Compile a Driver as a Module?
        1. Configuration Options
          1. Code Maturity Level Options
          2. General Setup
          3. Loadable Module Support
          4. Processor Type and Features
          5. Power Management Options
          6. Bus Options
          7. Executable File Formats
          8. Device Drivers
            1. Plug and Play Support
            2. Block Devices
            3. ATA (IDE) Support
            4. SCSI Support
            5. Networking Support
            6. Input Device Support
            7. Character Devices and Parallel Port Support
            8. Sound
            9. USB Support
          9. Filesystems
        2. Compiling the Kernel and Modules
          1. Failed Compiles
        3. Installing Modules
        4. Kernel Parameters
      5. Installing Your Kernel with a Boot Loader
        1. Which Boot Loader?
        2. GRUB
          1. Root Device Confusion
          2. Booting Other Operating Systems
          3. Installing GRUB
        3. LILO
          1. LILO Parameters
        4. Initial RAM Disks
      6. Testing the Kernel
      7. Boot Floppies
      8. Working with Loadable Kernel Modules
        1. Kernel Module Loader
        2. modprobe Configuration
          1. Chaining Modules and the install Keyword
          2. Module Options
    12. 11. CONFIGURING AND MANIPULATING PERIPHERAL DEVICES
      1. Floppy Drives
        1. Floppy Images
        2. Low-Level Formatting a Floppy Disk
      2. CD Writers
        1. Verifying the Hardware
        2. Creating a Filesystem Image and Writing a CD
          1. Using a Temporary Disk Image
          2. Using a Pipeline
      3. Introduction to USB
        1. USB Device Filesystem and Utilities
        2. USB Input Devices
        3. USB Digital Cameras, External Flash Media, and External Disks
          1. Flash Memory Filesystem Issues
      4. IEEE 1394/FireWire Disks
      5. Hotplug Support
      6. PC Cards (PCMCIA)
        1. When You Insert a Card
          1. /etc/pcmcia
          2. Configuration Options
          3. Auxiliary Configuration Scripts
        2. cardctl
      7. Approaching Other Devices
    13. 12. PRINTING
      1. PostScript
      2. Print Servers
      3. Print Filters
      4. Print Clients
        1. Network Printing
      5. CUPS
        1. Configuring cupsd
        2. CUPS Security
          1. Certificate Authentication (for Command-Line Utilities)
        3. Starting CUPS
        4. Adding and Editing Printers
          1. Adding a Test Printer
          2. Adding a Real Printer
        5. Printer Devices (Backend Specifications)
        6. PPD Files
        7. Specifying a Filter
          1. CUPS Filters and mime.convs
          2. Specifying a Backend Filter in the PPD File
        8. Foomatic (for Non-PostScript Printers)
          1. Testing Foomatic
        9. Administrative Command Overview
        10. Client Access Control
        11. Auto-Discovery
        12. Running an LPD-Compatible Server
        13. Troubleshooting CUPS
          1. Error Messages
          2. Filter Problems
          3. Spool Directory Permission Errors
          4. Device Problems
      6. Ghostscript
        1. Command-Line Options
        2. More Ghostscript Tricks
        3. HP Inkjet Server
      7. Further Printing Topics
    14. 13. BACKUPS
      1. What Should You Back Up?
      2. Backup Hardware
      3. Full and Incremental Backups
      4. Using tar for Backups and Restores
        1. Creating Archives
        2. Incremental Backups with tar
        3. Extracting Archives
      5. Backups to Non-Traditional Media
        1. Backups to Hard Disks
      6. Tape Drive Devices
        1. Working with Tape Drives
        2. Creating Archives on a Tape
        3. Reading from Tape
        4. Extracting Archives
        5. Moving Forward and Backing Up
        6. mt Commands and Status
        7. Direct File Access
      7. Other Archivers
        1. Dump and Restore
          1. Dump
          2. Restore
        2. cpio
          1. Creating Archives
          2. Testing and Extracting Archives
        3. Amanda Tapes
      8. Further Backup Topics
    15. 14. SHARING FILES WITH SAMBA
      1. Configuring the Server
        1. Server Access Control
        2. Passwords
          1. Adding and Deleting Users
          2. Changing Passwords
      2. Starting the Server
      3. Diagnostics and Log Files
      4. Sharing Files
        1. Home Directories
      5. Sharing Printers
        1. Sharing a Single Printer
      6. Using the Samba Client
        1. Accessing Files
          1. Using the SMB Filesystem
        2. Printing to a Windows Share
          1. Sending Files Directly to a Printer Share
    16. 15. NETWORK FILE TRANSFER
      1. rsync Basics
        1. Making Exact Copies of a Directory Structure
        2. Using the Trailing Slash
        3. Excluding Files and Directories
      2. Checksums and Verbose Transfers
      3. Compression
      4. Limiting Bandwidth
      5. Transferring Files to Your Computer
      6. Further rsync Topics
    17. 16. USER ENVIRONMENTS
      1. Appropriate Startup Files
      2. Shell Startup File Elements
        1. The Command Path
          1. Adding Dot (.) to the Path
          2. The Manual Page Path
          3. The Prompt
          4. Aliases
          5. The Permissions Mask
        2. Startup File Order and Examples
          1. The bash Shell
            1. Checking for Login and Interactive Shells
          2. The tcsh Shell
        3. Default User Settings
          1. Shell
          2. Editor
          3. Pager
        4. Startup File Pitfalls
        5. Further Startup Topics
    18. 17. BUYING HARDWARE FOR LINUX
      1. Core Components
        1. Processor and Motherboard
        2. Memory
        3. Hard Disk
        4. Network Cards and Infrastructure
          1. Wireless Ethernet
        5. Graphics Hardware
      2. Other Hardware Components
        1. Monitors
        2. Keyboards
        3. Mice
        4. Modems
        5. Printers
      3. A Word About Hardware Upgrades
      4. Saving Money
        1. CPU
        2. Hard Disk
        3. Computer Case
        4. Video Card
      5. Notebooks
      6. Smaller Designs
    19. 18. FURTHER DIRECTIONS
      1. Additional Topics
      2. Final Thoughts
    20. A. Command Classification
    21. BIBLIOGRAPHY

Product information

  • Title: How Linux Works
  • Author(s): Brian Ward
  • Release date: May 2004
  • Publisher(s): No Starch Press
  • ISBN: 9781593270353