Unix Power Tools, Third Edition
By
Shelley Powers,
Jerry Peek,
Tim O'Reilly,
Mike Loukides
October 2002
Pages: 1154
| Table of Contents
| Index
| Sample Chapter
| Colophon
Table of Contents
-
Basic Unix Environment
-
Chapter 1 Introduction
- What's Special About Unix?
- Power Grows on You
- The Core of Unix
- Communication with Unix
- Programs Are Designed to Work Together
- There Are Many Shells
- Which Shell Am I Running?
- Anyone Can Program the Shell
- Internal and External Commands
- The Kernel and Daemons
- Filenames
- Filename Extensions
- Wildcards
- The Tree Structure of the Filesystem
- Your Home Directory
- Making Pathnames
- File Access Permissions
- The Superuser (Root)
- When Is a File Not a File?
- Scripting
- Unix Networking and Communications
- The X Window System
-
Chapter 2 Getting Help
- The man Command
- whatis: One-Line Command Summaries
- whereis: Finding Where a Command Is Located
- Searching Online Manual Pages
- How Unix Systems Remember Their Names
- Which Version Am I Using?
- What tty Am I On?
- Who's On?
- The info Command
-
Customizing Your Environment
-
Chapter 3 Setting Up Your Unix Shell
- What Happens When You Log In
- The Mac OS X Terminal Application
- Shell Setup Files — Which, Where, and Why
- Login Shells, Interactive Shells
- What Goes in Shell Setup Files?
- Tip for Changing Account Setup: Keep a Shell Ready
- Use Absolute Pathnames in Shell Setup Files
- Setup Files Aren't Read When You Want?
- Gotchas in set prompt Test
- Automatic Setups for Different Terminals
- Terminal Setup: Testing TERM
- Terminal Setup: Testing Remote Hostname and X Display
- Terminal Setup: Testing Port
- Terminal Setup: Testing Environment Variables
- Terminal Setup: Searching Terminal Table
- Terminal Setup: Testing Window Size
- Terminal Setup: Setting and Testing Window Name
- A .cshrc.$HOST File for Per Host Setup
- Making a "Login" Shell
- RC Files
- Make Your Own Manpages Without Learning troff
- Writing a Simple Manpage with the -man Macros
-
Chapter 4 Interacting with Your Environment
- Basics of Setting the Prompt
- Static Prompts
- Dynamic Prompts
- Simulating Dynamic Prompts
- C-Shell Prompt Causes Problems in vi, rsh, etc.
- Faster Prompt Setting with Built-ins
- Multiline Shell Prompts
- Session Info in Window Title or Status Line
- A "Menu Prompt" for Naive Users
- Highlighting and Color in Shell Prompts
- Right-Side Prompts
- Show Subshell Level with $SHLVL
- What Good Is a Blank Shell Prompt?
- dirs in Your Prompt: Better Than $cwd
- External Commands Send Signals to Set Variables
- Preprompt, Pre-execution, and Periodic Commands
- Running Commands When You Log Out
- Running Commands at Bourne/Korn Shell Logout
- Stop Accidental Bourne-Shell Logouts
-
Chapter 5 Getting the Most out of Terminals, xterm, and X Windows
- There's a Lot to Know About Terminals
- The Idea of a Terminal Database
- Setting the Terminal Type When You Log In
- Querying Your Terminal Type: qterm
- Querying Your xterm Size: resize
- Checklist: Terminal Hangs When I Log In
- Find Out Terminal Settings with stty
- Setting Your Erase, Kill, and Interrupt Characters
- Working with xterm and Friends
- Login xterms and rxvts
- Working with Scrollbars
- How Many Lines to Save?
- Simple Copy and Paste in xterm
- Defining What Makes Up a Word for Selection Purposes
- Setting the Titlebar and Icon Text
- The Simple Way to Pick a Font
- The xterm Menus
- Changing Fonts Dynamically
- Working with xclipboard
- Problems with Large Selections
- Tips for Copy and Paste Between Windows
- Running a Single Command with xterm -e
- Don't Quote Arguments to xterm -e
-
Chapter 6 Your X Environment
- Defining Keys and Button Presses with xmodmap
- Using xev to Learn Keysym Mappings
- X Resource Syntax
- X Event Translations
- Setting X Resources: Overview
- Setting Resources with the -xrm Option
- How -name Affects Resources
- Setting Resources with xrdb
- Listing the Current Resources for a Client: appres
- Starting Remote X Clients
-
Working with Files and Directories
-
Chapter 7 Directory Organization
- What? Me, Organized?
- Many Homes
- Access to Directories
- A bin Directory for Your Programs and Scripts
- Private (Personal) Directories
- Naming Files
- Make More Directories!
- Making Directories Made Easier
-
Chapter 8 Directories and Files
- Everything but the find Command
- The Three Unix File Times
- Finding Oldest or Newest Files with ls -t and ls -u
- List All Subdirectories with ls -R
- The ls -d Option
- Color ls
- Some GNU ls Features
- A csh Alias to List Recently Changed Files
- Showing Hidden Files with ls -A and -a
- Useful ls Aliases
- Can't Access a File? Look for Spaces in the Name
- Showing Nonprintable Characters in Filenames
- Counting Files by Types
- Listing Files by Age and Size
- newer: Print the Name of the Newest File
- oldlinks: Find Unconnected Symbolic Links
- Picking a Unique Filename Automatically
-
Chapter 9 Finding Files with find
- How to Use find
- Delving Through a Deep Directory Tree
- Don't Forget -print
- Looking for Files with Particular Names
- Searching for Old Files
- Be an Expert on find Search Operators
- The Times That find Finds
- Exact File-Time Comparisons
- Running Commands on What You Find
- Using -exec to Create
Custom Tests
- Custom -exec Tests Applied
- Finding Many Things with One Command
- Searching for Files by Type
- Searching for Files by Size
- Searching for Files by Permission
- Searching by Owner and Group
- Duplicating a Directory Tree
- Using "Fast find" Databases
- Wildcards with "Fast find" Database
- Finding Files (Much) Faster with a find Database
- grepping a Directory Tree
- lookfor: Which File Has That Word?
- Using Shell Arrays to Browse Directories
- Finding the (Hard) Links to a File
- Finding Files with -prune
- Quick finds in the Current Directory
- Skipping Parts of a Tree in find
- Keeping find from Searching Networked Filesystem
-
Chapter 10 Linking, Renaming, and Copying Files
- What's So Complicated About Copying Files
- What's Really in a Directory?
- Files with Two or More Names
- More About Links
- Creating and Removing Links
- Stale Symbolic Links
- Linking Directories
- Showing the Actual Filenames for Symbolic Links
- Renaming, Copying, or Comparing a Set of Files
- Renaming a List of Files Interactively
- One More Way to Do It
- Copying Directory Trees with cp -r
- Copying Directory Trees with tar and Pipes
-
Chapter 11 Comparing Files
- Checking Differences with diff
- Comparing Three Different Versions with diff3
- Context diffs
- Side-by-Side diffs: sdiff
- Choosing Sides with sdiff
- Problems with diff and Tabstops
- cmp and diff
- Comparing Two Files with comm
- More Friendly comm Output
- make Isn't Just for Programmers!
- Even More Uses for make
-
Chapter 12 Showing What's in a File
- Cracking the Nut
- What Good Is a cat?
- "less" is More
- Show Nonprinting Characters with cat -v or od -c
- What's in That Whitespace?
- Finding File Types
- Squash Extra Blank Lines
- How to Look at the End of a File: tail
- Finer Control on tail
- How to Look at Files as They Grow
- GNU tail File Following
- Printing the Top of a File
- Numbering Lines
-
Chapter 13 Searching Through Files
- Different Versions of grep
- Searching for Text with grep
- Finding Text That Doesn't Match
- Extended Searching for Text with egrep
- grepping for a List of Patterns
- Approximate grep: agrep
- Search RCS Files with rcsgrep
- GNU Context greps
- A Multiline Context grep Using sed
- Compound Searches
- Narrowing a Search Quickly
- Faking Case-Insensitive Searches
- Finding a Character in a Column
- Fast Searches and Spelling Checks with "look"
- Finding Words Inside Binary Files
- A Highlighting grep
-
Chapter 14 Removing Files
- The Cycle of Creation and Destruction
- How Unix Keeps Track of Files: Inodes
- rm and Its Dangers
- Tricks for Making rm Safer
- Answer "Yes" or "No" Forever with yes
- Remove Some, Leave Some
- A Faster Way to Remove Files Interactively
- Safer File Deletion in Some Directories
- Safe Delete: Pros and Cons
- Deletion with Prejudice: rm -f
- Deleting Files with Odd Names
- Using Wildcards to Delete Files with Strange Names
- Handling a Filename Starting with a Dash (-)
- Using unlink to Remove a File with a Strange Name
- Removing a Strange File by its i-number
- Problems Deleting Directories
- Deleting Stale Files
- Removing Every File but One
- Using find to Clear Out Unneeded Files
-
Chapter 15 Optimizing Disk Space
- Disk Space Is Cheap
- Instead of Removing a File, Empty It
- Save Space with "Bit Bucket" Log Files and Mailboxes
- Save Space with a Link
- Limiting File Sizes
- Compressing Files to Save Space
- Save Space: tar and compress a Directory Tree
- How Much Disk Space?
- Compressing a Directory Tree: Fine-Tuning
- Save Space in Executable Files with strip
- Disk Quotas
-
Basic Editing
-
Chapter 16 Spell Checking, Word Counting, and Textual Analysis
- The Unix spell Command
- Check Spelling Interactively with ispell
- How Do I Spell That Word?
- Inside spell
- Adding Words to ispell's Dictionary
- Counting Lines, Words, and Characters: wc
- Find a a Doubled Word
- Looking for Closure
- Just the Words, Please
-
Chapter 17 vi Tips and Tricks
- The vi Editor: Why So Much Material?
- What We Cover
- Editing Multiple Files with vi
- Edits Between Files
- Local Settings for vi
- Using Buffers to Move or Copy Text
- Get Back What You Deleted with Numbered Buffers
- Using Search Patterns and Global Commands
- Confirming Substitutions in vi
- Keep Your Original File, Write to a New File
- Saving Part of a File
- Appending to an Existing File
- Moving Blocks of Text by Patterns
- Useful Global Commands (with Pattern Matches)
- Counting Occurrences; Stopping Search Wraps
- Capitalizing Every Word on a Line
- Per-File Setups in Separate Files
- Filtering Text Through a Unix Command
- vi File Recovery Versus Networked Filesystems
- Be Careful with vi -r Recovered Buffers
- Shell Escapes: Running One UnixCommand While Using
Another
- vi Compound Searches
- vi Word Abbreviation
- Using vi Abbreviations as Commands (Cut and Paste Between
vi's)
- Fixing Typos with vi Abbreviations
- vi Line Commands Versus Character Commands
- Out of Temporary Space? Use Another Directory
- Neatening Lines
- Finding Your Place with Undo
- Setting Up vi with the .exrc File
-
Chapter 18 Creating Custom Commands in vi
- Why Type More Than You Have To?
- Save Time and Typing with the vi map Commands
- What You Lose When You Use map!
- vi @-Functions
- Keymaps for Pasting into a Window Running vi
- Protecting Keys from Interpretation by ex
- Maps for Repeated Edits
- More Examples of Mapping Keys in vi
- Repeating a vi Keymap
- Typing in Uppercase Without CAPS LOCK
- Text-Input Mode Cursor Motion with No Arrow Keys
- Don't Lose Important Functions with vi Maps: Use
noremap
- vi Macro for Splitting Long Lines
- File-Backup Macros
-
Chapter 19 GNU Emacs
- Emacs: The Other Editor
- Emacs Features: A Laundry List
- Customizations and How to Avoid Them
- Backup and Auto-Save Files
- Putting Emacs in Overwrite Mode
- Command Completion
- Mike's Favorite Timesavers
- Rational Searches
- Unset PWD Before Using Emacs
- Inserting Binary Characters into Files
- Using Word-Abbreviation Mode
- Directories for Emacs Hacks
- An Absurd Amusement
-
Chapter 20 Batch Editing
- Why Line Editors Aren't Dinosaurs
- Writing Editing Scripts
- Line Addressing
- Useful ex Commands
- Running Editing Scripts Within vi
- Change Many Files by Editing Just One
- ed/ex Batch Edits: A Typical Example
- Batch Editing Gotcha: Editors Fail on Big Files
- patch: Generalized Updating of Files That Differ
- Quick Reference: awk
- Versions of awk
-
Chapter 21 You Can't Quite Call This Editing
- And Why Not?
- Neatening Text with fmt
- Alternatives to fmt
- Clean Up Program Comment Blocks
- Remove Mail/News Headers with behead
- Low-Level File Butchery with dd
- offset: Indent Text
- Centering Lines in a File
- Splitting Files at Fixed Points: split
- Splitting Files by Context: csplit
- Hacking on Characters with tr
- Encoding "Binary" Files into ASCII
- Text Conversion with dd
- Cutting Columns or Fields
- Making Text in Columns with pr
- Make Columns Automatically with column
- Straightening Jagged Columns
- Pasting Things in Columns
- Joining Lines with join
- What Is (or Isn't) Unique?
- Rotating Text
-
Chapter 22 Sorting
- Putting Things in Order
- Sort Fields: How sort Sorts
- Changing the sort Field Delimiter
- Confusion with Whitespace Field Delimiters
- Alphabetic and Numeric Sorting
- Miscellaneous sort Hints
- lensort: Sort Lines by Length
- Sorting a List of People by Last Name
-
Processes and the Kernel
-
Chapter 23 Job Control
- Job Control in a Nutshell
- Job Control Basics
- Using jobs Effectively
- Some Gotchas with Job Control
- The "Current Job" Isn't Always What You Expect
- Job Control and autowrite: Real Timesavers!
- System Overloaded? Try Stopping Some Jobs
- Notification When Jobs Change State
- Stop Background Output with stty tostop
- nohup
- Disowning Processes
- Linux Virtual Consoles
- Stopping Remote Login Sessions
-
Chapter 24 Starting, Stopping, and Killing Processes
- What's in This Chapter
- fork and exec
- Managing Processes: Overall Concepts
- Subshells
- The ps Command
- The Controlling Terminal
- Tracking Down Processes
- Why ps Prints Some Commands in Parentheses
- The /proc Filesystem
- What Are Signals?
- Killing Foreground Jobs
- Destroying Processes with kill
- Printer Queue Watcher: A Restartable Daemon Shell
Script
- Killing All Your Processes
- Killing Processes by Name?
- Kill Processes Interactively
- Processes Out of Control? Just STOP Them
- Cleaning Up an Unkillable Process
- Why You Can't Kill a Zombie
- The Process Chain to Your Window
- Terminal Windows Without Shells
- Close a Window by Killing Its Process(es)
-
Chapter 25 Delayed Execution
- Building Software Robots the Easy Way
- Periodic Program Execution: The cron Facility
- Adding crontab Entries
- Including Standard Input Within a cron Entry
- The at Command
- Making Your at Jobs Quiet
- Checking and Removing Jobs
- Avoiding Other at and cron Jobs
- Waiting a Little While: sleep
-
Chapter 26 System Performance and Profiling
- Timing Is Everything
- Timing Programs
- What Commands Are Running and How Long Do They Take?
- Checking System Load: uptime
- Know When to Be "nice" to Other Users...and When Not To
- A nice Gotcha
- Changing a Running Job's Niceness
-
Scripting
-
Chapter 27 Shell Interpretation
- What the Shell Does
- How the Shell Executes Other Commands
- What's a Shell, Anyway?
- Command Evaluation and Accidentally Overwriting Files
- Output Command-Line Arguments One by One
- Controlling Shell Command Searches
- Wildcards Inside Aliases
- eval: When You Need Another Chance
- Which One Will bash Use?
- Which One Will the C Shell Use?
- Is It "2>&1 file" or "> file 2>&1"?
Why?
- Bourne Shell Quoting
- Differences Between Bourne and C Shell Quoting
- Quoting Special Characters in Filenames
- Verbose and Echo Settings Show Quoting
- Here Documents
- "Special" Characters and Operators
- How Many Backslashes?
-
Chapter 28 Saving Time on the Command Line
- What's Special About the Unix Command Line
- Reprinting Your Command Line with CTRL-r
- Use Wildcards to Create Files?
- Build Strings with { }
- String Editing (Colon) Operators
- Automatic Completion
- Don't Match Useless Files in Filename Completion
- Repeating Commands
- Repeating and Varying Commands
- Repeating a Command with Copy-and-Paste
- Repeating a Time-Varying Command
- Multiline Commands, Secondary Prompts
- Here Document Example #1: Unformatted Form Letters
- Command Substitution
- Handling Lots of Text with Temporary Files
- Separating Commands with Semicolons
- Dealing with Too Many Arguments
- Expect
-
Chapter 29 Custom Commands
- Creating Custom Commands
- Introduction to Shell Aliases
- C-Shell Aliases with Command-Line Arguments
- Setting and Unsetting Bourne-Type Aliases
- Korn-Shell Aliases
- zsh Aliases
- Sourceable Scripts
- Avoiding C-Shell Alias Loops
- How to Put if-then-else in a C-Shell Alias
- Fix Quoting in csh Aliases with makealias and quote
- Shell Function Basics
- Shell Function Specifics
- Propagating Shell Functions
- Simulated Bourne Shell Functions and Aliases
-
Chapter 30 The Use of History
- The Lessons of History
- History in a Nutshell
- My Favorite Is !$
- My Favorite Is !:n*
- My Favorite Is ^^
- Using !$ for Safety with Wildcards
- History by Number
- History Substitutions
- Repeating a Cycle of Commands
- Running a Series of Commands on a File
- Check Your History First with :p
- Picking Up Where You Left Off
- Pass History to Another Shell
- Shell Command-Line Editing
- Changing History Characters with histchars
- Instead of Changing History Characters
-
Chapter 31 Moving Around in a Hurry
- Getting Around the Filesystem
- Using Relative and Absolute Pathnames
- What Good Is a Current Directory?
- How Does Unix Find Your Current Directory?
- Saving Time When You Change Directories: cdpath
- Loop Control: break and continue
- The Shells' pushd and popd Commands
- Nice Aliases for pushd
- Quick cds with Aliases
- cd by Directory Initials
- Finding (Anyone's) Home Directory, Quickly
- Marking Your Place with a Shell Variable
- Automatic Setup When You Enter/Exit a Directory
-
Chapter 32 Regular Expressions (Pattern Matching)
- That's an Expression
- Don't Confuse Regular Expressions with Wildcards
- Understanding Expressions
- Using Metacharacters in Regular Expressions
- Regular Expressions: The Anchor Characters ^ and $
- Regular Expressions: Matching a Character with a Character
Set
- Regular Expressions: Match Any Character with . (Dot)
- Regular Expressions: Specifying a Range of Characters with
[...]
- Regular Expressions: Exceptions in a Character Set
- Regular Expressions: Repeating Character Sets with *
- Regular Expressions: Matching a Specific Number of Sets with \
{ and \ }
- Regular Expressions: Matching Words with \ < and \
>
- Regular Expressions: Remembering Patterns with \ (, \ ), and
\1
- Regular Expressions: Potential Problems
- Extended Regular Expressions
- Getting Regular Expressions Right
- Just What Does a Regular Expression Match?
- Limiting the Extent of a Match
- I Never Meta Character I Didn't Like
- Valid Metacharacters for Different Unix Programs
- Pattern Matching Quick Reference with Examples
-
Chapter 33 Wildcards
- File-Naming Wildcards
- Filename Wildcards in a Nutshell
- Who Handles Wildcards?
- What if a Wildcard Doesn't Match?
- Maybe You Shouldn't Use Wildcards in Pathnames
- Getting a List of Matching Files with grep -l
- Getting a List of Nonmatching Files
- nom: List Files That Don't Match a Wildcard
-
Chapter 34 The sed Stream Editor
- sed Sermon^H^H^H^H^H^HSummary
- Two Things You Must Know About sed
- Invoking sed
- Testing and Using a sed Script: checksed, runsed
- sed Addressing Basics
- Order of Commands in a Script
- One Thing at a Time
- Delimiting a Regular Expression
- Newlines in a sed Replacement
- Referencing the Search String in a Replacement
- Referencing Portions of a Search String
- Search and Replacement: One Match Among Many
- Transformations on Text
- Hold Space: The Set-Aside Buffer
- Transforming Part of a Line
- Making Edits Across Line Boundaries
- The Deliberate Scrivener
- Searching for Patterns Split Across Lines
- Multiline Delete
- Making Edits Everywhere Except...
- The sed Test Command
- Uses of the sed Quit Command
- Dangers of the sed Quit Command
- sed Newlines, Quoting, and Backslashes in a Shell
Script
-
Chapter 35 Shell Programming for the Uninitiated
- Writing a Simple Shell Program
- Everyone Should Learn Some Shell Programming
- What Environment Variables Are Good For
- Parent-Child Relationships
- Predefined Environment Variables
- The PATH Environment Variable
- PATH and path
- The DISPLAY Environment Variable
- Shell Variables
- Test String Values with Bourne-Shell case
- Pattern Matching in case Statements
- Exit Status of Unix Processes
- Test Exit Status with the if Statement
- Testing Your Success
- Loops That Test Exit Status
- Set Exit Status of a Shell (Script)
- Trapping Exits Caused by Interrupts
- read: Reading from the Keyboard
- Shell Script "Wrappers" for awk, sed, etc.
- Handling Command-Line Arguments in Shell Scripts
- Handling Command-Line Arguments with a for Loop
- Handling Arguments with while and shift
- Loop Control: break and continue
- Standard Command-Line Parsing
- The Bourne Shell set Command
- test: Testing Files and Strings
- Picking a Name for a New Command
- Finding a Program Name and Giving Your Program Multiple
Names
- Reading Files with the . and source Commands
- Using Shell Functions in Shell Scripts
-
Chapter 36 Shell Programming for the Initiated
- Beyond the Basics
- The Story of : # #!
- Don't Need a Shell for Your Script? Don't Use One
- Making #! Search the PATH
- The exec Command
- The Unappreciated Bourne Shell ":" Operator
- Parameter Substitution
- Save Disk Space and Programming: Multiple Names for a
Program
- Finding the Last Command-Line Argument
- How to Unset All Command-Line Parameters
- Standard Input to a for Loop
- Making a for Loop with Multiple Variables
- Using basename and dirname
- A while Loop with Several Loop Control Commands
- Overview: Open Files and File Descriptors
- n>&m: Swap Standard Output and Standard Error
- A Shell Can Read a Script from Its Standard Input,
but...
- Shell Scripts On-the-Fly from Standard Input
- Quoted hereis Document Terminators: sh Versus csh
- Turn Off echo for "Secret" Answers
- Quick Reference: expr
- Testing Characters in a String with expr
- Grabbing Parts of a String
- Nested Command Substitution
- Testing Two Strings with One case Statement
- Outputting Text to an X Window
- Shell Lockfile
-
Chapter 37 Shell Script Debugging and Gotchas
- Tips for Debugging Shell Scripts
- Bourne Shell Debugger Shows a Shell Variable
- Stop Syntax Errors in Numeric Tests
- Stop Syntax Errors in String Tests
- Quoting and Command-Line Parameters
- How Unix Keeps Time
- Copy What You Do with script
- Cleaning script Files
- Making an Arbitrary-Size File for Testing
-
Extending and Managing Your Environment
-
Chapter 38 Backing Up Files
- What Is This "Backup" Thing?
- tar in a Nutshell
- Make Your Own Backups
- More Ways to Back Up
- How to Make Backups to a Local Device
- Restoring Files from Tape with tar
- Using tar to a Remote Tape Drive
- Using GNU tar with a Remote Tape Drive
- On-Demand Incremental Backups of a Project
- Using Wildcards with tar
- Avoid Absolute Paths with tar
- Getting tar's Arguments in the Right Order
- The cpio Tape Archiver
- Industrial Strength Backups
-
Chapter 39 Creating and Reading Archives
- Packing Up and Moving
- Using tar to Create and Unpack Archives
- GNU tar Sampler
- Managing and Sharing Files with RCS and CVS
- RCS Basics
- List RCS Revision Numbers with rcsrevs
- CVS Basics
- More CVS
-
Chapter 40 Software Installation
- /usr/bin and Other Software Directories
- The Challenges of Software Installation on Unix
- Which make?
- Simplifying the make Process
- Using Debian's dselect
- Installing Software with Debian's Apt-Get
- Interruptable gets with wget
- The curl Application and One-Step GNU-Darwin Auto-Installer for
OS X
- Installation with FreeBSD Ports
- Installing with FreeBSD Packages
- Finding and Installing RPM Packaged Software
-
Chapter 41 Perl
- High-Octane Shell Scripting
- Checking your Perl Installation
- Compiling Perl from Scratch
- Perl Boot Camp, Part 1: Typical Script Anatomy
- Perl Boot Camp, Part 2: Variables and Data Types
- Perl Boot Camp, Part 3: Branching and Looping
- Perl Boot Camp, Part 4: Pattern Matching
- Perl Boot Camp, Part 5: Perl Knows Unix
- Perl Boot Camp, Part 6: Modules
- Perl Boot Camp, Part 7: perldoc
- CPAN
- Make Custom grep Commands (etc.) with Perl
- Perl and the Internet
-
Chapter 42 Python
- What Is Python?
- Installation and Distutils
- Python Basics
- Python and the Web
- urllib
- urllib2
- htmllib and HTMLParser
- cgi
- mod_python
- What About Perl?
-
Communication and Connectivity
-
Chapter 43 Redirecting Input and Output
- Using Standard Input and Output
- One Argument with a cat Isn't Enough
- Send (Only) Standard Error Down a Pipe
- Problems Piping to a Pager
- Redirection in C Shell: Capture Errors, Too?
- Safe I/O Redirection with noclobber
- The ( ) Subshell Operators
- Send Output Two or More Places
- How to tee Several Commands into One Place
- Redirecting Output to More Than One Place
- Named Pipes: FIFOs
- What Can You Do with an Empty File?
-
Chapter 44 Devices
- Quick Introduction to Hardware
- Reading Kernel Boot Output
- Basic Kernel Configuration
- Disk Partitioning
- Filesystem Types and /etc/fstab
- Mounting and Unmounting Removable Filesystems
- Loopback Mounts
- Network Devices — ifconfig
- Mounting Network Filesystems — NFS, SMBFS
- Win Is a Modem Not a Modem?
- Setting Up a Dialup PPP Session
- USB Configuration
- Dealing with Sound Cards and Other Annoying Hardware
- Decapitating Your Machine — Serial Consoles
-
Chapter 45 Printing
- Introduction to Printing
- Introduction to Printing on Unix
- Printer Control with lpc
- Using Different Printers
- Using Symbolic Links for Spooling
- Formatting Plain Text: pr
- Formatting Plain Text: enscript
- Printing Over a Network
- Printing Over Samba
- Introduction to Typesetting
- A Bit of Unix Typesetting History
- Typesetting Manpages: nroff
- Formatting Markup Languages — troff,
LATEX, HTML, and So
On
- Printing Languages — PostScript, PCL, DVI, PDF
- Converting Text Files into a Printing Language
- Converting Typeset Files into a Printing Language
- Converting Source Files Automagically Within the
Spooler
- The Common Unix Printing System (CUPS)
- The Portable Bitmap Package
-
Chapter 46 Connectivity
- TCP/IP — IP Addresses and Ports
- /etc/services Is Your Friend
- Status and Troubleshooting
- Where, Oh Where Did That Packet Go?
- The Director of Operations: inetd
- Secure Shell (SSH)
- Configuring an Anonymous FTP Server
- Mail — SMTP, POP, and IMAP
- Domain Name Service (DNS)
- Dynamic Host Configuration Protocol (DHCP)
- Gateways and NAT
- Firewalls
- Gatewaying from a Personal LAN over a Modem
-
Chapter 47 Connecting to MS Windows
- Building Bridges
- Installing and Configuring Samba
- Securing Samba
- SWAT and GUI SMB Browsers
- Printing with Samba
- Connecting to SMB Shares from Unix
- Sharing Desktops with VNC
- Of Emulators and APIs
- Citrix: Making Windows Multiuser
-
Security
-
Chapter 48 Security Basics
- Understanding Points of Vulnerability
- CERT Security Checklists
- Keeping Up with Security Alerts
- What We Mean by Buffer Overflow
- What We Mean by DoS
- Beware of Sluggish Performance
- Intruder Detection
- Importance of MOTD
- The Linux proc Filesystem
- Disabling inetd
- Disallow rlogin and rsh
- TCP Wrappers
-
Chapter 49 Root, Group, and User Management
- Unix User/Group Infrastructure
- When Does a User Become a User
- Forgetting the root Password
- Setting an Exact umask
- Group Permissions in a Directory with the setgid Bit
- Groups and Group Ownership
- Add Users to a Group to Deny Permissions
- Care and Feeding of SUID and SGID Scripts
- Substitute Identity with su
- Never Log In as root
- Providing Superpowers with sudo
- Enabling Root in Darwin
- Disable logins
-
Chapter 50 File Security, Ownership, and Sharing
- Introduction to File Ownership and Security
- Tutorial on File and Directory Permissions
- Who Will Own a New File?
- Protecting Files with the Sticky Bit
- Using chmod to Change File Permission
- The Handy chmod = Operator
- Protect Important Files: Make Them Unwritable
- cx, cw, c-w: Quick File Permission Changes
- A Loophole: Modifying Files Without Write Access
- A Directory That People Can Access but Can't List
- Juggling Permissions
- File Verification with md5sum
- Shell Scripts Must Be Readable and (Usually) Executable
- Why Can't You Change File Ownership?
- How to Change File Ownership Without chown
-
Chapter 51 SSH
- Enabling Remote Access on Mac OS X
- Protecting Access Through SSH
- Free SSH with OpenSSH
- SSH Problems and Solutions
- General and Authentication Problems
- Key and Agent Problems
- Server and Client Problems
-
Glossary
-
Colophon
Return to Unix Power Tools