Unix Power Tools, 3rd Edition

Book description

With the growing popularity of Linux and the advent of Darwin, Unix has metamorphosed into something new and exciting. No longer perceived as a difficult operating system, more and more users are discovering the advantages of Unix for the first time. But whether you are a newcomer or a Unix power user, you'll find yourself thumbing through the goldmine of information in the new edition of Unix Power Tools to add to your store of knowledge. Want to try something new? Check this book first, and you're sure to find a tip or trick that will prevent you from learning things the hard way.The latest edition of this best-selling favorite is loaded with advice about almost every aspect of Unix, covering all the new technologies that users need to know. In addition to vital information on Linux, Darwin, and BSD, Unix Power Tools 3rd Edition now offers more coverage of bash, zsh, and other new shells, along with discussions about modern utilities and applications. Several sections focus on security and Internet access. And there is a new chapter on access to Unix from Windows, addressing the heterogeneous nature of systems today. You'll also find expanded coverage of software installation and packaging, as well as basic information on Perl and Python.Unix Power Tools 3rd Edition is a browser's book...like a magazine that you don't read from start to finish, but leaf through repeatedly until you realize that you've read it all. Bursting with cross-references, interesting sidebars explore syntax or point out other directions for exploration, including relevant technical details that might not be immediately apparent. The book includes articles abstracted from other O'Reilly books, new information that highlights program tricks and gotchas, tips posted to the Net over the years, and other accumulated wisdom.Affectionately referred to by readers as "the" Unix book, UNIX Power Tools provides access to information every Unix user is going to need to know. It will help you think creatively about UNIX, and will help you get to the point where you can analyze your own problems. Your own solutions won't be far behind.

Publisher resources

View/Submit Errata

