LINUX COOKBOOK ™ Other Linux resources from O’Reilly Related titles Linux Device Drivers Exploring the JDS Linux Linux in a Nutshell Desktop Running Linux Learning Red Hat Enterprise Building Embedded Linux Linux and Fedora Systems Linux Pocket Guide Linux Security Cookbook Understanding the Linux Kernel Linux Books linux.oreilly.com is a complete catalog of O’Reilly’s books on Resource Center Linux and Unix and related technologies, including sample chapters and code examples. ONLamp.com is the premier site for the open source web plat- form: Linux, Apache, MySQL, and either Perl, Python, or PHP. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in document- ing the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online refer- ence library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or sim- ply flip to the page you need. Try it today with a free trial. LINUX COOKBOOK ™ Carla Schroder Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo Linux Cookbook™ by Carla Schroder Copyright © 2005 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/insti- tutional sales department: (800) 998-9938 or [email protected]. Editor: Mike Loukides Production Editor: Colleen Gorman Cover Designer: Emma Colby Interior Designer: David Futato Printing History: December 2004: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. The Linux series designations, Linux Cookbook, images of the American West, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 0-596-00640-3 [M] [5/05] To Dawn Marie. During the writing of this book, she tilled the fields, trained the horses, cooked the meals, cleaned the ditches, and graciously fended off generous neighbors bearing large zucchinis. No author could ask for more. Thank you for 14 great years; may we have many more. Table of Contents Preface . xix 1. Finding Documentation . 1 1.1 Introduction 1 1.2 Understanding man Pages 2 1.3 Finding Appropriate man Pages 4 1.4 Finding Lost man Pages 5 1.5 Reading man Pages Without a man Viewer 6 1.6 Configuring Your manpath 7 1.7 Using info Pages 8 1.8 Printing man Pages 9 1.9 Printing info Pages 10 1.10 Printing Selected man or info Pages 11 1.11 Finding All of the Documentation for a Program 11 2. Installing and Managing Software on RPM-Based Systems . 14 2.1 Introduction 14 2.2 Installing RPMs 15 2.3 Upgrading RPMs 16 2.4 Removing RPMs 17 2.5 Collecting Information on Installed RPMs 18 2.6 Collecting Information from RPMs That Are Not Installed 20 2.7 Finding Recently Installed RPMs 21 2.8 Rebuilding the RPM Database 21 2.9 Tracking Source-Built Libraries on an RPM-Based System 22 2.10 Fixing RPM Installation Problems 24 2.11 Installing Source RPMs 25 2.12 Customizing Build Options in a Source RPM 26 vii 2.13 Installing Yum 28 2.14 Configuring Yum 29 2.15 Installing and Upgrading Packages with Yum 30 2.16 Removing Packages with Yum 31 2.17 Getting Information on Installed Packages with Yum 31 2.18 Maintaining Yum 32 3. Installing and Managing Software on Debian-Based Systems . 34 3.1 Introduction 34 3.2 Getting Software for a Debian System 35 3.3 Installing Debian Packages from CD-ROM 37 3.4 Installing Packages on Debian-Based Systems 38 3.5 Removing Packages from a Debian System 39 3.6 Installing from Sources on a Debian System 40 3.7 Upgrading Packages on Debian 41 3.8 Upgrading a Debian System 41 3.9 Upgrading to a Newer Debian Release 42 3.10 Running a Mixed Debian System 43 3.11 Finding Out What Is Installed on a Debian System 44 3.12 Maintaining the Debian Package Cache 46 3.13 Resolving Debian Dependency Conflicts 47 3.14 Building a Local Debian Repository 49 3.15 Selecting Package Mirrors for apt-proxy.conf 50 3.16 Adding Your Existing Package Cache to apt-proxy.conf 51 4. Installing Programs from Source Code . 52 4.1 Introduction 52 4.2 Preparing Your System for Compiling Programs from Sources 52 4.3 Generating a List of Files from a Source Install for Easy Uninstalls 54 4.4 Installing Programs from Source Code 55 4.5 Using CheckInstall to Create Packages from Sources 56 5. Discovering Hardware from Outside the Box . 58 5.1 Introduction 58 5.2 Detecting Hardware with lspci 59 5.3 Using dmesg to Collect Hardware Information 60 5.4 Getting Live Hardware Snapshots with /proc 62 5.5 Viewing Drive Partitions with fdisk 65 5.6 Calculating Hard Drive Capacity 66 viii | Table of Contents 6. Editing Text Files with JOE and Vim . 68 6.1 Introduction 68 6.2 Finding JOE Commands 70 6.3 Customizing JOE 71 6.4 Organizing JOE’s Preferences in a Separate File 72 6.5 Copying Between Two Files in JOE 73 6.6 Searching and Replacing in JOE 74 6.7 Selecting Text Vertically in JOE 75 6.8 Finding and Opening Files in JOE 76 6.9 Learning Vim Quickly 77 6.10 Creating Autotext with Vim’s Abbreviations 79 6.11 Mapping Commands to Keystrokes 79 6.12 Customizing Vim 81 6.13 Navigating Quickly in Vim with Marks 83 6.14 Picking Up Where You Left Off: Using Vim’s Sessions 84 6.15 Setting Your Default Editor 86 6.16 Discovering Vim’s Compile-Time Options 87 7. Starting and Stopping Linux . 89 7.1 Introduction 89 7.2 Changing Runlevels After Bootup 91 7.3 Changing the Default Runlevel 93 7.4 Starting and Stopping X 94 7.5 Managing Debian’s Runlevels 94 7.6 Creating Both Text and Graphical Login Runlevels on Debian 95 7.7 Managing Red Hat’s Runlevels 97 7.8 Manually Configuring Startup Services 98 7.9 Manually Starting and Stopping Services 99 7.10 Shutting Down or Rebooting Linux 100 7.11 Disabling or Limiting Access to Ctrl-Alt-Delete 101 7.12 Shutting Down Automatically 102 8. Managing Users and Groups . 103 8.1 Introduction 103 8.2 Sorting Human Users from System Users 104 8.3 Finding a User’s UID and GID 105 8.4 Adding Users with useradd 106 8.5 Adding Users with adduser 107 8.6 Modifying User Accounts 109 Table of Contents | ix 8.7 Deleting a User 110 8.8 Killing User Processes the Easy, Fun Way 111 8.9 Disabling Accounts 112 8.10 Managing Passwords 113 8.11 Adding Groups with groupadd 114 8.12 Deleting Groups with groupdel 114 8.13 Creating a System User 115 8.14 Creating System Groups with addgroup 116 8.15 Adding and Deleting Group Members 116 8.16 Checking Password File Integrity 117 8.17 Adding New Users in Batches 118 8.18 Changing Masses of Passwords 124 8.19 Adding Batches of Users to Groups 125 8.20 Using su to Be Root Temporarily 126 8.21 Granting Limited Rootly Powers with sudo 127 8.22 Using Disk Quotas 129 9. Managing Files and Partitions . 132 9.1 Introduction 132 9.2 Setting File and Directory Permissions with chmod’s Numeric Notation 138 9.3 Doing Batch Operations with chmod 140 9.4 Setting File and Directory Permissions with chmod’s Symbolic Notation 140 9.5 Setting File Ownership with chown 142 9.6 Doing Batch Operations with chown 143 9.7 Setting Up a Shared Directory with setgid and the Sticky Bit 144 9.8 Setting Permissions Defaults with umask 145 9.9 Mounting and Unmounting Removable Disks 147 9.10 Configuring Filesystem Mounts with /etc/fstab 148 9.11 Mounting and Unmounting Filesystems on Hard Drives 151 9.12 Finding Device Names for mount and fstab 152 9.13 Creating Files and Directories 155 9.14 Deleting Files and Directories 155 9.15 Copying, Moving, and Renaming Files and Directories 157 9.16 Creating Linux Disk Partitions with fdisk 158 9.17 Creating a Filesystem on a New Partition 159 x | Table of Contents 10. Patching, Customizing, and Upgrading Kernels . 161 10.1 Introduction 161 10.2 Adding New Features to the 2.4 Kernel 163 10.3 Slimming a Stock 2.4 Kernel 167 10.4 Upgrading to the Latest Stable Version of the 2.4 Kernel 169 10.5 Building the 2.6 Kernel 170 10.6 Adding New Features to the 2.6 Kernel 171 10.7 Adding a New Loadable Kernel Module 172 10.8 Patching a Kernel 173 10.9 Removing a Kernel Patch 175 10.10 Creating an initrd Image 176 10.11 Creating a Boot Disk on Debian 177 10.12 Creating a Boot Disk on Red Hat 177 11.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages582 Page
-
File Size-