The Linux Cookbook
Total Page:16
File Type:pdf, Size:1020Kb
The Linux Cookbook The Linux Cookbook Tips and Techniques for Everyday Use Michael Stutz PRESS An imprint of No Starch Press, Inc. San Francisco The Linux Cookbook. Copyright c 2001 by Michael Stutz. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechan- ical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. Printed in the United States of America 12345678910–04 03 02 01 Trademarked names are used throughout this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Co-publishers: William Pollock and Phil Hughes Project Editor: Karol Jurado Assistant Editor: Nick Hoff Cover Design: Octopod Studios Typesetting and Design: Michael Stutz Technical Editor: Scott Schwartz Copyeditor: Andy Carroll Proofreader: Elisabeth Beller Distributed to the book trade in the United States by Publishers Group West, 1700 Fourth Street, Berkeley, California 94710, phone: 800-788-3123 or 510-528-1444, fax: 510-528-3444 Distributed to the book trade in Canada by Jacqueline Gross & Associates, Inc., 195 Allstate Parkway, Markham, Ontario L3R 4T8 Canada, phone: 905-477-0722, fax: 905-477-8619 For information on translations or book distributors outside the United States, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 555 De Haro Street, Suite 250, San Francisco, CA 94107 phone: 415-863-9900; fax: 415-863-9950; [email protected]; www.nostarch.com The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of this work, neither the author nor No Starch Press, Inc. shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in it. This official author’s edition is published by exclusive arrangement with No Starch Press, Inc. Library of Congress Cataloging-in-Publication Data Stutz, Michael. The Linux cookbook / Michael Stutz. p. cm. ISBN 1-886411-48-4 (pbk.) 1. Linux. 2. Operating systems (Computers) I. Title. QA76.76.O63 S788 2000 005.4’32--dc21 00-046057 A note on the type in which this book is set The name of the font family used in this book is Computer Modern. These are free fonts designed by Donald E. Knuth for his TEX typesetting system, and are described in Volume E of the Computers & Typesetting series, Computer Modern Typefaces (Addison–Wesley, 1986). This book was written and produced using the free software tools it describes. It was prepared with Texinfo, a system for generating both hardcopy and electronic output from a single source document. The Texinfo input files were composed in GNU Emacs, and the screen shots were taken and processed with the Image Magick suite of tools. The output was converted to PostScript for printing using Tomas Rokicki’s Dvips, GNU Ghostscript, and Angus Duggan’s PostScript Utilities. The system was a 100MHz 586 personal computer running Debian GNU/Linux 2.2. Preface Because of its robust and stable nature, the Linux-based system is the choice of millions today. But what some may not know is that the free software movement, of which Linux is a part, is very much a counter-cultural phenomenon: the design by which it is produced and published is contrary to the notions of proprietary, intellectual “property” that have dominated mainstream culture so long. While some programmers turn their research into corporate-backed software that you cannot openly change, share, or examine (but only purchase and run on your system), Linux and other free software is the product of many individuals who courageously published and shared their research and work openly, for everyone to benefit from. I wrote this book because I want everyone to know how to use this software, because I think every- one deserves the freedom that comes with it. I don’t willingly use proprietary software—not because it is always inferior to free software but because its use precludes freedoms that I find I cannot exist without . freedoms that should be everyone’s right by default in a free, open society. (See Chapter 1 [Introduction], page 9.) I know that Linux isn’t difficult to use, especially when compared with other software and operating systems, but what was needed was a guide to show people how to use it to get things done: “Oh, you want to do that? Here, type this.” That explains the premise of the book—it’s a hands-on guide to getting things done on a Linux system, designed for the everyday user who is not necessarily a computer programmer. The traditional approach to the subject is to either provide laundry lists of all available commands and applications, or focus on their use in a programming or otherwise technical environment. This book takes a different approach, showing how everyday users—be they artists, designers, businessmen, scholars, or scientists—can use these tools and applications to get things done. When I speak of “things,” I mean (hopefully) the kind of things that you—the sort of person possibly and partially described above— might want to do with a modern computer system: view text and images, play and record sounds, perform mathematic operations, print to your printer, format text, access the Internet, check your grammar, and so forth. Like a culinary cookbook, this book presents “recipes” for preparing or accomplishing a particular, specific thing. I’ve selected what I consider to be the easiest and most effective methods for accomplish- ing particular tasks, and have arranged these recipes in general sections according to subject matter—the first part of the book is all about getting started, and contains the most essential information you need to know about using Linux; the remaining chapters deal with general categories of usage: Files, Text, Images, Sound, Productivity, and Networking. Format of Recipes Each recipe is numbered with at least two figures. These figures are constructed as follows: the first number always corresponds to the chapter number, and the second to the section of the recipe. For example, Chapter 3 is The Shell, and Recipe No. 3.5 is the fifth recipe on shells, Section 3.5 [Recording a Shell Session], page 41. Sometimes recipes are divided into subsections, with a third number specifying the specific recipe— for example, Recipe No. 3.4 is on the subject of command history in the shell, and is divided further into subsections; Recipe No. 3.4.2 is the second recipe on command history, Section 3.4.2 [Specifying a Command from Your History], page 41. Each recipe describes a method for completing a specific task on the system; these tasks require at least one software program. The software programs or files a recipe calls for are its ingredients. The recipes are structured as follows: 1. Recipe number and title of the recipe. 2. Special ingredients, if any. The Debian package(s) and/or or URLs where the program(s) can be obtained are listed, if they are available. The Linux Cookbook: Tips and Techniques for Everyday Use Debian classifies packages in varying level of importance, from ‘required’ packages that all systems must have in order to run, to ‘optional’ and ‘extra’ packages that you only install if you want them. If a described software package is in the first two given categories—‘required’ and ‘important’—then I assume you have it installed, and the package name isn’t listed here. In the rare case that a software package I describe is not yet available as a Debian package, I just give the URL where to obtain the source packages for that software; have your system administrator install it. 3. Special preparation methods or description, if any. When a configurable program is described, the standard setup as provided by the Debian distribution is assumed, unless otherwise specified here. 4. Description of the recipe and “cooking” method proper. 5. Remarks concerning the results and use. 6. Bulleted example of the method in a specific context. 7. Extra commands or actions you might want to do next. 8. Variations on the recipe, with additional examples. 9. Special notes or references to further information. Not all of these items may be present in a given recipe. Assumptions, Scope, and Exclusions There a few assumptions that this book makes about you, the reader, and about your Linux system. The Cookbook assumes that you have at least minimal understanding of your computer hardware— you don’t have to know how to take it apart or anything like that, but you ought to know how to operate the mouse, where the power button is on your computer and monitor, how to load paper in your printer, and so forth. If you need help with any of these tasks or concepts, ask your dealer or the party who set up your computer. This book also assumes that you have Linux installed and properly set up, and that you have your own user account set up on your system. If you need help with this, please see Section 1.3 [If You Need More Help], page 14. While this book can and should be used by the newcomer to Linux, I like to think that I’ve presented broad enough coverage of the Linux-based system, and have included enough interesting or obscure material, so that wizards, hackers, and members of the Linux Cabal may find some of it useful—and that said users will not feel ashamed to have a copy of this book on their desk or as part of their library.