Table of contents

  1. UNIX Power Tools, 3rd Edition
  2. A Note Regarding Supplemental Files
  3. How to Use This Book
  4. Preface
    1. A Book for Browsing
    2. Like an Almanac
    3. Like a News Magazine
    4. Like a Hypertext Database
    5. Programs on the Web
    6. About Unix Versions
    7. Cross-References
    8. What’s New in the Third Edition
    9. Typefaces and Other Conventions
    10. The Authors
    11. The Fine Print
    12. Request for Comments
    13. Acknowledgments for the First Edition
    14. Acknowledgments for the Second Edition
    15. Acknowledgments for the Third Edition
  5. I. Basic Unix Environment
    1. 1. Introduction
      1. 1.1. What’s Special About Unix?
      2. 1.2. Power Grows on You
      3. 1.3. The Core of Unix
      4. 1.4. Communication with Unix
      5. 1.5. Programs Are Designed to Work Together
      6. 1.6. There Are Many Shells
      7. 1.7. Which Shell Am I Running?
      8. 1.8. Anyone Can Program the Shell
      9. 1.9. Internal and External Commands
      10. 1.10. The Kernel and Daemons
      11. 1.11. Filenames
      12. 1.12. Filename Extensions
      13. 1.13. Wildcards
      14. 1.14. The Tree Structure of the Filesystem
      15. 1.15. Your Home Directory
      16. 1.16. Making Pathnames
      17. 1.17. File Access Permissions
      18. 1.18. The Superuser (Root)
      19. 1.19. When Is a File Not a File?
      20. 1.20. Scripting
      21. 1.21. Unix Networking and Communications
      22. 1.22. The X Window System
    2. 2. Getting Help
      1. 2.1. The man Command
      2. 2.2. whatis: One-Line Command Summaries
      3. 2.3. whereis: Finding Where a Command Is Located
      4. 2.4. Searching Online Manual Pages
      5. 2.5. How Unix Systems Remember Their Names
      6. 2.6. Which Version Am I Using?
      7. 2.7. What tty Am I On?
      8. 2.8. Who’s On?
      9. 2.9. The info Command
  6. II. Customizing Your Environment
    1. 3. Setting Up Your Unix Shell
      1. 3.1. What Happens When You Log In
      2. 3.2. The Mac OS X Terminal Application
      3. 3.3. Shell Setup Files — Which, Where, and Why
      4. 3.4. Login Shells, Interactive Shells
        1. 3.4.1. Login Shells
        2. 3.4.2. Interactive Shells
      5. 3.5. What Goes in Shell Setup Files?
      6. 3.6. Tip for Changing Account Setup: Keep a Shell Ready
      7. 3.7. Use Absolute Pathnames in Shell Setup Files
      8. 3.8. Setup Files Aren’t Read When You Want?
      9. 3.9. Gotchas in set prompt Test
      10. 3.10. Automatic Setups for Different Terminals
      11. 3.11. Terminal Setup: Testing TERM
      12. 3.12. Terminal Setup: Testing Remote Hostname and X Display
      13. 3.13. Terminal Setup: Testing Port
      14. 3.14. Terminal Setup: Testing Environment Variables
      15. 3.15. Terminal Setup: Searching Terminal Table
      16. 3.16. Terminal Setup: Testing Window Size
      17. 3.17. Terminal Setup: Setting and Testing Window Name
      18. 3.18. A .cshrc.$HOST File for Per Host Setup
      19. 3.19. Making a “Login” Shell
      20. 3.20. RC Files
      21. 3.21. Make Your Own Manpages Without Learning troff
      22. 3.22. Writing a Simple Manpage with the -man Macros
    2. 4. Interacting with Your Environment
      1. 4.1. Basics of Setting the Prompt
      2. 4.2. Static Prompts
      3. 4.3. Dynamic Prompts
      4. 4.4. Simulating Dynamic Prompts
      5. 4.5. C-Shell Prompt Causes Problems in vi, rsh, etc.
      6. 4.6. Faster Prompt Setting with Built-ins
      7. 4.7. Multiline Shell Prompts
      8. 4.8. Session Info in Window Title or Status Line
      9. 4.9. A “Menu Prompt” for Naive Users
      10. 4.10. Highlighting and Color in Shell Prompts
      11. 4.11. Right-Side Prompts
      12. 4.12. Show Subshell Level with $SHLVL
      13. 4.13. What Good Is a Blank Shell Prompt?
      14. 4.14. dirs in Your Prompt: Better Than $cwd
      15. 4.15. External Commands Send Signals to Set Variables
      16. 4.16. Preprompt, Pre-execution, and Periodic Commands
      17. 4.17. Running Commands When You Log Out
      18. 4.18. Running Commands at Bourne/Korn Shell Logout
      19. 4.19. Stop Accidental Bourne-Shell Logouts
    3. 5. Getting the Most out of Terminals, xterm, and X Windows
      1. 5.1. There’s a Lot to Know About Terminals
      2. 5.2. The Idea of a Terminal Database
      3. 5.3. Setting the Terminal Type When You Log In
      4. 5.4. Querying Your Terminal Type: qterm
      5. 5.5. Querying Your xterm Size: resize
      6. 5.6. Checklist: Terminal Hangs When I Log In
        1. 5.6.1. Output Stopped?
        2. 5.6.2. Job Stopped?
        3. 5.6.3. Program Waiting for Input?
        4. 5.6.4. Stalled Data Connection?
        5. 5.6.5. Aborting Programs
      7. 5.7. Find Out Terminal Settings with stty
      8. 5.8. Setting Your Erase, Kill, and Interrupt Characters
      9. 5.9. Working with xterm and Friends
      10. 5.10. Login xterms and rxvts
      11. 5.11. Working with Scrollbars
      12. 5.12. How Many Lines to Save?
      13. 5.13. Simple Copy and Paste in xterm
      14. 5.14. Defining What Makes Up a Word for Selection Purposes
      15. 5.15. Setting the Titlebar and Icon Text
      16. 5.16. The Simple Way to Pick a Font
      17. 5.17. The xterm Menus
      18. 5.18. Changing Fonts Dynamically
        1. 5.18.1. VT Fonts Menu
        2. 5.18.2. Enabling Escape Sequence and Selection
      19. 5.19. Working with xclipboard
      20. 5.20. Problems with Large Selections
      21. 5.21. Tips for Copy and Paste Between Windows
      22. 5.22. Running a Single Command with xterm -e
      23. 5.23. Don’t Quote Arguments to xterm -e
    4. 6. Your X Environment
      1. 6.1. Defining Keys and Button Presses with xmodmap
      2. 6.2. Using xev to Learn Keysym Mappings
      3. 6.3. X Resource Syntax
      4. 6.4. X Event Translations
      5. 6.5. Setting X Resources: Overview
      6. 6.6. Setting Resources with the -xrm Option
      7. 6.7. How -name Affects Resources
      8. 6.8. Setting Resources with xrdb
      9. 6.9. Listing the Current Resources for a Client: appres
      10. 6.10. Starting Remote X Clients
        1. 6.10.1. Starting Remote X Clients from Interactive Logins
        2. 6.10.2. Starting a Remote Client with rsh and ssh
  7. III. Working with Files and Directories
    1. 7. Directory Organization
      1. 7.1. What? Me, Organized?
      2. 7.2. Many Homes
      3. 7.3. Access to Directories
      4. 7.4. A bin Directory for Your Programs and Scripts
      5. 7.5. Private (Personal) Directories
      6. 7.6. Naming Files
      7. 7.7. Make More Directories!
      8. 7.8. Making Directories Made Easier
    2. 8. Directories and Files
      1. 8.1. Everything but the find Command
      2. 8.2. The Three Unix File Times
      3. 8.3. Finding Oldest or Newest Files with ls -t and ls -u
      4. 8.4. List All Subdirectories with ls -R
      5. 8.5. The ls -d Option
      6. 8.6. Color ls
        1. 8.6.1. Trying It
        2. 8.6.2. Configuring It
        3. 8.6.3. The -- color Option
        4. 8.6.4. Another color ls
      7. 8.7. Some GNU ls Features
      8. 8.8. A csh Alias to List Recently Changed Files
      9. 8.9. Showing Hidden Files with ls -A and -a
      10. 8.10. Useful ls Aliases
      11. 8.11. Can’t Access a File? Look for Spaces in the Name
      12. 8.12. Showing Nonprintable Characters in Filenames
      13. 8.13. Counting Files by Types
      14. 8.14. Listing Files by Age and Size
      15. 8.15. newer: Print the Name of the Newest File
      16. 8.16. oldlinks: Find Unconnected Symbolic Links
      17. 8.17. Picking a Unique Filename Automatically
    3. 9. Finding Files with find
      1. 9.1. How to Use find
      2. 9.2. Delving Through a Deep Directory Tree
      3. 9.3. Don’t Forget -print
      4. 9.4. Looking for Files with Particular Names
      5. 9.5. Searching for Old Files
      6. 9.6. Be an Expert on find Search Operators
      7. 9.7. The Times That find Finds
      8. 9.8. Exact File-Time Comparisons
      9. 9.9. Running Commands on What You Find
      10. 9.10. Using -exec to Create Custom Tests
      11. 9.11. Custom -exec Tests Applied
      12. 9.12. Finding Many Things with One Command
      13. 9.13. Searching for Files by Type
      14. 9.14. Searching for Files by Size
      15. 9.15. Searching for Files by Permission
      16. 9.16. Searching by Owner and Group
      17. 9.17. Duplicating a Directory Tree
      18. 9.18. Using “Fast find” Databases
      19. 9.19. Wildcards with “Fast find” Database
      20. 9.20. Finding Files (Much) Faster with a find Database
      21. 9.21. grepping a Directory Tree
      22. 9.22. lookfor: Which File Has That Word?
      23. 9.23. Using Shell Arrays to Browse Directories
        1. 9.23.1. Using the Stored Lists
        2. 9.23.2. Expanding Ranges
      24. 9.24. Finding the (Hard) Links to a File
      25. 9.25. Finding Files with -prune
      26. 9.26. Quick finds in the Current Directory
      27. 9.27. Skipping Parts of a Tree in find
      28. 9.28. Keeping find from Searching Networked Filesystem
    4. 10. Linking, Renaming, and Copying Files
      1. 10.1. What’s So Complicated About Copying Files
      2. 10.2. What’s Really in a Directory?
      3. 10.3. Files with Two or More Names
      4. 10.4. More About Links
        1. 10.4.1. Differences Between Hard and Symbolic Links
        2. 10.4.2. Links to a Directory
      5. 10.5. Creating and Removing Links
      6. 10.6. Stale Symbolic Links
      7. 10.7. Linking Directories
      8. 10.8. Showing the Actual Filenames for Symbolic Links
      9. 10.9. Renaming, Copying, or Comparing a Set of Files
      10. 10.10. Renaming a List of Files Interactively
      11. 10.11. One More Way to Do It
      12. 10.12. Copying Directory Trees with cp -r
      13. 10.13. Copying Directory Trees with tar and Pipes
    5. 11. Comparing Files
      1. 11.1. Checking Differences with diff
      2. 11.2. Comparing Three Different Versions with diff3
      3. 11.3. Context diffs
      4. 11.4. Side-by-Side diffs: sdiff
      5. 11.5. Choosing Sides with sdiff
      6. 11.6. Problems with diff and Tabstops
      7. 11.7. cmp and diff
      8. 11.8. Comparing Two Files with comm
      9. 11.9. More Friendly comm Output
      10. 11.10. make Isn’t Just for Programmers!
      11. 11.11. Even More Uses for make
    6. 12. Showing What’s in a File
      1. 12.1. Cracking the Nut
      2. 12.2. What Good Is a cat?
      3. 12.3. “less” is More
      4. 12.4. Show Nonprinting Characters with cat -v or od -c
      5. 12.5. What’s in That Whitespace?
      6. 12.6. Finding File Types
      7. 12.7. Squash Extra Blank Lines
      8. 12.8. How to Look at the End of a File: tail
      9. 12.9. Finer Control on tail
      10. 12.10. How to Look at Files as They Grow
      11. 12.11. GNU tail File Following
      12. 12.12. Printing the Top of a File
      13. 12.13. Numbering Lines
    7. 13. Searching Through Files
      1. 13.1. Different Versions of grep
      2. 13.2. Searching for Text with grep
      3. 13.3. Finding Text That Doesn’t Match
      4. 13.4. Extended Searching for Text with egrep
      5. 13.5. grepping for a List of Patterns
      6. 13.6. Approximate grep: agrep
      7. 13.7. Search RCS Files with rcsgrep
        1. 13.7.1. rcsgrep, rcsegrep, rcsfgrep
        2. 13.7.2. rcsegrep.fast
      8. 13.8. GNU Context greps
      9. 13.9. A Multiline Context grep Using sed
      10. 13.10. Compound Searches
      11. 13.11. Narrowing a Search Quickly
      12. 13.12. Faking Case-Insensitive Searches
      13. 13.13. Finding a Character in a Column
      14. 13.14. Fast Searches and Spelling Checks with “look”
      15. 13.15. Finding Words Inside Binary Files
      16. 13.16. A Highlighting grep
    8. 14. Removing Files
      1. 14.1. The Cycle of Creation and Destruction
      2. 14.2. How Unix Keeps Track of Files: Inodes
      3. 14.3. rm and Its Dangers
      4. 14.4. Tricks for Making rm Safer
      5. 14.5. Answer “Yes” or “No” Forever with yes
      6. 14.6. Remove Some, Leave Some
      7. 14.7. A Faster Way to Remove Files Interactively
      8. 14.8. Safer File Deletion in Some Directories
      9. 14.9. Safe Delete: Pros and Cons
      10. 14.10. Deletion with Prejudice: rm -f
      11. 14.11. Deleting Files with Odd Names
      12. 14.12. Using Wildcards to Delete Files with Strange Names
      13. 14.13. Handling a Filename Starting with a Dash (-)
      14. 14.14. Using unlink to Remove a File with a Strange Name
      15. 14.15. Removing a Strange File by its i-number
      16. 14.16. Problems Deleting Directories
      17. 14.17. Deleting Stale Files
      18. 14.18. Removing Every File but One
      19. 14.19. Using find to Clear Out Unneeded Files
    9. 15. Optimizing Disk Space
      1. 15.1. Disk Space Is Cheap
      2. 15.2. Instead of Removing a File, Empty It
      3. 15.3. Save Space with “Bit Bucket” Log Files and Mailboxes
      4. 15.4. Save Space with a Link
      5. 15.5. Limiting File Sizes
        1. 15.5.1. limit and ulimit
        2. 15.5.2. Other Ideas
      6. 15.6. Compressing Files to Save Space
      7. 15.7. Save Space: tar and compress a Directory Tree
      8. 15.8. How Much Disk Space?
      9. 15.9. Compressing a Directory Tree: Fine-Tuning
      10. 15.10. Save Space in Executable Files with strip
      11. 15.11. Disk Quotas
  8. IV. Basic Editing
    1. 16. Spell Checking, Word Counting, and Textual Analysis
      1. 16.1. The Unix spell Command
      2. 16.2. Check Spelling Interactively with ispell
      3. 16.3. How Do I Spell That Word?
      4. 16.4. Inside spell
      5. 16.5. Adding Words to ispell’s Dictionary
      6. 16.6. Counting Lines, Words, and Characters: wc
      7. 16.7. Find a a Doubled Word
      8. 16.8. Looking for Closure
      9. 16.9. Just the Words, Please
    2. 17. vi Tips and Tricks
      1. 17.1. The vi Editor: Why So Much Material?
      2. 17.2. What We Cover
      3. 17.3. Editing Multiple Files with vi
      4. 17.4. Edits Between Files
      5. 17.5. Local Settings for vi
      6. 17.6. Using Buffers to Move or Copy Text
      7. 17.7. Get Back What You Deleted with Numbered Buffers
      8. 17.8. Using Search Patterns and Global Commands
        1. 17.8.1. Global Searches
      9. 17.9. Confirming Substitutions in vi
      10. 17.10. Keep Your Original File, Write to a New File
      11. 17.11. Saving Part of a File
      12. 17.12. Appending to an Existing File
      13. 17.13. Moving Blocks of Text by Patterns
      14. 17.14. Useful Global Commands (with Pattern Matches)
      15. 17.15. Counting Occurrences; Stopping Search Wraps
      16. 17.16. Capitalizing Every Word on a Line
      17. 17.17. Per-File Setups in Separate Files
      18. 17.18. Filtering Text Through a Unix Command
      19. 17.19. vi File Recovery Versus Networked Filesystems
      20. 17.20. Be Careful with vi -r Recovered Buffers
      21. 17.21. Shell Escapes: Running One UnixCommand While Using Another
      22. 17.22. vi Compound Searches
      23. 17.23. vi Word Abbreviation
      24. 17.24. Using vi Abbreviations as Commands (Cut and Paste Between vi’s)
      25. 17.25. Fixing Typos with vi Abbreviations
      26. 17.26. vi Line Commands Versus Character Commands
      27. 17.27. Out of Temporary Space? Use Another Directory
      28. 17.28. Neatening Lines
      29. 17.29. Finding Your Place with Undo
      30. 17.30. Setting Up vi with the .exrc File
    3. 18. Creating Custom Commands in vi
      1. 18.1. Why Type More Than You Have To?
      2. 18.2. Save Time and Typing with the vi map Commands
        1. 18.2.1. Command Mode Maps
        2. 18.2.2. Text-Input Mode Maps
      3. 18.3. What You Lose When You Use map!
      4. 18.4. vi @-Functions
        1. 18.4.1. Defining and Using Simple @-Functions
        2. 18.4.2. Combining @-Functions
        3. 18.4.3. Reusing a Definition
        4. 18.4.4. Newlines in an @-Function
      5. 18.5. Keymaps for Pasting into a Window Running vi
      6. 18.6. Protecting Keys from Interpretation by ex
      7. 18.7. Maps for Repeated Edits
      8. 18.8. More Examples of Mapping Keys in vi
      9. 18.9. Repeating a vi Keymap
      10. 18.10. Typing in Uppercase Without CAPS LOCK
      11. 18.11. Text-Input Mode Cursor Motion with No Arrow Keys
      12. 18.12. Don’t Lose Important Functions with vi Maps: Use noremap
      13. 18.13. vi Macro for Splitting Long Lines
      14. 18.14. File-Backup Macros
    4. 19. GNU Emacs
      1. 19.1. Emacs: The Other Editor
      2. 19.2. Emacs Features: A Laundry List
      3. 19.3. Customizations and How to Avoid Them
      4. 19.4. Backup and Auto-Save Files
      5. 19.5. Putting Emacs in Overwrite Mode
      6. 19.6. Command Completion
      7. 19.7. Mike’s Favorite Timesavers
      8. 19.8. Rational Searches
      9. 19.9. Unset PWD Before Using Emacs
      10. 19.10. Inserting Binary Characters into Files
      11. 19.11. Using Word-Abbreviation Mode
        1. 19.11.1. Trying Word Abbreviations for One Session
        2. 19.11.2. Making Word Abbreviations Part of Your Startup
      12. 19.12. Directories for Emacs Hacks
      13. 19.13. An Absurd Amusement
    5. 20. Batch Editing
      1. 20.1. Why Line Editors Aren’t Dinosaurs
      2. 20.2. Writing Editing Scripts
      3. 20.3. Line Addressing
      4. 20.4. Useful ex Commands
      5. 20.5. Running Editing Scripts Within vi
      6. 20.6. Change Many Files by Editing Just One
      7. 20.7. ed/ex Batch Edits: A Typical Example
      8. 20.8. Batch Editing Gotcha: Editors Fail on Big Files
      9. 20.9. patch: Generalized Updating of Files That Differ
      10. 20.10. Quick Reference: awk
        1. 20.10.1. Command-Line Syntax
        2. 20.10.2. Patterns and Procedures
          1. 20.10.2.1. Patterns
          2. 20.10.2.2. Procedures
          3. 20.10.2.3. Simple pattern-procedure examples
        3. 20.10.3. awk System Variables
        4. 20.10.4. Operators
        5. 20.10.5. Variables and Array Assignments
        6. 20.10.6. Group Listing of awk Commands
        7. 20.10.7. Alphabetical Summary of Commands
      11. 20.11. Versions of awk
    6. 21. You Can’t Quite Call This Editing
      1. 21.1. And Why Not?
      2. 21.2. Neatening Text with fmt
      3. 21.3. Alternatives to fmt
      4. 21.4. Clean Up Program Comment Blocks
        1. 21.4.1. The recomment Script
        2. 21.4.2. fmt -p
      5. 21.5. Remove Mail/News Headers with behead
      6. 21.6. Low-Level File Butchery with dd
      7. 21.7. offset: Indent Text
      8. 21.8. Centering Lines in a File
      9. 21.9. Splitting Files at Fixed Points: split
      10. 21.10. Splitting Files by Context: csplit
      11. 21.11. Hacking on Characters with tr
      12. 21.12. Encoding “Binary” Files into ASCII
        1. 21.12.1. uuencoding
        2. 21.12.2. MIME Encoding
      13. 21.13. Text Conversion with dd
      14. 21.14. Cutting Columns or Fields
      15. 21.15. Making Text in Columns with pr
        1. 21.15.1. One File per Column: -m
        2. 21.15.2. One File, Several Columns: -number
        3. 21.15.3. Order Lines Across Columns: -l
      16. 21.16. Make Columns Automatically with column
      17. 21.17. Straightening Jagged Columns
      18. 21.18. Pasting Things in Columns
      19. 21.19. Joining Lines with join
      20. 21.20. What Is (or Isn’t) Unique?
      21. 21.21. Rotating Text
    7. 22. Sorting
      1. 22.1. Putting Things in Order
      2. 22.2. Sort Fields: How sort Sorts
      3. 22.3. Changing the sort Field Delimiter
      4. 22.4. Confusion with Whitespace Field Delimiters
      5. 22.5. Alphabetic and Numeric Sorting
      6. 22.6. Miscellaneous sort Hints
        1. 22.6.1. Dealing with Repeated Lines
        2. 22.6.2. Ignoring Blanks
        3. 22.6.3. Case-Insensitive Sorts
        4. 22.6.4. Dictionary Order
        5. 22.6.5. Month Order
        6. 22.6.6. Reverse Sort
      7. 22.7. lensort: Sort Lines by Length
      8. 22.8. Sorting a List of People by Last Name
  9. V. Processes and the Kernel
    1. 23. Job Control
      1. 23.1. Job Control in a Nutshell
      2. 23.2. Job Control Basics
        1. 23.2.1. How Job Control Works
        2. 23.2.2. Using Job Control from Your Shell
      3. 23.3. Using jobs Effectively
      4. 23.4. Some Gotchas with Job Control
      5. 23.5. The “Current Job” Isn’t Always What You Expect
      6. 23.6. Job Control and autowrite: Real Timesavers!
      7. 23.7. System Overloaded? Try Stopping Some Jobs
      8. 23.8. Notification When Jobs Change State
      9. 23.9. Stop Background Output with stty tostop
      10. 23.10. nohup
      11. 23.11. Disowning Processes
      12. 23.12. Linux Virtual Consoles
        1. 23.12.1. What Are They?
        2. 23.12.2. Scrolling, Using a Mouse
      13. 23.13. Stopping Remote Login Sessions
    2. 24. Starting, Stopping, and Killing Processes
      1. 24.1. What’s in This Chapter
      2. 24.2. fork and exec
      3. 24.3. Managing Processes: Overall Concepts
      4. 24.4. Subshells
      5. 24.5. The ps Command
      6. 24.6. The Controlling Terminal
      7. 24.7. Tracking Down Processes
        1. 24.7.1. System V
        2. 24.7.2. BSD
      8. 24.8. Why ps Prints Some Commands in Parentheses
      9. 24.9. The /proc Filesystem
        1. 24.9.1. Memory Information
        2. 24.9.2. Kernel and System Statistics
        3. 24.9.3. Statistics of the Current Process
        4. 24.9.4. Statistics of Processes by PID
        5. 24.9.5. A Glimpse at Hardware
      10. 24.10. What Are Signals?
      11. 24.11. Killing Foreground Jobs
      12. 24.12. Destroying Processes with kill
      13. 24.13. Printer Queue Watcher: A Restartable Daemon Shell Script
      14. 24.14. Killing All Your Processes
      15. 24.15. Killing Processes by Name?
      16. 24.16. Kill Processes Interactively
        1. 24.16.1. killall -i
        2. 24.16.2. zap
      17. 24.17. Processes Out of Control? Just STOP Them
      18. 24.18. Cleaning Up an Unkillable Process
      19. 24.19. Why You Can’t Kill a Zombie
      20. 24.20. The Process Chain to Your Window
      21. 24.21. Terminal Windows Without Shells
      22. 24.22. Close a Window by Killing Its Process(es)
        1. 24.22.1. Example #1: An xterm Window
        2. 24.22.2. Example #2: A Web Browser
        3. 24.22.3. Closing a Window from a Shell Script
    3. 25. Delayed Execution
      1. 25.1. Building Software Robots the Easy Way
      2. 25.2. Periodic Program Execution: The cron Facility
        1. 25.2.1. Execution Scheduling
        2. 25.2.2. A Little Help, etc.
      3. 25.3. Adding crontab Entries
      4. 25.4. Including Standard Input Within a cron Entry
      5. 25.5. The at Command
      6. 25.6. Making Your at Jobs Quiet
      7. 25.7. Checking and Removing Jobs
      8. 25.8. Avoiding Other at and cron Jobs
      9. 25.9. Waiting a Little While: sleep
    4. 26. System Performance and Profiling
      1. 26.1. Timing Is Everything
      2. 26.2. Timing Programs
      3. 26.3. What Commands Are Running and How Long Do They Take?
      4. 26.4. Checking System Load: uptime
      5. 26.5. Know When to Be “nice” to Other Users...and When Not To
        1. 26.5.1. BSD C Shell nice
        2. 26.5.2. BSD Standalone nice
        3. 26.5.3. System V C Shell nice
        4. 26.5.4. System V Standalone nice
      6. 26.6. A nice Gotcha
      7. 26.7. Changing a Running Job’s Niceness
  10. VI. Scripting
    1. 27. Shell Interpretation
      1. 27.1. What the Shell Does
      2. 27.2. How the Shell Executes Other Commands
      3. 27.3. What’s a Shell, Anyway?
        1. 27.3.1. How Shells Run Other Programs
        2. 27.3.2. Interactive Use Versus Shell Scripts
        3. 27.3.3. Types of Shells
        4. 27.3.4. Shell Search Paths
        5. 27.3.5. Bourne Shell Used Here
        6. 27.3.6. Default Commands
      4. 27.4. Command Evaluation and Accidentally Overwriting Files
      5. 27.5. Output Command-Line Arguments One by One
      6. 27.6. Controlling Shell Command Searches
      7. 27.7. Wildcards Inside Aliases
      8. 27.8. eval: When You Need Another Chance
      9. 27.9. Which One Will bash Use?
      10. 27.10. Which One Will the C Shell Use?
      11. 27.11. Is It “2>&1 file” or “> file 2>&1”? Why?
      12. 27.12. Bourne Shell Quoting
        1. 27.12.1. Special Characters
        2. 27.12.2. How Quoting Works
        3. 27.12.3. Single Quotes Inside Single Quotes?
        4. 27.12.4. Multiline Quoting
      13. 27.13. Differences Between Bourne and C Shell Quoting
        1. 27.13.1. Special Characters
        2. 27.13.2. How Quoting Works
      14. 27.14. Quoting Special Characters in Filenames
      15. 27.15. Verbose and Echo Settings Show Quoting
      16. 27.16. Here Documents
      17. 27.17. “Special” Characters and Operators
      18. 27.18. How Many Backslashes?
    2. 28. Saving Time on the Command Line
      1. 28.1. What’s Special About the Unix Command Line
      2. 28.2. Reprinting Your Command Line with CTRL-r
      3. 28.3. Use Wildcards to Create Files?
      4. 28.4. Build Strings with { }
      5. 28.5. String Editing (Colon) Operators
      6. 28.6. Automatic Completion
        1. 28.6.1. General Example: Filename Completion
        2. 28.6.2. Menu Completion
        3. 28.6.3. Command-Specific Completion
        4. 28.6.4. Editor Functions for Completion
      7. 28.7. Don’t Match Useless Files in Filename Completion
      8. 28.8. Repeating Commands
      9. 28.9. Repeating and Varying Commands
        1. 28.9.1. A foreach Loop
        2. 28.9.2. A for Loop
      10. 28.10. Repeating a Command with Copy-and-Paste
      11. 28.11. Repeating a Time-Varying Command
      12. 28.12. Multiline Commands, Secondary Prompts
      13. 28.13. Here Document Example #1: Unformatted Form Letters
      14. 28.14. Command Substitution
      15. 28.15. Handling Lots of Text with Temporary Files
      16. 28.16. Separating Commands with Semicolons
      17. 28.17. Dealing with Too Many Arguments
      18. 28.18. Expect
        1. 28.18.1. Dialback
        2. 28.18.2. Automating /bin/passwd
        3. 28.18.3. Testing: A Story
        4. 28.18.4. Other Problems
    3. 29. Custom Commands
      1. 29.1. Creating Custom Commands
      2. 29.2. Introduction to Shell Aliases
      3. 29.3. C-Shell Aliases with Command-Line Arguments
      4. 29.4. Setting and Unsetting Bourne-Type Aliases
      5. 29.5. Korn-Shell Aliases
      6. 29.6. zsh Aliases
      7. 29.7. Sourceable Scripts
      8. 29.8. Avoiding C-Shell Alias Loops
      9. 29.9. How to Put if-then-else in a C-Shell Alias
      10. 29.10. Fix Quoting in csh Aliases with makealias and quote
      11. 29.11. Shell Function Basics
        1. 29.11.1. Simple Functions: ls with Options
        2. 29.11.2. Functions with Loops: Internet Lookup
        3. 29.11.3. Setting Current Shell Environment: The work Function
        4. 29.11.4. Functions Calling Functions: Factorials
        5. 29.11.5. Conclusion
      12. 29.12. Shell Function Specifics
      13. 29.13. Propagating Shell Functions
        1. 29.13.1. Exporting bash Functions
        2. 29.13.2. FPATH Search Path
          1. 29.13.2.1. Korn shell
          2. 29.13.2.2. zsh
      14. 29.14. Simulated Bourne Shell Functions and Aliases
    4. 30. The Use of History
      1. 30.1. The Lessons of History
      2. 30.2. History in a Nutshell
      3. 30.3. My Favorite Is !$
      4. 30.4. My Favorite Is !:n*
      5. 30.5. My Favorite Is ^^
      6. 30.6. Using !$ for Safety with Wildcards
      7. 30.7. History by Number
      8. 30.8. History Substitutions
      9. 30.9. Repeating a Cycle of Commands
      10. 30.10. Running a Series of Commands on a File
      11. 30.11. Check Your History First with :p
      12. 30.12. Picking Up Where You Left Off
        1. 30.12.1. bash, ksh, zsh
        2. 30.12.2. C Shells
      13. 30.13. Pass History to Another Shell
      14. 30.14. Shell Command-Line Editing
        1. 30.14.1. vi Editing Mode
        2. 30.14.2. Emacs Editing Mode
        3. 30.14.3. tcsh Editing
        4. 30.14.4. ksh Editing
        5. 30.14.5. bash Editing
        6. 30.14.6. zsh Editing
      15. 30.15. Changing History Characters with histchars
      16. 30.16. Instead of Changing History Characters
    5. 31. Moving Around in a Hurry
      1. 31.1. Getting Around the Filesystem
      2. 31.2. Using Relative and Absolute Pathnames
      3. 31.3. What Good Is a Current Directory?
      4. 31.4. How Does Unix Find Your Current Directory?
      5. 31.5. Saving Time When You Change Directories: cdpath
      6. 31.6. Loop Control: break and continue
      7. 31.7. The Shells’ pushd and popd Commands
      8. 31.8. Nice Aliases for pushd
      9. 31.9. Quick cds with Aliases
      10. 31.10. cd by Directory Initials
      11. 31.11. Finding (Anyone’s) Home Directory, Quickly
      12. 31.12. Marking Your Place with a Shell Variable
      13. 31.13. Automatic Setup When You Enter/Exit a Directory
    6. 32. Regular Expressions (Pattern Matching)
      1. 32.1. That’s an Expression
      2. 32.2. Don’t Confuse Regular Expressions with Wildcards
      3. 32.3. Understanding Expressions
      4. 32.4. Using Metacharacters in Regular Expressions
      5. 32.5. Regular Expressions: The Anchor Characters ^ and $
      6. 32.6. Regular Expressions: Matching a Character with a Character Set
      7. 32.7. Regular Expressions: Match Any Character with . (Dot)
      8. 32.8. Regular Expressions: Specifying a Range of Characters with [...]
      9. 32.9. Regular Expressions: Exceptions in a Character Set
      10. 32.10. Regular Expressions: Repeating Character Sets with *
      11. 32.11. Regular Expressions: Matching a Specific Number of Sets with \ { and \ }
      12. 32.12. Regular Expressions: Matching Words with \ < and \ >
      13. 32.13. Regular Expressions: Remembering Patterns with \ (, \ ), and \1
      14. 32.14. Regular Expressions: Potential Problems
      15. 32.15. Extended Regular Expressions
      16. 32.16. Getting Regular Expressions Right
      17. 32.17. Just What Does a Regular Expression Match?
      18. 32.18. Limiting the Extent of a Match
      19. 32.19. I Never Meta Character I Didn’t Like
      20. 32.20. Valid Metacharacters for Different Unix Programs
      21. 32.21. Pattern Matching Quick Reference with Examples
        1. 32.21.1. Examples of Searching
        2. 32.21.2. Examples of Searching and Replacing
    7. 33. Wildcards
      1. 33.1. File-Naming Wildcards
      2. 33.2. Filename Wildcards in a Nutshell
      3. 33.3. Who Handles Wildcards?
      4. 33.4. What if a Wildcard Doesn’t Match?
      5. 33.5. Maybe You Shouldn’t Use Wildcards in Pathnames
      6. 33.6. Getting a List of Matching Files with grep -l
      7. 33.7. Getting a List of Nonmatching Files
        1. 33.7.1. Using grep -c
        2. 33.7.2. The vgrep Script
      8. 33.8. nom: List Files That Don’t Match a Wildcard
    8. 34. The sed Stream Editor
      1. 34.1. sed Sermon^H^H^H^H^H^HSummary
      2. 34.2. Two Things You Must Know About sed
      3. 34.3. Invoking sed
      4. 34.4. Testing and Using a sed Script: checksed, runsed
        1. 34.4.1. checksed
        2. 34.4.2. runsed
      5. 34.5. sed Addressing Basics
      6. 34.6. Order of Commands in a Script
      7. 34.7. One Thing at a Time
      8. 34.8. Delimiting a Regular Expression
      9. 34.9. Newlines in a sed Replacement
      10. 34.10. Referencing the Search String in a Replacement
      11. 34.11. Referencing Portions of a Search String
      12. 34.12. Search and Replacement: One Match Among Many
      13. 34.13. Transformations on Text
      14. 34.14. Hold Space: The Set-Aside Buffer
      15. 34.15. Transforming Part of a Line
      16. 34.16. Making Edits Across Line Boundaries
      17. 34.17. The Deliberate Scrivener
      18. 34.18. Searching for Patterns Split Across Lines
      19. 34.19. Multiline Delete
      20. 34.20. Making Edits Everywhere Except...
      21. 34.21. The sed Test Command
      22. 34.22. Uses of the sed Quit Command
      23. 34.23. Dangers of the sed Quit Command
      24. 34.24. sed Newlines, Quoting, and Backslashes in a Shell Script
    9. 35. Shell Programming for the Uninitiated
      1. 35.1. Writing a Simple Shell Program
      2. 35.2. Everyone Should Learn Some Shell Programming
      3. 35.3. What Environment Variables Are Good For
      4. 35.4. Parent-Child Relationships
      5. 35.5. Predefined Environment Variables
      6. 35.6. The PATH Environment Variable
      7. 35.7. PATH and path
      8. 35.8. The DISPLAY Environment Variable
      9. 35.9. Shell Variables
      10. 35.10. Test String Values with Bourne-Shell case
      11. 35.11. Pattern Matching in case Statements
      12. 35.12. Exit Status of Unix Processes
      13. 35.13. Test Exit Status with the if Statement
      14. 35.14. Testing Your Success
      15. 35.15. Loops That Test Exit Status
        1. 35.15.1. Looping Until a Command Succeeds
        2. 35.15.2. Looping Until a Command Fails
      16. 35.16. Set Exit Status of a Shell (Script)
      17. 35.17. Trapping Exits Caused by Interrupts
      18. 35.18. read: Reading from the Keyboard
      19. 35.19. Shell Script “Wrappers” for awk, sed, etc.
      20. 35.20. Handling Command-Line Arguments in Shell Scripts
        1. 35.20.1. With the “$@” Parameter
        2. 35.20.2. With a Loop
        3. 35.20.3. Counting Arguments with $#
      21. 35.21. Handling Command-Line Arguments with a for Loop
      22. 35.22. Handling Arguments with while and shift
      23. 35.23. Loop Control: break and continue
      24. 35.24. Standard Command-Line Parsing
      25. 35.25. The Bourne Shell set Command
        1. 35.25.1. Setting Options
        2. 35.25.2. Setting (and Parsing) Parameters
        3. 35.25.3. (Avoiding?) set with No Arguments
        4. 35.25.4. Watch Your Quoting
        5. 35.25.5. Can’t Set $0
      26. 35.26. test: Testing Files and Strings
      27. 35.27. Picking a Name for a New Command
      28. 35.28. Finding a Program Name and Giving Your Program Multiple Names
      29. 35.29. Reading Files with the . and source Commands
      30. 35.30. Using Shell Functions in Shell Scripts
    10. 36. Shell Programming for the Initiated
      1. 36.1. Beyond the Basics
      2. 36.2. The Story of : # #!
      3. 36.3. Don’t Need a Shell for Your Script? Don’t Use One
      4. 36.4. Making #! Search the PATH
      5. 36.5. The exec Command
      6. 36.6. The Unappreciated Bourne Shell “:” Operator
      7. 36.7. Parameter Substitution
      8. 36.8. Save Disk Space and Programming: Multiple Names for a Program
      9. 36.9. Finding the Last Command-Line Argument
      10. 36.10. How to Unset All Command-Line Parameters
      11. 36.11. Standard Input to a for Loop
      12. 36.12. Making a for Loop with Multiple Variables
      13. 36.13. Using basename and dirname
        1. 36.13.1. Introduction to basename and dirname
        2. 36.13.2. Use with Loops
      14. 36.14. A while Loop with Several Loop Control Commands
      15. 36.15. Overview: Open Files and File Descriptors
      16. 36.16. n>&m: Swap Standard Output and Standard Error
      17. 36.17. A Shell Can Read a Script from Its Standard Input, but...
      18. 36.18. Shell Scripts On-the-Fly from Standard Input
      19. 36.19. Quoted hereis Document Terminators: sh Versus csh
      20. 36.20. Turn Off echo for “Secret” Answers
      21. 36.21. Quick Reference: expr
        1. 36.21.1. Syntax
        2. 36.21.2. Examples
      22. 36.22. Testing Characters in a String with expr
      23. 36.23. Grabbing Parts of a String
        1. 36.23.1. Matching with expr
        2. 36.23.2. Using echo with awk or cut
        3. 36.23.3. Using set and IFS
        4. 36.23.4. Using sed
      24. 36.24. Nested Command Substitution
      25. 36.25. Testing Two Strings with One case Statement
      26. 36.26. Outputting Text to an X Window
      27. 36.27. Shell Lockfile
    11. 37. Shell Script Debugging and Gotchas
      1. 37.1. Tips for Debugging Shell Scripts
        1. 37.1.1. Use -xv
        2. 37.1.2. Unmatched Operators
        3. 37.1.3. Exit Early
        4. 37.1.4. Missing or Extra esac, ;;, fi, etc.
        5. 37.1.5. Line Numbers Reset Inside Redirected Loops
      2. 37.2. Bourne Shell Debugger Shows a Shell Variable
      3. 37.3. Stop Syntax Errors in Numeric Tests
      4. 37.4. Stop Syntax Errors in String Tests
      5. 37.5. Quoting and Command-Line Parameters
      6. 37.6. How Unix Keeps Time
      7. 37.7. Copy What You Do with script
      8. 37.8. Cleaning script Files
      9. 37.9. Making an Arbitrary-Size File for Testing
  11. VII. Extending and Managing Your Environment
    1. 38. Backing Up Files
      1. 38.1. What Is This “Backup” Thing?
      2. 38.2. tar in a Nutshell
      3. 38.3. Make Your Own Backups
      4. 38.4. More Ways to Back Up
      5. 38.5. How to Make Backups to a Local Device
        1. 38.5.1. What to Back Up
        2. 38.5.2. Backing Up to Tape
        3. 38.5.3. Backing Up to Floppies or Zip Disks
        4. 38.5.4. To gzip, or Not to gzip?
      6. 38.6. Restoring Files from Tape with tar
        1. 38.6.1. Restoring a Few Files
        2. 38.6.2. Remote Restoring
      7. 38.7. Using tar to a Remote Tape Drive
      8. 38.8. Using GNU tar with a Remote Tape Drive
      9. 38.9. On-Demand Incremental Backups of a Project
      10. 38.10. Using Wildcards with tar
        1. 38.10.1. Without GNU tar
        2. 38.10.2. With GNU tar
        3. 38.10.3. Wildcard Gotchas in GNU tar
      11. 38.11. Avoid Absolute Paths with tar
      12. 38.12. Getting tar’s Arguments in the Right Order
      13. 38.13. The cpio Tape Archiver
      14. 38.14. Industrial Strength Backups
    2. 39. Creating and Reading Archives
      1. 39.1. Packing Up and Moving
      2. 39.2. Using tar to Create and Unpack Archives
      3. 39.3. GNU tar Sampler
      4. 39.4. Managing and Sharing Files with RCS and CVS
      5. 39.5. RCS Basics
      6. 39.6. List RCS Revision Numbers with rcsrevs
      7. 39.7. CVS Basics
      8. 39.8. More CVS
    3. 40. Software Installation
      1. 40.1. /usr/bin and Other Software Directories
      2. 40.2. The Challenges of Software Installation on Unix
      3. 40.3. Which make?
      4. 40.4. Simplifying the make Process
      5. 40.5. Using Debian’s dselect
        1. 40.5.1. Choosing the Access Method
        2. 40.5.2. Updating Information on Available Packages
        3. 40.5.3. Choosing Packages for Installation or Removal
        4. 40.5.4. Exiting the Select Function
        5. 40.5.5. Installing Packages
        6. 40.5.6. Configuring Packages
        7. 40.5.7. Removing Packages
        8. 40.5.8. Exiting dselect
      6. 40.6. Installing Software with Debian’s Apt-Get
        1. 40.6.1. Configuring the sources.list File
        2. 40.6.2. Using apt-get
          1. 40.6.2.1. Updating information on available packages
          2. 40.6.2.2. Installing a package
          3. 40.6.2.3. Upgrading installed packages
      7. 40.7. Interruptable gets with wget
      8. 40.8. The curl Application and One-Step GNU-Darwin Auto-Installer for OS X
      9. 40.9. Installation with FreeBSD Ports
      10. 40.10. Installing with FreeBSD Packages
      11. 40.11. Finding and Installing RPM Packaged Software
    4. 41. Perl
      1. 41.1. High-Octane Shell Scripting
      2. 41.2. Checking your Perl Installation
      3. 41.3. Compiling Perl from Scratch
      4. 41.4. Perl Boot Camp, Part 1: Typical Script Anatomy
      5. 41.5. Perl Boot Camp, Part 2: Variables and Data Types
        1. 41.5.1. Scalars
        2. 41.5.2. Arrays
        3. 41.5.3. Hashes
        4. 41.5.4. References
      6. 41.6. Perl Boot Camp, Part 3: Branching and Looping
      7. 41.7. Perl Boot Camp, Part 4: Pattern Matching
      8. 41.8. Perl Boot Camp, Part 5: Perl Knows Unix
      9. 41.9. Perl Boot Camp, Part 6: Modules
      10. 41.10. Perl Boot Camp, Part 7: perldoc
      11. 41.11. CPAN
        1. 41.11.1. Installing Modules the Easy Way
        2. 41.11.2. Installing Modules the Hard Way
        3. 41.11.3. Browsing the CPAN Web Site
      12. 41.12. Make Custom grep Commands (etc.) with Perl
      13. 41.13. Perl and the Internet
        1. 41.13.1. Be Your Own Web Browser with LWP
        2. 41.13.2. Sending Mail with Mail::Sendmail
        3. 41.13.3. CGI Teaser
    5. 42. Python
      1. 42.1. What Is Python?
      2. 42.2. Installation and Distutils
      3. 42.3. Python Basics
        1. 42.3.1. Indentation
        2. 42.3.2. Functions
        3. 42.3.3. Everything’s an Object
        4. 42.3.4. Modules and Packages
        5. 42.3.5. I/O and Formatting
        6. 42.3.6. wxPython
      4. 42.4. Python and the Web
      5. 42.5. urllib
      6. 42.6. urllib2
      7. 42.7. htmllib and HTMLParser
      8. 42.8. cgi
      9. 42.9. mod_python
      10. 42.10. What About Perl?
  12. VIII. Communication and Connectivity
    1. 43. Redirecting Input and Output
      1. 43.1. Using Standard Input and Output
      2. 43.2. One Argument with a cat Isn’t Enough
      3. 43.3. Send (Only) Standard Error Down a Pipe
      4. 43.4. Problems Piping to a Pager
      5. 43.5. Redirection in C Shell: Capture Errors, Too?
      6. 43.6. Safe I/O Redirection with noclobber
      7. 43.7. The ( ) Subshell Operators
        1. 43.7.1. Combining Several Commands
        2. 43.7.2. Temporary Change of Directory and Environment
      8. 43.8. Send Output Two or More Places
      9. 43.9. How to tee Several Commands into One Place
      10. 43.10. Redirecting Output to More Than One Place
      11. 43.11. Named Pipes: FIFOs
      12. 43.12. What Can You Do with an Empty File?
    2. 44. Devices
      1. 44.1. Quick Introduction to Hardware
      2. 44.2. Reading Kernel Boot Output
      3. 44.3. Basic Kernel Configuration
      4. 44.4. Disk Partitioning
      5. 44.5. Filesystem Types and /etc/fstab
      6. 44.6. Mounting and Unmounting Removable Filesystems
      7. 44.7. Loopback Mounts
      8. 44.8. Network Devices — ifconfig
      9. 44.9. Mounting Network Filesystems — NFS, SMBFS
      10. 44.10. Win Is a Modem Not a Modem?
      11. 44.11. Setting Up a Dialup PPP Session
      12. 44.12. USB Configuration
      13. 44.13. Dealing with Sound Cards and Other Annoying Hardware
      14. 44.14. Decapitating Your Machine — Serial Consoles
    3. 45. Printing
      1. 45.1. Introduction to Printing
      2. 45.2. Introduction to Printing on Unix
        1. 45.2.1. lpr-Style Printing Commands
        2. 45.2.2. lp-Style Printing Commands
      3. 45.3. Printer Control with lpc
      4. 45.4. Using Different Printers
      5. 45.5. Using Symbolic Links for Spooling
      6. 45.6. Formatting Plain Text: pr
      7. 45.7. Formatting Plain Text: enscript
      8. 45.8. Printing Over a Network
      9. 45.9. Printing Over Samba
        1. 45.9.1. Printing to Unix Printers from Windows
        2. 45.9.2. Printing to Windows Printers from Unix
      10. 45.10. Introduction to Typesetting
      11. 45.11. A Bit of Unix Typesetting History
      12. 45.12. Typesetting Manpages: nroff
      13. 45.13. Formatting Markup Languages — troff, LATEX, HTML, and So On
      14. 45.14. Printing Languages — PostScript, PCL, DVI, PDF
      15. 45.15. Converting Text Files into a Printing Language
      16. 45.16. Converting Typeset Files into a Printing Language
      17. 45.17. Converting Source Files Automagically Within the Spooler
      18. 45.18. The Common Unix Printing System (CUPS)
      19. 45.19. The Portable Bitmap Package
    4. 46. Connectivity
      1. 46.1. TCP/IP — IP Addresses and Ports
        1. 46.1.1. Internet Protocol (IP)
        2. 46.1.2. Layer 4 Protocols: TCP, UDP, and ICMP
      2. 46.2. /etc/services Is Your Friend
      3. 46.3. Status and Troubleshooting
      4. 46.4. Where, Oh Where Did That Packet Go?
      5. 46.5. The Director of Operations: inetd
      6. 46.6. Secure Shell (SSH)
      7. 46.7. Configuring an Anonymous FTP Server
      8. 46.8. Mail — SMTP, POP, and IMAP
      9. 46.9. Domain Name Service (DNS)
      10. 46.10. Dynamic Host Configuration Protocol (DHCP)
      11. 46.11. Gateways and NAT
      12. 46.12. Firewalls
      13. 46.13. Gatewaying from a Personal LAN over a Modem
    5. 47. Connecting to MS Windows
      1. 47.1. Building Bridges
      2. 47.2. Installing and Configuring Samba
      3. 47.3. Securing Samba
      4. 47.4. SWAT and GUI SMB Browsers
      5. 47.5. Printing with Samba
      6. 47.6. Connecting to SMB Shares from Unix
      7. 47.7. Sharing Desktops with VNC
        1. 47.7.1. Connecting to a Windows VNC server
        2. 47.7.2. Setting up VNC on Unix
      8. 47.8. Of Emulators and APIs
        1. 47.8.1. VMWare
        2. 47.8.2. Wine
      9. 47.9. Citrix: Making Windows Multiuser
        1. 47.9.1. Citrix Metaframe
        2. 47.9.2. rdesktop
        3. 47.9.3. Hob
  13. IX. Security
    1. 48. Security Basics
      1. 48.1. Understanding Points of Vulnerability
      2. 48.2. CERT Security Checklists
      3. 48.3. Keeping Up with Security Alerts
      4. 48.4. What We Mean by Buffer Overflow
      5. 48.5. What We Mean by DoS
      6. 48.6. Beware of Sluggish Performance
        1. 48.6.1. Check Processes
        2. 48.6.2. Checking Swap Space
        3. 48.6.3. Check Network Connections
        4. 48.6.4. Other Checks
      7. 48.7. Intruder Detection
      8. 48.8. Importance of MOTD
      9. 48.9. The Linux proc Filesystem
      10. 48.10. Disabling inetd
      11. 48.11. Disallow rlogin and rsh
      12. 48.12. TCP Wrappers
    2. 49. Root, Group, and User Management
      1. 49.1. Unix User/Group Infrastructure
      2. 49.2. When Does a User Become a User
      3. 49.3. Forgetting the root Password
      4. 49.4. Setting an Exact umask
      5. 49.5. Group Permissions in a Directory with the setgid Bit
      6. 49.6. Groups and Group Ownership
      7. 49.7. Add Users to a Group to Deny Permissions
      8. 49.8. Care and Feeding of SUID and SGID Scripts
      9. 49.9. Substitute Identity with su
      10. 49.10. Never Log In as root
      11. 49.11. Providing Superpowers with sudo
      12. 49.12. Enabling Root in Darwin
      13. 49.13. Disable logins
    3. 50. File Security, Ownership, and Sharing
      1. 50.1. Introduction to File Ownership and Security
      2. 50.2. Tutorial on File and Directory Permissions
        1. 50.2.1. User, Group, and World
        2. 50.2.2. Which Group is Which?
      3. 50.3. Who Will Own a New File?
      4. 50.4. Protecting Files with the Sticky Bit
      5. 50.5. Using chmod to Change File Permission
      6. 50.6. The Handy chmod = Operator
      7. 50.7. Protect Important Files: Make Them Unwritable
      8. 50.8. cx, cw, c-w: Quick File Permission Changes
      9. 50.9. A Loophole: Modifying Files Without Write Access
      10. 50.10. A Directory That People Can Access but Can’t List
      11. 50.11. Juggling Permissions
      12. 50.12. File Verification with md5sum
      13. 50.13. Shell Scripts Must Be Readable and (Usually) Executable
      14. 50.14. Why Can’t You Change File Ownership?
      15. 50.15. How to Change File Ownership Without chown
    4. 51. SSH
      1. 51.1. Enabling Remote Access on Mac OS X
      2. 51.2. Protecting Access Through SSH
      3. 51.3. Free SSH with OpenSSH
      4. 51.4. SSH Problems and Solutions
      5. 51.5. General and Authentication Problems
      6. 51.6. Key and Agent Problems
      7. 51.7. Server and Client Problems
  14. Glossary
  15. Index
  16. About the Authors
  17. Colophon
  18. Copyright

Product information

  • Title: Unix Power Tools, 3rd Edition
  • Author(s): Jerry Peek, Shelley Powers, Tim O'Reilly, Mike Loukides
  • Release date: October 2002
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596003302