The Linux Cookbook Tips and Techniques For Everyday Use
The Linux Cookbook Tips and Techniques For Everyday Use
The Linux Cookbook Tips and Techniques For Everyday Use
Michael Stutz
San Francisco
The Linux Cookbook. Copyright c 2001, 2002, 2003, 2004 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 mechanical, 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 1 2 3 4 5 6 7 8 9 1004 03 02 01 No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press. Linux is a registered trademark of Linus Torvalds. 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 benet of the trademark owner, with no intention of infringement of the trademark. Publisher: William Pollock Managing Editor: Karol Jurado Cover Design: Octopod Studios Book Design: Michael Stutz Technical Reviewer: John Mark Walker Copyeditor: Andy Carroll Proofreader: Mary Johnson For information on book distribution or translations, 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. Every eort has been made to include only the best free software recipes for accomplishing tasks in the easiest and most ecient manner, and they are believed to be correct. Suggestions, comments, and eld reports are always welcome; the author may be contacted by electronic mail at [email protected].
Library of Congress Cataloging-in-Publication Data Stutz, Michael. Linux cookbook : tips and techniques for everyday use / Michael Stutz.-- 2nd ed. p. cm. Includes index. ISBN 1-59327-031-3 1. Linux. 2. Operating systems (Computers) I. Title. QA76.76.O63 S788 2004 005.4'32--dc22 2003021940
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 (AddisonWesley, 1986). This book was written and produced using the free software tools it describes. It was prepared with Texinfo, a documentation system that uses TEX to generate typeset output. The Texinfo input les were composed in gnu Emacs, and the screen shots were taken and processed with the ImageMagick suite of tools. The dvi output was converted to PostScript for printing using Tomas Rokickis Dvips, gnu Ghostscript, and Angus Duggans PostScript Utilities. The system was a 1,000 MHz 686 personal computer running Debian gnu/Linux 3.0. Updates Visit http://www.nostarch.com/lcbk2.htm for updates, errata, and other information. About the author Michael Stutz was the rst to apply the open source methodology of Linux to non-software works, and was one of the rst reporters to cover Linux and the free software movement in the mainstream press. He has used Linux exclusively for over a decade.
Contents at a Glance
Preface to the Second, Revised Edition . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii I. WORKING WITH LINUX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 What Every Linux User Knows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3 The Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4 The X Window System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 II. FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 5 Files and Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 6 Sharing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 7 Finding Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 8 Managing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 III. TEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 9 Viewing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 10 Editing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 11 Grammar and Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 12 Analyzing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 13 Formatting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 14 Searching Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 15 Typesetting and Word Processing . . . . . . . . . . . . . . . . . . . . . . . . . . 357 16 Using Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 IV. IMAGES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 17 Viewing Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 18 Editing Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 19 Importing Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441 20 PostScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 V. SOUND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 21 Playing and Recording Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 22 Audio Compact Discs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 23 Editing Sound Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 VI. PRODUCTIVITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 24 Disk Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 25 Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 26 Cross-Platform Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 27 Reminders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 28 Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
vi
29 30
Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 VII. NETWORKING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 31 Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 32 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 33 The World Wide Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 34 Other Internet Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671 APPENDICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 Appendix A Administrative Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 Appendix B Conventional File Name Extensions . . . . . . . . . . . . . 723 Appendix C Setting Up Your Home Directory . . . . . . . . . . . . . . . 727 Appendix D References for Further Interest . . . . . . . . . . . . . . . . . . 731 Program Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
vii
Table of Contents
Preface to the Second, Revised Edition . . . . . . xxxiii I. WORKING WITH LINUX . . . . . . . . . . . . . . . . . . . . . . . . . 1 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.1 Recipe Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.2 Preparation of Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.3 Format of Recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.3 Who This Book Assumes You Are . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4 What This Book Wont Show You . . . . . . . . . . . . . . . . . . . . . . . . 10 1.5 What to Try First . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.6 If You Need More Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 1.7 Background and History of Linux . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.7.1 Early Days of unix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.7.2 Genesis of the Free Software Movement . . . . . . . . . . . 16 1.7.3 The Arrival of Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 1.7.4 Debian, Red Hat, and Other Linux Distributions . . 19 1.7.5 The Penguin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.7.6 Open Source, Free Content, and the Future . . . . . . . 20 1.7.7 unix and the Tools Philosophy . . . . . . . . . . . . . . . . . . . 22
2.
viii
2.4 Running a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4.1 Displaying a Tools Available Options . . . . . . . . . . . . 2.4.2 Displaying the Version of a Tool. . . . . . . . . . . . . . . . . . 2.5 Changing Your Password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 Listing User Activity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.6.1 Displaying Your Username . . . . . . . . . . . . . . . . . . . . . . . 2.6.2 Listing Who Is on the System . . . . . . . . . . . . . . . . . . . . 2.6.3 Listing Who Is on and What Theyre Doing . . . . . . . 2.6.4 Listing the Last Time a User Logged In . . . . . . . . . . . 2.7 Listing Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.1 Listing Your Current Processes. . . . . . . . . . . . . . . . . . . 2.7.2 Listing All of a Users Processes . . . . . . . . . . . . . . . . . . 2.7.3 Listing All Processes on the System . . . . . . . . . . . . . . 2.7.4 Listing Processes by Name or Number . . . . . . . . . . . . 2.8 Using the Help Facilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.1 Finding the Right Tool for the Job . . . . . . . . . . . . . . . 2.8.2 Getting a Description of a Program . . . . . . . . . . . . . . 2.8.3 Listing the Usage of a Tool . . . . . . . . . . . . . . . . . . . . . . 2.8.4 Reading a Page from the System Manual . . . . . . . . . 2.8.5 Reading an Info Manual . . . . . . . . . . . . . . . . . . . . . . . . . 2.8.6 Reading System Documentation and Help Files. . . .
36 37 38 38 39 39 39 40 41 41 42 42 42 43 43 44 46 46 46 48 50
3.
The Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.1 Typing at the Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.1 Using Basic Command Line Editing Keys . . . . . . . . . 3.1.2 Typing a Control Character. . . . . . . . . . . . . . . . . . . . . . 3.1.3 Quoting Reserved Characters . . . . . . . . . . . . . . . . . . . . 3.1.4 Letting the Shell Complete What You Type . . . . . . . 3.1.5 Undoing a Mistake at the Command Line . . . . . . . . . 3.1.6 Repeating the Last Command You Typed. . . . . . . . . 3.1.7 Running a List of Commands . . . . . . . . . . . . . . . . . . . . 3.1.8 Running One Command and Then Another . . . . . . . 3.1.9 Running One Command or Another . . . . . . . . . . . . . . 3.1.10 Automatically Answering a Command Prompt . . . 3.1.11 Specifying the Output of a Command as an Argument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1.12 Typing a Long Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 54 55 56 61 62 62 63 64 64 65 65 66
ix
3.2 Redirecting Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2.1 Redirecting Input to a File. . . . . . . . . . . . . . . . . . . . . . . 3.2.2 Redirecting Output to a File . . . . . . . . . . . . . . . . . . . . . 3.2.3 Redirecting Error Messages to a File . . . . . . . . . . . . . 3.2.4 Redirecting Output to Another Commands Input .................................................. 3.2.5 Redirecting Output to More than One Place . . . . . . 3.2.6 Redirecting Something to Nowhere . . . . . . . . . . . . . . . 3.3 Managing Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Suspending a Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Putting a Job in the Background . . . . . . . . . . . . . . . . . 3.3.3 Putting a Job in the Foreground . . . . . . . . . . . . . . . . . 3.3.4 Listing Your Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.5 Stopping a Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Using Your Command History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 Viewing Your Command History . . . . . . . . . . . . . . . . . 3.4.2 Searching Through Your Command History . . . . . . . 3.4.3 Specifying a Command from Your History . . . . . . . . 3.5 Using Shell Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.1 Assigning a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.2 Referencing a Variable. . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.3 Displaying the Contents of a Variable . . . . . . . . . . . . . 3.5.4 Removing a Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.5 Listing Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.6 Changing the Shell Prompt . . . . . . . . . . . . . . . . . . . . . . 3.5.7 Adding to Your Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.5.8 Controlling How the Shell Checks Your Mail . . . . . . 3.5.9 Seeing How Long Your Shell Has Been Running . . . 3.6 Using Alias Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 Calling a Command by Some Other Name . . . . . . . . 3.6.2 Listing Aliases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.3 Removing an Alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7 Using Shell Scripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1 Making a Shell Script . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.2 Running a Shell Script . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.3 Using Shell Startup Files . . . . . . . . . . . . . . . . . . . . . . . . 3.8 Making a Typescript of a Shell Session . . . . . . . . . . . . . . . . . . . .
67 67 68 68 69 69 70 70 71 72 73 73 73 74 74 75 76 77 78 78 79 79 80 80 81 82 82 82 83 84 84 84 85 85 86 88
Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting a Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exiting a Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Getting the Name of Your Current Shell . . . . . . . . . . Changing Your Default Shell . . . . . . . . . . . . . . . . . . . . . Using Other Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90 90 91 91 91 92
4.
xi
xii
6.
7.
xiii
8.
xiv
9.2 Displaying Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2.1 Displaying Non-Printing Characters . . . . . . . . . . . . . 9.2.2 Displaying the Beginning Part of Text . . . . . . . . . . . 9.2.3 Displaying the End Part of Text . . . . . . . . . . . . . . . . 9.2.4 Displaying the Middle Part of Text . . . . . . . . . . . . . . 9.2.5 Displaying the Text Between Strings. . . . . . . . . . . . . 9.2.6 Displaying the Literal Characters of Text . . . . . . . . 9.2.7 Displaying the Hex Values of Text . . . . . . . . . . . . . . . 9.3 Viewing Special Types of Text . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.3.1 Viewing html-Formatted Text . . . . . . . . . . . . . . . . . . 9.3.2 Viewing Nroff-Formatted Text . . . . . . . . . . . . . . . . 9.3.3 Viewing C Program Source Code . . . . . . . . . . . . . . . . 9.3.4 Viewing Lines of Sorted Text . . . . . . . . . . . . . . . . . . . 9.3.5 Viewing Underlined Text . . . . . . . . . . . . . . . . . . . . . . . 9.3.6 Listing Text in Binary Files . . . . . . . . . . . . . . . . . . . . . 9.3.7 Viewing a Character Set . . . . . . . . . . . . . . . . . . . . . . . .
216 217 218 218 219 220 221 221 223 223 224 224 226 226 228 228
10.
xv
10.6 Concatenating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10.6.1 Writing Text to Files . . . . . . . . . . . . . . . . . . . . . . . . . . 10.6.2 Appending Text to a File . . . . . . . . . . . . . . . . . . . . . . 10.6.3 Inserting Text at the Beginning of a File . . . . . . . . 10.7 Including Text from Other Files . . . . . . . . . . . . . . . . . . . . . . . . 10.8 Using Other Text Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.
12.
xvi
12.2 Listing Words in Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2.1 Listing All of the Words in Text . . . . . . . . . . . . . . . 12.2.2 Listing the Words in Text Sorted Alphabetically ................................................. 12.2.3 Listing Only the Unique Words in Text . . . . . . . . . 12.2.4 Counting Word Occurrences in Text . . . . . . . . . . . . 12.2.5 Counting Selected Word Occurrences in Text . . . . 12.3 Finding Relevancies in Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.3.1 Finding Similar or Relevant Text . . . . . . . . . . . . . . . 12.3.2 Listing Relevant Files in Emacs . . . . . . . . . . . . . . . .
13.
xvii
13.6 Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.6.1 Sorting Text Regardless of Spacing . . . . . . . . . . . . . 13.6.2 Sorting Text Regardless of Case . . . . . . . . . . . . . . . . 13.6.3 Sorting Text in Numeric Order . . . . . . . . . . . . . . . . . 13.6.4 Sorting Text in Directory Order . . . . . . . . . . . . . . . . 13.7 Columnating Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.7.1 Pasting Columns of Text from Separate Files. . . . 13.7.2 Columnating Text from Separate Files . . . . . . . . . . 13.7.3 Columnating a List . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.7.4 Removing Columns from Text . . . . . . . . . . . . . . . . . 13.8 Numbering Lines of Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.9 Underlining Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.9.1 Placing Underlines in Text . . . . . . . . . . . . . . . . . . . . . 13.9.2 Converting Underlines in Text . . . . . . . . . . . . . . . . . 13.9.3 Removing Underlines from Text . . . . . . . . . . . . . . . . 13.10 Reversing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.10.1 Reversing Lines of Text . . . . . . . . . . . . . . . . . . . . . . 13.10.2 Reversing the Characters on Lines . . . . . . . . . . . .
320 321 321 322 322 322 322 323 323 324 326 327 328 328 329 330 330 331
14.
xviii
14.5 Showing Matches in Context . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.5.1 Showing Matched Lines in Their Context . . . . . . . 14.5.2 Highlighting Matches on Their Lines . . . . . . . . . . . 14.5.3 Showing Only the Matched Patterns from Input ................................................. 14.5.4 Showing Which Files Contain Matching Lines . . . 14.6 Keeping a File of Patterns to Search For . . . . . . . . . . . . . . . . 14.7 Searching More than Plain Text Files . . . . . . . . . . . . . . . . . . . 14.7.1 Matching Lines in Many Files . . . . . . . . . . . . . . . . . . 14.7.2 Matching Lines in Compressed Files . . . . . . . . . . . . 14.7.3 Matching Lines in Web Pages . . . . . . . . . . . . . . . . . . 14.7.4 Matching Lines in Binary Files . . . . . . . . . . . . . . . . . 14.8 Searching and Replacing Text . . . . . . . . . . . . . . . . . . . . . . . . . . 14.9 Searching Text in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.9.1 Searching Incrementally in Emacs . . . . . . . . . . . . . . 14.9.2 Searching for a Phrase in Emacs . . . . . . . . . . . . . . . 14.9.3 Searching for a Regexp in Emacs . . . . . . . . . . . . . . . 14.9.4 Searching and Replacing in Emacs . . . . . . . . . . . . . 14.10 Searching Text in Vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14.11 Searching the Text Youre Perusing . . . . . . . . . . . . . . . . . . . .
344 345 345 347 347 348 348 348 349 350 350 351 352 352 353 353 353 354 354
15.
xix
15.3 Using TEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . a 15.3.1 Distinguishing Between TEX and L TEX Files . . . . 15.3.2 Processing a TEX File . . . . . . . . . . . . . . . . . . . . . . . . . a 15.3.3 Processing a L TEX File . . . . . . . . . . . . . . . . . . . . . . . a 15.3.4 Getting Started with TEX and L TEX . . . . . . . . . . . a 15.3.5 Using TEX and L TEX Document Templates . . . . . 15.4 Using LyX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.4.1 Getting Started with LyX . . . . . . . . . . . . . . . . . . . . . 15.4.2 Learning More About LyX . . . . . . . . . . . . . . . . . . . . 15.5 Using groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.5.1 Processing a groff File . . . . . . . . . . . . . . . . . . . . . . . 15.5.2 Determining the Command Line Options for a Groff File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.5.3 Running a groff Tutorial . . . . . . . . . . . . . . . . . . . . . 15.5.4 Making a Chart or Table . . . . . . . . . . . . . . . . . . . . . . 15.6 Using sgml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15.6.1 Writing an sgml Document . . . . . . . . . . . . . . . . . . . 15.6.2 Checking sgml Document Syntax . . . . . . . . . . . . . . 15.6.3 Generating Output from sgml . . . . . . . . . . . . . . . . . 15.7 Using Other Word Processors and Typesetting Systems . .
372 373 374 374 375 376 378 379 381 383 383 384 385 385 388 389 390 390 391
16.
xx
17.
18.
19.
xxi
19.4 Turning Text into an Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 19.5 Using Other Image Import Tools . . . . . . . . . . . . . . . . . . . . . . . 449
20.
PostScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
20.1 Manipulating PostScript Pages . . . . . . . . . . . . . . . . . . . . . . . . . 20.1.1 Extracting dvi Pages to PostScript . . . . . . . . . . . . . 20.1.2 Extracting Pages from a PostScript File . . . . . . . . 20.1.3 Combining PostScript Pages . . . . . . . . . . . . . . . . . . . 20.1.4 Arranging PostScript Pages in Signatures . . . . . . . 20.2 Manipulating PostScript Documents . . . . . . . . . . . . . . . . . . . . 20.2.1 Resizing a PostScript Document . . . . . . . . . . . . . . . 20.2.2 Combining PostScript Documents . . . . . . . . . . . . . . 20.2.3 Arranging a PostScript Document in a Booklet . . 20.3 Converting PostScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20.3.1 Converting PostScript to pdf . . . . . . . . . . . . . . . . . . 20.3.2 Converting PostScript to Plain Text . . . . . . . . . . . . 452 452 452 454 455 456 456 457 458 459 460 460
xxii
22.
23.
xxiii
24.
25.
Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
25.1 Making and Managing Print Jobs . . . . . . . . . . . . . . . . . . . . . . . 25.1.1 Sending a Print Job to the Printer . . . . . . . . . . . . . 25.1.2 Printing Multiple Copies of a Job . . . . . . . . . . . . . . 25.1.3 Listing Your Print Jobs . . . . . . . . . . . . . . . . . . . . . . . 25.1.4 Canceling a Print Job . . . . . . . . . . . . . . . . . . . . . . . . . 25.2 Other Things You Can Print . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2.1 Printing a Printer Test Strip . . . . . . . . . . . . . . . . . . . 25.2.2 Printing Certain Pages of a PostScript File . . . . . 25.2.3 Printing an Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2.4 Printing a Web Page . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2.5 Printing a dvi File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.2.6 Printing an Emacs Buer . . . . . . . . . . . . . . . . . . . . . . 25.2.7 Printing an Info Node . . . . . . . . . . . . . . . . . . . . . . . . . 25.2.8 Printing the Contents of a Terminal Window . . . . 25.3 Preparing Files for Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25.3.1 Preparing a PostScript File for Printing . . . . . . . . 25.3.2 Preparing a dvi File for Printing . . . . . . . . . . . . . . . 25.3.3 Preparing a pdf File for Printing . . . . . . . . . . . . . . 25.3.4 Preparing a Manual Page for Printing . . . . . . . . . . 25.3.5 Preparing Text for Printing . . . . . . . . . . . . . . . . . . . . 509 510 510 510 511 512 513 513 514 514 515 516 517 518 518 518 520 521 522 522
26.
xxiv
26.2 Using Macintosh Disks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.2.1 Specifying the Macintosh Disk to Use. . . . . . . . . . . 26.2.2 Listing the Contents of a Macintosh Disk . . . . . . . 26.2.3 Copying Files to and from a Macintosh Disk . . . . 26.2.4 Deleting Files on a Macintosh Disk . . . . . . . . . . . . . 26.2.5 Formatting a Macintosh Disk . . . . . . . . . . . . . . . . . . 26.3 Mounting Windows and nt partitions . . . . . . . . . . . . . . . . . . . 26.4 Converting Text Files Between dos and Linux . . . . . . . . . . . 26.5 Converting Microsoft Word Files. . . . . . . . . . . . . . . . . . . . . . . . a 26.5.1 Converting Word to L TEX . . . . . . . . . . . . . . . . . . . . . 26.5.2 Converting Word to Plain Text . . . . . . . . . . . . . . . . 26.6 Converting Text from Proprietary Formats . . . . . . . . . . . . . . 26.7 Managing zip Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.7.1 Zipping Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.7.2 Unzipping Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26.8 Using Other Cross-Platform Conversion Tools . . . . . . . . . . .
527 527 528 528 528 529 529 530 531 532 533 533 533 534 535 535
27.
Reminders. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
27.1 Displaying the Date and Time . . . . . . . . . . . . . . . . . . . . . . . . . . 27.1.1 Displaying the Day of the Year. . . . . . . . . . . . . . . . . 27.1.2 Displaying the Minute of the Hour . . . . . . . . . . . . . 27.2 Playing an Audible Time Announcement . . . . . . . . . . . . . . . . 27.3 Using Calendars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.3.1 Displaying a Calendar . . . . . . . . . . . . . . . . . . . . . . . . . 27.3.2 Displaying a Calendar in Emacs . . . . . . . . . . . . . . . . 27.4 Managing Appointments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.4.1 Making an Appointment File . . . . . . . . . . . . . . . . . . 27.4.2 Including Holidays in Your Reminders . . . . . . . . . . 27.4.3 Automatic Appointment Delivery . . . . . . . . . . . . . . 27.5 Using Contact Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27.5.1 Keeping a Free-Form Address List. . . . . . . . . . . . . . 27.5.2 Keeping a Contact Manager Database . . . . . . . . . . 27.6 Reminding Yourself of Things . . . . . . . . . . . . . . . . . . . . . . . . . . 27.6.1 Reminding Yourself When You Have to Leave . . . 27.6.2 Sending Yourself Email Reminders . . . . . . . . . . . . . 27.7 Telling Others You Are Away . . . . . . . . . . . . . . . . . . . . . . . . . . 27.8 Reviewing What You Did Today . . . . . . . . . . . . . . . . . . . . . . . . 27.9 Using Other Reminder Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 538 538 539 539 539 541 542 543 544 545 546 546 548 549 550 550 551 552 553
xxv
28.
Scheduling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
28.1 Running a Command on a Delay . . . . . . . . . . . . . . . . . . . . . . . 28.2 Running a Command on a Timer . . . . . . . . . . . . . . . . . . . . . . . 28.2.1 Listing the Jobs Scheduled to Run . . . . . . . . . . . . . 28.2.2 Deleting a Job Scheduled to Run . . . . . . . . . . . . . . . 28.3 Scheduling Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.1 Adding a cron Job . . . . . . . . . . . . . . . . . . . . . . . . . . . 28.3.2 Removing a cron Job. . . . . . . . . . . . . . . . . . . . . . . . . 28.3.3 Listing Your cron Jobs . . . . . . . . . . . . . . . . . . . . . . . 28.4 Watching a Command from Time to Time . . . . . . . . . . . . . . . 555 556 557 557 557 558 558 559 559
29.
Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
29.1 Calculating Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.1.1 Making a Quick Arithmetic Calculation. . . . . . . . . 29.1.2 Using a Calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.2 Outputting a Random Number . . . . . . . . . . . . . . . . . . . . . . . . . 29.3 Listing a Sequence of Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 29.4 Finding Prime Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.5 Converting Amounts and Numbers . . . . . . . . . . . . . . . . . . . . . . 29.5.1 Converting an Amount Between Units of Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.5.2 Converting an Arabic Numeral to English . . . . . . . 29.6 Using rot13 Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.6.1 Encoding Text in rot13 . . . . . . . . . . . . . . . . . . . . . . 29.6.2 Decoding Text in rot13 . . . . . . . . . . . . . . . . . . . . . . 29.7 Using gpg Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.7.1 Encrypting Data with gpg . . . . . . . . . . . . . . . . . . . . 29.7.2 Decrypting Data with gpg . . . . . . . . . . . . . . . . . . . . 29.8 Plotting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29.8.1 Making Graphs with a Single Data Set . . . . . . . . . 29.8.2 Making Graphs with Multiple Data Sets . . . . . . . . 29.9 Using Other Mathematics Tools . . . . . . . . . . . . . . . . . . . . . . . . 561 561 562 565 565 567 567 567 568 569 570 571 572 574 575 575 575 577 579
30.
Amusements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
30.1 30.2 30.3 30.4 Playing Classic unix Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . Filtering Text Through a Dialect . . . . . . . . . . . . . . . . . . . . . . . Testing Your Typing Speed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying Random Quotations . . . . . . . . . . . . . . . . . . . . . . . . . 583 586 587 587
xxvi
30.5 Finding Matches for Word Games. . . . . . . . . . . . . . . . . . . . . . . 30.5.1 Finding Anagrams in Text . . . . . . . . . . . . . . . . . . . . . 30.5.2 Finding Palindromes in Text . . . . . . . . . . . . . . . . . . . 30.5.3 Finding Crossword Puzzle Words . . . . . . . . . . . . . . . 30.6 Cuting Up Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30.6.1 Making Simple Text Cut-Ups . . . . . . . . . . . . . . . . . . 30.6.2 Making Random Word Cut-Ups . . . . . . . . . . . . . . . . 30.6.3 Making Cut-Ups in Emacs . . . . . . . . . . . . . . . . . . . . . 30.7 Undergoing Psychoanalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32.
Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
32.1 Sending Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.1 Mailing a User on the Same System . . . . . . . . . . . . 32.1.2 Mailing a File or the Output of a Command . . . . 32.1.3 Mailing a Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.4 Mailing a Web Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.1.5 Composing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Receiving Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2.1 Showing a List of Mail Headers . . . . . . . . . . . . . . . . 32.2.2 Deleting Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2.3 Undeleting Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2.4 Replying to Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2.5 Saving Mail to a File . . . . . . . . . . . . . . . . . . . . . . . . . . 612 613 613 613 614 616 617 618 619 619 620 620
xxvii
32.3 Using a Remote Mail Host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.3.1 Using Mozilla for Mail. . . . . . . . . . . . . . . . . . . . . . . . . 32.3.2 Fetching pop Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.4 Managing Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.4.1 Viewing a Mail Folder . . . . . . . . . . . . . . . . . . . . . . . . . 32.4.2 Setting Notication for New Mail . . . . . . . . . . . . . . 32.4.3 Counting How Many Messages You Have . . . . . . . 32.4.4 Seeing Who Your Mail Is From . . . . . . . . . . . . . . . . 32.4.5 Verifying an Email Address . . . . . . . . . . . . . . . . . . . . 32.4.6 Searching Mail Archives . . . . . . . . . . . . . . . . . . . . . . . 32.5 Using Mail Attachments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.5.1 Reading a Mail Attachment. . . . . . . . . . . . . . . . . . . . 32.5.2 Sending a Mail Attachment . . . . . . . . . . . . . . . . . . . . 32.6 Using an Email Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.7 Using Other Mail User Agents . . . . . . . . . . . . . . . . . . . . . . . . . .
621 621 622 622 622 624 625 626 627 627 628 628 629 631 631
33.
xxviii
33.5 Getting Files from the Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.5.1 Downloading an url . . . . . . . . . . . . . . . . . . . . . . . . . . 33.5.2 Archiving an Entire Web Site . . . . . . . . . . . . . . . . . . 33.5.3 Archiving Part of a Web Site . . . . . . . . . . . . . . . . . . 33.5.4 Reading the Headers of a Web Page . . . . . . . . . . . . 33.6 Keeping a Browser History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.6.1 Viewing Your Browser History . . . . . . . . . . . . . . . . . 33.6.2 Searching Through Your Browser History . . . . . . . 33.7 Setting Up a Start Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.8 Listing the urls in Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.9 Writing html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.9.1 Adding Parameters to Image Tags . . . . . . . . . . . . . . 33.9.2 Converting html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.9.3 Validating html . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.10 Analyzing Your Web Trac . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.11 Using Other Web Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . .
653 654 654 655 656 656 657 657 658 659 661 663 663 665 666 667
34.
xxix
34.7 Chatting with Other Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.7.1 Sending a Message to Another Users Terminal . . 34.7.2 Denying Messages to Your Terminal . . . . . . . . . . . . 34.7.3 Chatting Directly with a User. . . . . . . . . . . . . . . . . . 34.7.4 Chatting on irc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.7.5 Chatting on icq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34.7.6 Using im Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.1 Setting Up Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.1.1 Determining Which Hardware Is Compatible . . . . A.1.2 Setting the System Date and Time. . . . . . . . . . . . . . A.1.3 Specifying Mount Points for Certain Devices. . . . . A.1.4 Making a Boot Floppy . . . . . . . . . . . . . . . . . . . . . . . . . A.1.5 Removing a Master Boot Record . . . . . . . . . . . . . . . A.1.6 Setting Up a Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2 Shutting Down the System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2.1 Shutting Down Immediately . . . . . . . . . . . . . . . . . . . . A.2.2 Shutting Down at a Certain Time . . . . . . . . . . . . . . A.2.3 Canceling a Shutdown . . . . . . . . . . . . . . . . . . . . . . . . . A.2.4 Going into Maintenance Mode . . . . . . . . . . . . . . . . . . A.3 Managing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3.1 Getting and Installing a Linux Distribution . . . . . . A.3.2 Installing Packages for Your Linux Distribution . . A.3.3 Installing a Source Package . . . . . . . . . . . . . . . . . . . . . A.3.4 Installing a Shell Script . . . . . . . . . . . . . . . . . . . . . . . . A.4 Managing deb Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.1 Listing deb Packages . . . . . . . . . . . . . . . . . . . . . . . . . . A.4.2 Installing a deb Package . . . . . . . . . . . . . . . . . . . . . . . A.4.3 Upgrading a deb Package . . . . . . . . . . . . . . . . . . . . . . A.4.4 Removing a deb Package . . . . . . . . . . . . . . . . . . . . . . A.4.5 Getting the Status of a deb Package . . . . . . . . . . . . A.4.6 Listing All Files in a deb Package . . . . . . . . . . . . . . A.4.7 Listing the deb Package a File Is a Part Of. . . . . . A.4.8 Listing Dependences for a deb Package . . . . . . . . .
xxx
A.5 Managing rpm Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.5.1 Listing rpm Packages . . . . . . . . . . . . . . . . . . . . . . . . . . A.5.2 Installing an rpm Package . . . . . . . . . . . . . . . . . . . . . A.5.3 Upgrading an rpm Package . . . . . . . . . . . . . . . . . . . . A.5.4 Removing an rpm Package . . . . . . . . . . . . . . . . . . . . . A.5.5 Getting the Status of an rpm Package . . . . . . . . . . A.5.6 Listing All Files in an rpm Package . . . . . . . . . . . . . A.5.7 Listing the rpm Package a File Is a Part Of . . . . . A.5.8 Listing Dependences for an rpm Package . . . . . . . . A.6 Administrating Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.6.1 Making a User Account . . . . . . . . . . . . . . . . . . . . . . . . A.6.2 Seeing Which Users Exist on the System . . . . . . . . A.6.3 Letting Users Access Hardware Peripherals . . . . . . A.6.4 Letting Users Mount Drives . . . . . . . . . . . . . . . . . . . . A.7 Displaying Information About Your System . . . . . . . . . . . . . . A.7.1 Displaying How Long the System Has Been Up . . A.7.2 Displaying cpu Type . . . . . . . . . . . . . . . . . . . . . . . . . . A.7.3 Displaying Memory Usage . . . . . . . . . . . . . . . . . . . . . . A.7.4 Displaying the Linux Version . . . . . . . . . . . . . . . . . . . A.7.5 Displaying the Distribution Version . . . . . . . . . . . . .
714 715 715 715 716 716 716 716 717 717 717 717 718 718 718 719 719 720 720 720
Appendix B. Conventional File Name Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Appendix C. Setting Up Your Home Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
C.1 C.2 C.3 C.4 C.5 Using Using Using Using Using a a a a a Directory Directory Directory Directory Directory for for for for for Personal Binaries . . . . . . . . . . . . . . . . . . Personal Lists and Data . . . . . . . . . . . . Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Projects. . . . . . . . . . . . . . . . . . . . . . . . . . . Temporary Files . . . . . . . . . . . . . . . . . . . 727 728 728 729 729
xxxi
D.2 Linux Books and Guides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.2.1 General Linux Guides and Instruction. . . . . . . . . . . D.2.2 Linux Tool and Application Guides . . . . . . . . . . . . . D.2.3 Unix and Linux History Books . . . . . . . . . . . . . . . . . D.3 Linux News and Commentary . . . . . . . . . . . . . . . . . . . . . . . . . . .
xxxii
xxxiii
xxxiv
The core melds, picks up new features, renes or discards others, but somehow it lingers and remains. In that sense it is the only part worth dwelling on. In the 1970s, typing ls from a hardware terminal to list the les in a directory worked much the same as it does today on Linux. This inner core is the language of unix, and it is the foundation upon which the entire system is laid. It has always been my desire to clearly and completely teach that foundation in the Cookbook, and I hope that the product you now hold may be of more worth, and resonate longer, than something that only chases after the sleek contours and momentary luster of the latest and already fading outer shell, while leaving so much of the inner magic still a mystery. And so here it is: A new edition that gives, to the reader, a book whose substance was improved, its horizons broadenedand to the author, a chance to do a second take, to trim and burnish, to attempt renement of a work once labored on. I hope you likewise nd the journey suciently rewarding.
Chapter 1: Introduction
1. Introduction
Before we start cooking, well get some preliminaries out of the way in this chapter, which explains both how the book is organized and the conventions that are used throughout it. It also shows you where to begin if youre new to Linux, and how to get more help, should you need it. It concludes with a short background history of the software that is the subject of the book. The rest of the book is all recipes, which are categorized by the tasks they perform or the objects they work onsuch as text, les, images, and so forth. This rst part of the book explains the general techniques and methods for working with Linuxincluding how to get the system ready for use, how to run commands on the system, which commands every Linux user knows, and how to use the interfaces that come with Linux.
1.1 Recipes
Recipes are methods for accomplishing a particular task on Linux. Recipes are organized into chapters, which deal with one specic kind of task, such as Viewing Text or Editing Images. Chapters are often concluded with a table of hints identifying more applications or tools pertinent to the subject of that chapter.
You might not have all of these programs installed on your system and ready for use, so recipes commence with a listing of the programs it uses and the packages or urls where you can nd them. Ingredients that most everyone is sure to have on hand are omitted from this listing. For example, the ls command for listing les in a directory will be available on all systems, so its listing is always omitted. The rule of measure for determining whether an ingredient is listed or not comes from the Debian distribution, which classies packages in varying levels of importance, from the Required packages that all systems absolutely must have in order to run, to Optional and Extra packages that you only install if you want them. If its Required or Important to Debian, then its a very common program no matter what your distribution, and I dont need to list it.
Chapter 1: Introduction
3.3.6-29.sparc.html which, according to the page for XFree86 on rpmfind.net, is the package for vga16 video cards on the sparc platform. The sources and binaries for these programs are usually available unpackaged, too; the location from where they can be retrieved on the World Wide Web is listed, if available. Use these sources for distributions that use neither package format (Slackware is the prime example), or for those odd cases where a deb or rpm doesnt exist for some program. (Sometimes, the home page will contain the sources in one or both of these package formats anyway.) Web sites are transient; if you cannot nd the source package for a program, you can always obtain the sources from Debians package site [http://packages.debian.org/], where each package has its own page containing a link with a .tar.gz archive of its sources. 5. Special preparation or setup, if any. If you must be the superuser or require special privileges to run the command, this is noted here. When a congurable program is described, the standard setup as provided by the Debian distribution is assumed, unless otherwise specied here. 6. Cooking method proper. 7. Remarks concerning the results and use. 8. At least one example of the method in a specic context, set o from the text by an arrow. If the example takes several steps to perform, these steps are then enumerated. Where multiple examples are given, each is set o from the text by a bullet. 9. Variations on the standard preparation, with additional examples. 10. Extra commands or actions you might want to do next. Some programs take a number of options that modify the way they work. Sometimes, various options that a tool takes are listed in a table. These lists are not always exhaustive; rather, they contain the most popular or useful options, or those options that are relevant to the discussion at hand. Consult the online manual page of a particular tool for the complete listing (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46). 11. Special notes of caution or interest. 12. Sources of further information. Not all of these items will be present in every recipe.
A border is also drawn around shell scripts and other program listings that are to be typed in. In examples where a shell prompt is displayed, the default current working directory is omitted in the prompt, and a $ is used on its own; when a command outputs text and then exits, the last line of an example contains a $ character to denote the return to a shell prompt. Dont worry if this sounds strange to you now; all of this shell business is explained in Chapter 3 [The Shell], page 53. Borders are not drawn around one-liner examples showing commands that return to the shell prompt without giving any output, or commands
Chapter 1: Introduction
whose output is not particularly relevant to the example. The returning shell prompt is omitted here, too. The names of les or directories appear in the text as file; commands appear as command, and strings of text are typeset like some text; options, application modes and menu items, function names, and variable names are all set in this same typewriter font. Text you are intended to type is written like this, just as in the examples. When you are meant to press a specic key on the keyboard, its conventional name is given displayed in a key box. For example, Q represents the Q key on the keyboard, and RET denotes the Return key on the keyboard for typing a newline.1 So where I say, To do this, type: and then give a sample command line, the text you actually type is presented like this and the text that is output by the system is presented like this. Keys you are to press, as opposed to characters you literally type, are given as a key box. For example, pressing the F key is denoted by F , while just typing an uppercase F is denoted by F, and typing a lowercase f by f. In examples where keys are meant to be pressed and held down together, the keys are connected together with hyphens; the hyphens are not meant to be literally pressed. For example, pressing the CTRL , ALT , and DEL keys, and holding them down at the same time, is a combination that has meaning in some operating systems (including Linux, where this keystroke shuts down the system and reboots the computer); it is represented like this:
CTRL - ALT - DEL
In the same way, keys that are meant to be pressed one after another are separated by a space; the space is not to be literally typed. So for a keystrokes such as this:
RET RET
you would press the carriage return key, and then press the carriage return key again, but do not type a space between them. The same goes for text followed by a keyfor example, a physical space appears in the book between commands and the nal RET that ends a command line, and it should not be literally typed (although there is often no consequence for actually typing this space). Where explicitly pressing the space bar is called for, that key is represented in examples as SPACEBAR .
1
This key is labeled Enter on some keyboards, while still others have only an arrow going downward and then pointing to the left like the old carriage return of typewriters.
Excepting a few special three-key combinations, the CTRL (Control) key is always used in combination with one other key. First, the CTRL key is pressed, and, while it is still depressed, the second key is pressed; then, both keys are released. This is a control-key combination. Control keys have special meanings that are applicable in most programs. For example, the Control-C combination, depressing the CTRL key and then pressing C , is the cancel command, which cancels or breaks out of whatever command is running. There are three ways these control key combinations are denoted in writing. The traditional way is with a caret (^) followed by the capital letter of the second key in the combination. For example, to represent Control-C in this way, one would write ^C. This is called hat notation. The second way is to use C- (to represent the CTRL key) followed by the lowercase letter of the second key. So to represent the Control-C key combination in this manner, one would write C-c. This notation is used by the gnu Emacs editor and its corresponding gnu documentation (see Recipe 10.1 [Using Emacs], page 232), so I call it gnu notation. The third way to represent control-key combinations is to show a literal key followed by a hyphen and the second key to press. So Control-C would be written as CTRL - C . I call this key notation, and it is the notation used throughout this book.
CTRL
To type one of these combinations, press and hold key, and then release both keys.
CTRL
For example, to type Control-D, which may be written as ^D, C-d or CTRL - D , press and hold CTRL , type the D key, and then release both keys. In some applications, the META key is used in the same way as CTRL . gnu Project programs and documentation denote META key combinations by M-x, where x is the second key in the combination. Most keyboards today dont have a META key, of course; where you see reference to this key, just use the ALT key. Throughout this book, Ill write these combinations in key notation with ALT instead of META , since the former key is most often the actual key in use. So to type M-c, press and hold both keys.
ALT
, press the
Chapter 1: Introduction
You can often get the same eect by pressing and releasing ESC , and then pressing the second key. Do this if your keyboard doesnt have an ALT key, or if your ALT isnt set up as the META key.2 To type M-c without using ALT , press and release ESC , and then press and release the C key. Both CTRL and ALT sequences are not case-sensitive; that is, pressing a capital C to make the last example is the same as pressing the lowercase c (although c is certainly easier to type, if Caps Lock is o). In gnu notation, the C- or M- prex is always given as an uppercase letter, and the key that follows is always given as a lowercase letter. The convention for hat notation is to always use an uppercase letter for the control key. Furthermore, some programs take commands that are a combination of key combinations and sequences, and so the hyphen and space representations can be combined. For instance, if a command is to press and hold CTRL , press X and release both keys, and then type a lowercase letter q, this will be denoted in the text as:
CTRL - X
And nally, a remark on quoted punctuation. In the Internet age it has become a trend, away from the American printing convention, to place trailing punctuation outside of the quotation. The argument is that computers cannot recognize the punctuation for what it is, and assume it is part of the literal characters being quoted. We operators dont want to confuse the machine, so we keep this trailing punctuation outside the quotes. First it was adopted in the computer programming languages (not a one, to my knowledge, accepts text written in the American convention), and then in the technical manuals and computer books, and it is now becoming widespread throughout other literature, especially in online publications. But we human beings understand punctuation, and it is for us that it exists. We should make systems that work for us, and print words the way we intend to write themnot bend our own expressions to t the tooth of a sprocket.
If your keyboard has a Windows key, then this key, and not ALT , may be set up as the META key. You will have to experiment to see which combination works on your system.
10
The Cookbook assumes that you have at least minimal understanding of your computeryou know that the hardware is the machinery itself, and the software is the instructions that run on it. You dont have to know how to take your system 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 already have Linux installed and properly set up, and that you have your own user account set up on your system (making a user account is described in Recipe A.6.1 [Making a User Account], page 717; if you need help with installation and setup, please see Recipe 1.6 [If You Need More Help], page 13). No one distribution of Linux is assumed, and any specialties for any one of them in the text are identied as such. While this book can and should be used by the newcomer to Linux, I like to think that Ive presented broad enough coverage of the Linux-based system, and have included enough interesting or obscure material, so that gurus, hackers, and members of the Linux Cabal may nd some of it new and usefuland that any such user will not feel ashamed to have a copy of this book on his desk or as part of his library. There is another assumtion this book makes that is of importance only to such gurus and old-timers. The Bash shell, as you gurus know, may be thought of as the default shell of Linux; because this is so, it is the shell assumed for all examples in this book. So if you have experience with another shell, take note of the dierencesyou may nd examples that do not work in your favorite non-Bash shell (for example, the command locate *txt will not work as intended in Csh).
Chapter 1: Introduction
11
must be added to the equation: Dick will go through a dierent procedure installing Linux on his Dell pc with usb that came with Windows 2000 pre-installed on it as Jane will installing Linux on her Apple iPOD. If you are a computer beginner, and not technically procient enough to install an operating system and make the requisite hardware adjustments, your best bets are the following: a. Purchase a computer with Linux pre-installed. b. Have a Linux-savvy friend install it for you. c. Take your system to your local Linux User Group (lug) and have them do it for you while you watch. They frequently run InstallFests for such purpose. 2. Use proprietary software. The very reason I use Linux and recommend it to others is because it is not proprietary, but is published in such a way so that anyone can examine the software, share it with others, and adapt it to his needs. I dont use proprietary software at all and dont know the rst thing about it. Therefore, there will be no proprietary software in this book. 3. Use experimental software. There are thousands of software programs available for Linux, and I cover a good deal of the most popular and important ones. What I omit are the software packages that are currently in a beta or some other unstable release not yet intended for the general public. 4. Secure your system. The specialized topic of security is suciently large to warrant its own book. 5. Become a system administrator. The basic tasks of system administration for the home user are described in Appendix A [Administrative Issues], page 699, which is enough to get you going successfully; for more detail than this, you will need a specialized book on the subject. I recommend the Linux System Administrators Guide, which should be available right on your system (for how to access it, see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50). 6. Administrate a network. There are too many kinds of networks, and this is most often a technical and not user-based application. The Linux Network Administrators Guide is recommended for this purpose (see Appendix D [References For Further Interest], page 731). 7. Use Linux in software development. Program development, compilation, and software project management are out of this books scope. However,
12
the programmer will nd much of the material in this book useful for his task. 8. Use Linux in other specialized elds. Everything in this book should be useful to you, whether you are a music composer, biochemist, schoolteacher, secretary, or whatever. However, this book will have no specic sections for Using Linux for Music Composition, Using Linux in Biochemistry Research, Using Linux in the Classroom, or A Secretarys Guide to Linux, although Linux is used in such elds of endeavor to great success. Reports, papers, Web sites and even books have been written on the use of Linux in innumerable special elds, and its applications are growing. In the Cookbook, I cover the basics of using Linux as a general tool, regardless of your specic eld or interest. 9. Use a non-Linux system. Most of the free software described in this book has been ported to other systems, particularly to other avors of unix. The recipes in this book should more or less work on these systems. However, this isnt The UNIX Cookbook, and so any peculiarities of nonLinux usage are not addresssedLinux is always the assumed platform.
Chapter 1: Introduction
13
3. Chapter 3 [The Shell], page 53 (paying special attention to the main portions of the rst three sections, and ignoring the rest for now). 4. Chapter 4 [The X Window System], page 95 (ignoring the section on conguration for now). 5. Chapter 5 [Files and Directories], page 125. 6. Chapter 9 [Viewing Text], page 211 (mostly the rst section on perusing text). 7. Chapter 10 [Editing Text], page 231 (enough to select a text editor and begin using it). If you have a question about a particular program name, function name, or mode name, look it up in the program index ([Program Index], page 739). The other index, listing recipe names, proper names, and the general concepts involved, is called the concept index ([Concept Index], page 747).
http://debian.org/doc/FAQ/ http://rhlufaq.synfin.net/
http://faqs.org/
14
2. The Linux Documentation Project [http://linuxdoc.org/] is the center of the most complete and up-to-date Linux-related documentation available; see if there is a document related to the topic you need help with. 3. Usenet newsgroups are often an excellent place to discuss issues with other Linux users, and to get technical help. (Usenet is described in Recipe 34.4 [Reading Usenet], page 679). The following table lists some newsgroups that may be of interest. news:comp.os.linux.hardware Hardware help and support. news:comp.os.linux.help news:comp.os.linux.setup news:alt.os.linux General Linux help and support. Linux installation assistance. Main Linux alt newsgroup for general assistance (branches here include special groups for Red Hat, Mandrake and other distributions). Help for Debian users.
news:linux.debian.user
4. Find the Linux User Group (lug) nearest youpeople involved with lugs can be great sources of hands-on help, and it can be fun and rewarding to get involved with other Linux and free-software enthusiasts in your local area. http://www.ssc.com:8080/glue/ http://lugww.counter.li.org/ http://www.linux.org/groups/ glue (Groups of Linux Users Everywhere) Linux Users Groups WorldWide Linux User Groups
5. Consider hiring a consultant. This may be a good option if you need work done right away and are willing to pay for it. The Linux Consultants HOWTO is a list of consultants around the world who provide various support services for Linux and open source software in general. A copy of it should be on your system (see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50). Consultants have various interests and areas of expertise, and they are listed in that document with contact information.
Chapter 1: Introduction
15
6. Finally, see the list of recommendations in Appendix D [References for Further Interest], page 731, which includes books and Web sites that may be of help.
The set of basic software tools that a computer needs so that you can operate it to any success, including a means to run other programs. While the term hacker has come to refer to a computer vandal or intruder, the original computer meaning concerned a computer programmer or technician who nds obsessive joy in programming and consequently is adept or inventive at it. The name unix was rst written as unics, which stood for Uniplex Information and Computing System.
16
software work itself, written in a human-readable language),6 extending and customizing the software to their needs and liking. Beginning in the late 1970s, computer scientists at the University of California, Berkeley, a licensee of the unix source code, had been making their own improvements and enhancements to the unix source during the course of their research, and those improvements included the development of tcp/ip Internet networking. Their work became known as the bsd (Berkeley Systems Distribution) avor of unix. The source code of their work was made publicly available under licensing that permitted redistribution, with source or without, provided that Berkeley was credited for its portion of the code. There are many modern variants of the original bsd still actively developed today, and some of themsuch as netbsd, openbsd, and Apples Mac OS Xcan run on personal computers.
For a computer to make use of these written works, the source code must be run through a compiler, which is a program that uses these writings to output a new le of machine instructions. A software program in compiled form, not readable by man, is called a binary or executable le. Binaries are the les you use when you run a program on the system. But today, when people say unix, they usually mean a unix-like operating system, a generalization that includes Linux.
Chapter 1: Introduction
17
In 1984, while at the Massachusetts Institute of Technology in Cambridge, Massachusetts, hacker Richard Stallman saw his colleagues gradually move to this proprietary development model. But he could not accept the kind of civilization such proprietism would oer: No sharing your ndings with your fellow man, no freedom for anyone to take a look under the hood of a published work to understand it or to build upon it, and certainly no general advance. There would not even be a way to improve or extend your own copy of such works, or gain insight from the writings of other programmers. The proprietary model would mean the end of computer software as literature. Instead of following in the direction that most of computing had taken, Stallman decided to start a project to build and assemble a new unix-like operating system from scratch, and publish it in written (source code) form. This was the gnu Project, whose name stands for itself (gnus not unix).8 Stallman had to devise a way to publish these writings so that others could use them to advance the body of source-code literature, but so that no one could use them as the secret instructions for a software product. He could not place them in the public domain, because then he would forfeit all rights given by copyright law, and could not stop others from using this source code in products where the source code is kept secret. Licensing was developed as a way to expressly give everyone the right to copy, distribute, and modify his copy of the work, though under certain strict terms and conditions. For the gnu Project, Stallman had the General Public License, or gnu gpl,9 devised. It formalized through a legal contrivance what had been the common, unspoken practice in the early days of unix: Popularly called a copyleft, it permits anyone to copy, distribute, or modify a so-licensed work, provided that all copies are released with the same license, and all changes are documented. Even today it is the most widely used of all such licenses. This kind of software became known as free software. Stallman formed the Free Software Foundation (fsf), a non-prot corporation, to advance this concept and his gnu Project. The fsf also made copies of the gnu software available for sale as it was developed; individuals and businesses may charge
8
No such ocial gnu operating system has yet been released in its entirety, but most people today consider Linux-based free software systems to be the eective realization of Stallmans goalshence his famous request for people to call the Linux-based system gnu/Linux instead. Originally the Emacs Public License when rst published in 1985; the current gnu gpl is on the Web at http://www.gnu.org/copyleft/gpl.txt.
18
for copies of a free software work, but there are never any secret writingswith free software, anyone can read the source code.
12
Presumably, they all use Linux now. This was not the original name, however. Torvalds had originally called it freax, for free + freak + the obligatory -x ; while the 1990s were fast becoming the freaky alterna decade (at least in fashion), more people seemed to favor Linux, and the name stuck. The Institute of Electrical and Electronics Engineers, Inc., although everybody just uses the acronym, pronouncing it I triple E.
Chapter 1: Introduction
19
characteristics and features that a basic unix operating system should have. When Linux began to meet these technical specications, and then when it nally became posix compliant, the ecacy of Linux as a viable avor of unix could not be denied, and it received acceptance in areas where there had been marked resistance in the past. Through these relatively few years of development, the Linux software has been immensely extended and improved, so that the Linux-based system of today is a complete, modern operating system that rivals anything else that is currently available.
20
2,500 dierent software packages), and is entirely committed to free software by design (yes, there are distributions that are not). In Debians early days, it was referred to as the hackers distro because it could be very dicult for a Linux newbie13 to install and manage. However, that has changed.
Figure 1-1. Tux. While it seems like he was always a part of Linux, Tux didnt come to be until about 1994. In the earliest days of Linux, the storm petrel was a popular mascot, drawn by Peter Williams. This illustration shows the storm petrel in ight, from a perspective where its left wing appears raised and right wing sharply parallel to the view, so that its body forms an L shape.14
Slang for novice, from the English new boy at school. You can still see this logo, on letterhead, by viewing the PostScript le letter.ps in the package at http://www.funet.fi/pub/Linux/doc/logos/logo2u.tar.gz (see Recipe 17.4.2 [Previewing a PostScript File], page 414).
Chapter 1: Introduction
21
unfamiliar with the free software movementspecically, executives at certain large corporations whod suddenly taken an interest in the more than ten years worth of work that had been put into this softwaremight be scared o by the word free. They were concerned that said industry decisionmakers might confuse free software with unrelated concepts such as freeware, which is software provided free of charge, but in in executable form only.15 The Open Source Initiative (osi) was founded to promote software that conforms with its public Open Source Denition, which in turn was derived from the Debian Free Software Guidelines (dfsg), originally written by Bruce Perens as a set of software inclusion guidelines for Debian. All free softwareincluding software released under the terms of the gnu General Public Licenseconforms with this denition. But some free-software advocates and organizations, including the Free Software Foundation, loudly criticized the term open source, believing that it obscured the importance of freedom in this movement. However, even free software is now much too limited, because the very scope of the movement itself is a source of contention and debate. As long ago as 1994, I pointed out that it took more than computer program source code to make a complete and working operating system (non-software elements such as documentation, graphic icons, audio samples, and databases would be necessary), and in time groups were formed to advance the free copying and modication of specic types of non-software works, such as audio recordings of pop music. New terms including open content and free content then became popular to dierentiate these new works from free software. Eventually, even software organizations began to recognize the role of non-software works in achieving their stated goals, and some endorsed other kinds of works, such software documentation, as deserving of free licensing. Today, the surfeit of so many amateur free or open works, selfpublished on the Web, shows that many people clearly want to sharebut the outcome may not be what they expected. With so many specialized licenses and conicting methods for free publishing, these works all remain incompatible with each other, enclosed in their own separate commons. Other questions and concerns quickly arise: The goals of license makers are not always identical to those of publishers who use such licenses; the promise
15
Free software means nothing of the sort, of course; the free has always referred to a users freedom to read and use the softwares source code, and not the price he paid to obtain it.
22
of free invites careless violation of license terms and conditions by casual users and amateur publishers alike; enforcement is dicult if not impossible; assistance is nonexistent, since the practice occurs outside of traditional publishing; what constitutes the open source for dierent works is heavily debated; and, while the availabilty of works on the Internet is generally transnational, it is unclear whether international law or the laws of sovereign nations apply to these licensed works and their copies and derivatives. Computers have made it possible for machine-readable works to be published in such a way so that anyone can access, distribute, sample from or modify copies of these works, free of charge and without harm to the originalsbut this has yet been only demonstrated by individual publishers who released their works under unique licenses that specied these permissions and the terms under which they are given; there is yet no acknowledged universal standard or commons for such works, and no clear economic model to replace the old publication methodsso the future of this practice, and of all the works already so published, is unclear.
Chapter 1: Introduction
23
from any of it. This kind of closed-source software is presented to the world as a kind of magic trick: If you buy a copy of the program, you may use it, but you can never learn how the program actually works.16 The result of this is that the code to handle essentially the same function inside all of these dierent applications must be developed by programmers from scratch, separately and independently of the others each timeso the progress of society as a whole is set back by the countless man-hours of time and energy programmers must waste by ineciently reinventing all the same software functions to perform the same tasks, over and over again. unix-like operating systems dont put so much weight on application programs. Instead, they come with many small programs called tools. Each tool is generally capable of performing a very simple, specic task, and performing it wellone tool does nothing but output the le(s) or data passed to it, one tool spools its input to the print queue, one tool sorts the lines of its input, and so on. Collective sets of tools, designed around a certain eld or concept, were called workbenches on older unix systems; for example, the tools for checking the spelling, writing style, and grammar of text were part of the Writers Workbench package (see Recipe 11.3 [Checking Grammar], page 286). While the idea of workbenches is generally not part of the idiom of todays unixbased systems, tool collections are often distributed as toolkits, and the gnu Project still publishes collections of tools under certain general themes such as the gnu text utilities and gnu le utilities. The invention of new tools and applications to ll new needs has been on the rise along with the increased popularity of Linux-based systems; at the time of this writing, there were a total of 1,631 tools and applications in the two primary program directories (/bin and /usr/bin) on my Linux system. An important early development in unix was the invention of pipes, a way to pass the output of one tool to the input of another. By knowing what the individual tools do and how they are combined, a user could now build powerful strings of commands. Just as the tensile strength of chrome-nickel steel is greater than the added strength of its components, multiple tools could then be combined to perform
16
In fact, under the Digital Millennium Copyright Act (dmca), signed into law by President Clinton on October 28, 1998, it is a federal crime for you to even try.
24
a task unpredicted by the function of the individual tools. This is the concept of synergy, and it forms the basis of the unix tools philosophy.17 Heres an example, using two tools. The rst tool, called who, outputs a list of all the users who are currently logged on to the system (see Recipe 2.6.2 [Listing Who Is on the System], page 39). The second tool is called wc, which stands for word count; it outputs a count of the number of words (or lines or characters) of the input you give it (see Recipe 12.1 [Counting Text], page 293). By combining these two tools, giving the output of who to the wc command, you can build a new command to list the number of users currently on the system, as in Figure 1-2.
$ who | wc -l RET 4 $
Figure 1-2. Listing the number of users on the system. The output of who, a list of all the users who are on the system right now, is pipedvia a pipeline, specied by the vertical barto the input of wc, which through use of the -l option outputs the number of lines of its input. In this example, the numeral 4 is output, indicating that four users are currently logged on to the system.18 Another famous pipeline from the days before spell-check tools goes something like Figure 1-3.
$ tr -cs A-Za-z '\012' | tr A-Z a-z | sort -u | comm -23 - /usr/dict/words RET
Figure 1-3. An early spelling checker. This command (typed all on one long line) uses the tr, sort, and comm tools to make a spelling checkerafter you type this command, the lines of text you type (until you interrupt it) are converted to a single-column list of lowercase words with two calls of tr, are then sorted in alphabetical order
17
18
Because of this approach, and because of its licensing that gives access to all, I like to call Linux a synergetic operating system, in honor of the late R. Buckminster Fuller, who invented a new mathematical system based on these same principles. Piping the output of who to wc in this fashion is a classic tools example. A.N. Walker called it the most quoted pipe in the worldover twenty years ago! See his book in Appendix D [References for Further Interest], page 731.
Chapter 1: Introduction
25
while ferreting out all duplicates, and the resultant list is then compared with /usr/dict/words, which is the system dictionary, a list of properly spelled words kept in alphabetical order (see Recipe 11.1 [Spell Checking], page 275). The great bulk of this book details various combinations of tools you can use to obtain the desired results for various common tasks. Some tasks will require more than one command sequence; others need the ne, complex motions exercised through the large application programs. Youll nd that theres usually one tool or command sequence that works perfectly for a given task, but sometimes a satisfactory or even identical result can be had from dierent combinations of dierent toolsespecially at the hands of a unix expert.19 This way of formulating commands to accomplish tasks, so dierent from the wysiwyg20 systems where you point and click at graphic icons, is the language of unix. In most everyday use, youll rarely use more than a vocabulary of twenty words (tools) and a few inections each (their options)but what can you express with them, and how quickly, in contrast to merely pointing at pictures!
19 20
Such an expert used to be called a wizard; a more colloquial expression is guru, and then theres the more generalized (and downright awful) computer geek of today. What You See Is What You Get.
26
27
28
turning o the power could result in the loss or corruption of some of your work. There is a special shutdown tool the system administrator can use to shut down the computer, as described in Recipe A.2 [Shutting Down the System], page 703. But you can always shut down your system from the console, whether you are logged in or not, by using the special CTRL - ALT - DEL keystroke (also known as the three-nger salute, a carry-over from the dos days). This keystroke immediately begins the shutdown process, and then reboots the system. If you cut power to the system before it reboots, you can shut it down in this way. To turn o a single user system even when you are not logged in as the administrator, type CTRL - ALT - DEL (press and hold these three keys at once).1 When you do this, the system will display some messages to the screen as it shuts down; when you see the line, Rebooting..., its safe to ip the power switch. NOTES: You dont want to wait too long after you see this message; if left untouched, the system will reboot and youll be back to the beginning!
If your keyboard has two ALT and CTRL keys, use the left set of these keys.
29
whose username is root; this account has total access to the entire system, so it is often called the superuser.) Until the mid-1990s, it was common for usernames to be the rst letter of your rst name followed by your entire surname, up to 12 characters total. So, for example, user George Washington would have a username of gwashington by this convention; this, however, is not a hard and fast rule, especially on home systems where you may be the only user. Sometimes, a middle initial is added (usgrant), or sometimes even nicknames or initials are used (gipper, jfk). But whatever username you pick for yourself, make sure its one you can live with, and one you can stand being called by both the system and other users (your username also becomes part of your email address, as youll see in Chapter 32 [Email], page 611). In addition to your username, you should also have a password that you can keep secret so that only you can use your account. Good passwords are strings of text that nobody else is likely to guess, (i.e., not obvious words like secret, or identifying names like Ruski, if that happens to be your pet cat). A good password is one that is so memorable to you that you dont ever have to write it down, but complex enough in construction so that no one else could ever guess it. For example, t39sAH might be a ne password for someone whose rst date was to see the movie The 39 Steps, directed by Alfred Hitchcock. NOTES: While usernames are always in lowercase, passwords are case sensitive; the passwords Secret, secret, SECReT, and SECRET are all considered dierent.
30
The login: prompt appears on the terminal after the system boots. If your system is congured to start the X Window System at boot time, youll be presented with an X login screen instead of the standard login prompt. If that happens, press CTRL - ALT - F1 to switch to the text login screen; this is explained further in Recipe 2.3 [Using Consoles and Terminals], page 32. To log in to the system, type your username (followed by RET ) at the login: prompt, and then type your password when asked (also followed by RET ). For security purposes, nothing is displayed on the screen when you type your password; if you make a mistake while typing it in, type CTRL - U to erase the line of input and start over. To log in to the system with a username of kurt and a password of empathy, type:
Debian GNU/Linux 3.0 bardo tty1 bardo login: kurt RET Password: empathy RET Linux bardo 2.4.18 #1 Sat Dec 6 16:05:52 EST 2003 i686 unknown Copyright (C) 1993-1998 Software in the Public Interest, and others Most of the programs included with the Debian Linux system are freely redistributable; the exact distribution terms for each program are described in the individual files in /usr/doc/*/copyright Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Tue Apr 5 12:03:47 on tty1. No mail. ~ $
As soon as you log in, the system displays the contents of /etc/motd, the Message of the Day le. The system then displays the time and date of your last login, and reports whether or not you have mail waiting for you (see Chapter 32 [Email], page 611). Finally, the system puts you in a shellthe environment in which you interact with the system and give it commands. The default shell on most Linux systems is Bash, and how you use it is discussed in Chapter 3 [The Shell], page 53.
31
The dollar sign ($) displayed to the left of the cursor is called the shell prompt; it means that the system is ready and waiting for input. (You can change this prompt to any text of your liking; to learn how, see Recipe 3.5.6 [Changing the Shell Prompt], page 80.) Many distributions are set up so that the shell prompt includes the name of the current directory by default, which it places to the left of the dollar sign. When you log in, you are in your home directory, which the shell represents as the the tilde character (~). Directories are explained in Chapter 5 [Files and Directories], page 125. NOTES: Every Linux system has its own name, called the systems hostname; a Linux system is sometimes called a host, and it identies itself with its hostname at the login: prompt. Its important to name your system; like a username for a user account, a hostname gives a name to the system you are using (and it becomes especially important when putting the system on a network). The system administrator usually names the system when it is being initially congured (the hostname can always be changed later; its name is kept in the le /etc/hostname). Like usernames, hostnames are single words in all lowercase letters. People usually give their systems a name they like, such as darkstar or shiva. In the preceding examples, bardo is the hostname of this particular Linux system, which happens to be running the Debian distribution. The name of the terminal you are connecting from is displayed just after the hostname. In this example, the terminal is tty1, which means that this is the rst terminal on this particular system. (Incidentally, tty is short for teletype, which historically was the kind of terminal hardware that most unix-based systems used by default.)
32
NOTES: If you are the only person using your system and have just ended a session by logging out, you might want to power down the system. See Recipe 2.1.2 [Turning O the System], page 27, earlier in this chapter.
Hardware built especially for this function are called dumb terminals because they have no computing power of their own, but are just input and output facilities for interacting with the actual computer they are connected to.
33
In this example, fgconsole outputted the numeral 3, indicating that the user is in the third virtual console. NOTES: If you try running fgconsole from a terminal emulator in the X Window System, youll see that it wont output a number because youre not running it from a virtual console.
You can also cycle through the dierent virtual consoles with the left and right arrow keys. To switch to the next-lowest virtual console (or wrap around
34
to the highest virtual console, if youre at the rst virtual console), press . To switch to the next-highest virtual console, press ALT . To switch from the fourth to the third virtual console, press:
ALT -
ALT
PrtScrn
The seventh virtual console is reserved for the X Window System. If X is installed, this virtual terminal will never show a login: prompt, but when you are using X, this is where your X session appears. If your system is congured to start X immediately, this virtual console will show an X login screen. You can switch to a virtual console from the X Window System using in conjunction with the usual ALT and function keys. This is the only console manipulation keystroke that works in X. To switch from X to the rst virtual console, press:
CTRL CTRL - ALT - F1
METHOD #2 Use chvt to change to a dierent virtual console. It takes as an argument the number to change to. To change to the seventh virtual console, type:
$ chvt 7 RET
35
Here are two ways to use this. To view lines of text that have scrolled o the top of the screen, press SHIFT - PgUp to scroll backward through it. Once you have scrolled back, press SHIFT - PgDn to scroll forward through the text toward the more recent text. The amount of text you can scroll back through depends on system memory. NOTES: This technique is for scrolling through text displayed in your shell session (see Chapter 3 [The Shell], page 53). It does not work for scrolling through text in a tool or application in the console. In other words, you cant use this technique to scroll through text that is displayed by a tool for perusing text les. To scroll through text in an application, use its own facilities for scrolling, if it has any.
This works in the console as well as in a terminal emulator in X. You can put this command in scripts. METHOD #2 To clear the terminal screen and redraw the current command line at the top, type CTRL - L . Unlike clear, which is a complete command you input at the command line, you can type CTRL - L anywhere on a command line that contains something else youre typingit redraws the current command line you are at, complete with everything on it, at the top of the screen. To clear the terminal screen and redraw the current command line at the top of the screen, type:
CTRL - L
36
NOTES: This keystroke works in the Bash shell, which is the subject of the next chapter.
NOTES: You can practice this so you know what it looks like when it really happens. Do this by sending the output of a binary le to the terminal screentype cat /bin/ls and see what it does to the terminal; then type reset to reset it.
37
The hostname of the system in the example is camelot. Options always begin with a hyphen character (-), which is usually followed by one alphanumeric character. To include an option in a command, follow the name of the tool or application with the option. Always separate the tool name, each option, and each argument from one another with a space character. Long-style options (sometimes called gnu-style options) begin with two hyphen characters (--) and are usually one English word. Sometimes an option itself may take an argument. For example, hostname has an -F option, for specifying a le name to read the hostname from; it takes as an argument the name of the le that hostname should read from. To run hostname and specify that the le host.info is the le to read from, type:
$ hostname -F host.info RET
Sometimes the list of available options lls much more than a screen, so you may want to pipe the output through less for perusal (see Recipe 9.1 [Perusing Text], page 211). Press Q to stop perusal. To peruse the available options for the lynx tool, type:
$ lynx -? | less RET
3
Some tools have neither option, in which case you should try the -? option.
38
This command outputs the text hostname 2.10, indicating that this is version 2.10 of the hostname tool.
NOTES: Passwords can contain uppercase and lowercase letters, the digits 0 through 9, and punctuation marks; they should be between ve and eight
39
characters long. See Recipe 2.2 [Using Your Account], page 28, for suggestions on choosing a good password.
In this example, the username of the user logged in at this terminal is will.
20 21 21 21
40
The output in this example shows that the user murky is logged in on tty1 (the rst virtual console on the system), and has been on since 20:09 on 20 October. The user dave is logged in on tty2 (the second virtual console), and has been on since 14:37 on 21 October. The user kurt is logged in twiceon tty3 (the third virtual console), and on ttyp1, which is an X session with a window location of (:0.0). NOTES: This command is for listing the users on the local system; to list the users connected to a dierent system on the network, or to see more detailed personal information that a user may have made public, see Recipe 34.5.1 [Checking Whether a User Is Online], page 683.
up 17:53, 4 users, load average: 0.12, 0.06, 0.01 TTY FROM LOGIN IDLE JCPU PCPU WHAT tty1 Oct 20 20:09 17:22m 0.32s 0.32s -bash tty2 14:37 13.00s 2:35 0.07s less foo tty3 15:04 1:00m 0.41s 0.09s startx ttyp1 :0.0 15:04 0:00s 21.65s 20.96s emacs
In this example, the commands output shows that the current system time is 5:27 p.m., the system has been up for 17 hours and 53 minutes, and there are four users currently logged in: murky is logged in at tty1, has been idle for 17 hours and 22 minutes, and is at a Bash shell prompt; dave is logged in at tty2, has been idle for 13 seconds, and is using less to peruse a le
41
named foo (see Recipe 9.1 [Perusing Text], page 211); and kurt is logged in at two terminalstty3 and ttyp1, which is an X session. He ran the startx command on tty3 to start his X session, and within his X session, he is currently using Emacs.
To nd out when a particular user last logged in to the system, give the username as an argument. To nd out when user james last logged in, type:
$ last james RET
NOTES: The last tool gets its data from the system le /var/log/wtmp; the last line of output tells how far this le goes back. Sometimes, the output will go back for several weeks or more.
42
STAT S S
In this example, ps shows that two processes are running: the bash and ps commands.
NOTES: This command is useful for listing all of your own processes, running across all terminals and shell sessions; give your own username as an argument.
NOTES: There could be a lot of outputeven single-user Linux systems typically have forty or more processes running at one timeso you may want to
43
pipe the output of this command through less for perusal (see Recipe 9.1 [Perusing Text], page 211). METHOD #2 Use top to show a chart of all processes on the system, sorted by their demands on the system resources. The display is continually updated with current process information; press Q to stop the display and exit the program. This tool also displays the information about system runtime and memory that can be output with the uptime and free commands. To see a continually updated display of the current system processes, type:
$ top RET
To list the process (if any) that corresponds to a particular process id, give that pid as an argument to the -p option. To list the process whose pid is 344, type:
$ ps -p 344 RET
44
NOTES: The apropos tool matches lines that contain the keyword you give exactly as typed, anywhere in the line. A search for the keyword consoles might not list all the programs that a search for the keyword console would yield; a search on con matches even more. Therefore, its better to try singular forms, and then rene your terms if you need to. The trick to getting good results from apropos is to know just which keywords are apt to be used in the descriptions of the thing youre looking for. The apropos tool is an alias for man with the -k option (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46). METHOD #2 Dpkg DEB: dpkg On Debian systems, yet another way to nd installed software by keyword is to use dpkg, the Debian package tool. Use the -l option to list all of the installed packages, which are each output on a line of its own with its package name and a brief description. You can output a list of packages that match a keyword by piping the output to grep. Use the -i option with grep to match keywords regardless of case (grep is discussed in Chapter 14 [Searching Text], page 333).
45
Additionally, you can directly peruse the le /var/lib/dpkg/available with less (see Recipe 9.1 [Perusing Text], page 211); this le lists all available packages and gives a description of them. Here are three ways to use this. To list all of the deb packages installed on the system, type:
$ dpkg -l RET
To list all of the deb packages installed on the system whose name contains the text edit, regardless of case, type:
$ dpkg -l | grep -i edit RET
To peruse descriptions of all deb packages that are currently available, type:
$ less /var/lib/dpkg/available RET
NOTES: For more information on using dpkg, see Recipe A.4 [Managing deb Packages], page 709. METHOD #3 On rpm-based systems such as Fedora and Red Hat Enterprise Linux, you can nd installed software by keyword using rpm, the package management tool. Give the -qa option to output the names of all packages installed on the system. To nd specic packages, pipe the output to grep with the -i option and a pattern to match (see Recipe 14.1 [Searching Text for a Word], page 333). Pipe this to less for perusal. Here are some ways to use this. To peruse a list of all rpm packages installed on the system, type:
$ rpm -qa | less RET
To list all packages whose name or description includes the word edit, regardless of case, type:
$ rpm -qa | grep -i edit RET
To list all of the rpm packages installed on the system whose name contains the text 1.2, type:
$ rpm -qa | grep "1\.2" RET
NOTES: For more information on using rpm, see Recipe A.5 [Managing rpm Packages], page 714.
46
NOTES: The whatis tool gets its descriptions from the manual page of a given program; manual pages are described later in this section, in Recipe 2.8.4 [Reading a Page from the System Manual], page 46.
This command outputs some usage information about the whoami tool, including a short description and a list of possible options. NOTES: Not all tools take the --help option; some tools take a -h or -? option instead, which performs the same function.
47
Use the man tool to view a page in the system manual. As an argument to man, give the name of the program whose manual page you want to view (so to view the manual page for man, you would type man man). To view the manual page for w, type:
$ man w RET
Figure 2-2. Reading a man page. Use the up and down arrow keys to move through the text. Press Q to stop viewing the manual page and exit man. Since man uses less to display the text, you can use any of the less keyboard commands to peruse the manual page (see Recipe 9.1 [Perusing Text], page 211). NOTES: Despite its name, a manual page does not always contain the complete documentation for a program; its more like a quick reference card. It usually has a short description of the program, and lists the options and arguments it takes; some manual pages also include an example or a list of related commands. (Sometimes, commands have very complete, extensive manual pages, but more often, their complete documentation is found either in other help les that come with it or in its Info documentation; these are the subjects of the following two recipes.)
48
To prepare a man page for printing, see Recipe 25.3.4 [Preparing a Manual Page for Printing], page 522.
This command starts info at the systems Top menu, which shows some of the info key commands and displays a list of available manuals, as in Figure 2-3. Use the arrow keys to move through each page of information, called an Info node. Nodes are arranged hierarchically. Every Info document has a Top node, which is like the frontmatter and table of contents of a printed book; it usually contains the name of the document and an Info menu with links to its various chapters. A chapter node will contain a menu with links for its sections and so on. Links to other nodes may also appear in the text of any node, as cross references. Links look the same in both menu items and cross references: an asterisk (*), the name of the node it links to, and either one or two colon characters (: or ::). To follow a link to the node it points to, move the cursor over any part of the node name in the link and press RET .
49
Figure 2-3. Reading an Info node. Press H to run a tutorial that describes how to use info. Press Q to stop reading the documentation and exit the program. You can press these buttons at any time you are in info. To read Info documentation for a particular tool or application, give its name as an argument to info; if no Info manual exists for that tool, info displays the man page for that tool instead. To read the Info documentation for the tar tool, type:
$ info tar RET
This command opens a copy of The GNU tar Manual in info. To read the contents of a le written in Info format, give the name of the le to read with the -f option. This is useful for reading an Info le that you have obtained elsewhere, and that is not in the /usr/info directory with the rest of the installed Info les. Info can automatically recognize and expand Info les that are compressed and have a .gz le name extension (see Recipe 8.4 [Compressed Files], page 196). To read an Info le in the current directory named faq.info, type:
$ info -f faq.info RET
This command starts info and opens the Info le faq.info, beginning at the top node in the le.
50
To read a specic node in an Info le, give the name of the node to display in quotes as an argument to the -n option. To read faq.info, an Info le in the current directory, beginning with the node Text, type:
$ info -n 'Text' -f faq.info RET
NOTES: You can also read Info documentation directly from the Emacs editor; type CTRL - H i while in Emacs to start the Emacs Info reader, and then use the same commands as in the stand-alone info tool (see Recipe 10.1.1 [Getting Acquainted with Emacs], page 232). The Emacs incremental search command, CTRL - S , also works in info; its a very fast, ecient way to search for a word or phrase in an entire Info text (like this entire book); see Recipe 14.9.1 [Searching Incrementally in Emacs], page 352. Some people use Info for everything; on Linux systems, Info is set up to display a tools man page in Info, if the tool lacks Info documentation. So if a foofoo tool doesnt have any Info manual, typing info foofoo will give you its man page.
On some systems, /usr/doc is superseded by the /usr/share/doc directory; still others have both. So if a le is not where it should be, try looking in /usr/share/doc/. For example, the user dictionary is famously at /usr/dict/words. In some distributions now, it has been moved to /usr/share/dict/words, but if you want to restore it to the classical location, you (as the superuser) can create a symbolic link from the former to the latter (see Recipe 5.7 [Giving a File More Than One Name], page 152).
51
subdirectory with the name of that package. For example, additional documentation for the hostname package is in /usr/doc/hostname, and documentation for the passwd package is in /usr/doc/passwd. Most packages have a le called README that usually contains relevant information. Often this le is compressed as README.gz, in which case you can use zless instead of less. The Linux Documentation Project (ldp) has overseen the creation of more than 100 howto les, each of which covers a particular aspect of the installation or use of Linux-based systems. The ldp howtos are compressed text les stored in the /usr/doc/HOWTO directory; to view them, use zless. The le /usr/doc/HOWTO/HOWTOIndex.gz contains an annotated index of all the howto documents installed on the system.5 The /usr/doc/FAQ directory contains a number of faq (Frequently Asked Questions) les on various subjects. Finally, some distributions also keep a directory in /usr/doc for their own documentation; Debian, for example, uses /usr/doc/debian for documentation relating to that distribution: the les that make up the Debian faq are in the /usr/doc/debian/FAQ directory, available in both html format, which you can view in a Web browser (see Recipe 5.10 [Browsing Files and Directories], page 157), and as a compressed text le, which you can view in zless. Here are two ways to use this. To view the html version of the Debian faq in the lynx Web browser, type:
$ lynx /usr/doc/debian/FAQ/debian-faq.html RET
To view the compressed text version of the Debian faq in zless, type:
$ zless /usr/doc/debian/FAQ/debian-faq.txt.gz RET
NOTES: Its often very useful to use a Web browser to browse through the documentation les in these directoriessee Recipe 5.10 [Browsing Files and Directories], page 157.
ldp documents are available in other formats as well, including html and dvi.
52
53
3. The Shell
The subject of this chapter is the shell, the program that reads your command input and runs the specied commands. It gets its name because it gives a covering that protects you from the outer environment of the system, like the hard protective encasements of the soft mollusks of the sea. The shell is the intermediary between you and the system, and all interaction is done through it; it is both your working environment and your interface. You are said to be in a shell from the very moment youve successfully logged in to the system, until right when you log out. The $ character preceding the cursor is called the shell prompt; it tells you that the system is ready and waiting for input. On Debian systems, the default shell prompt also includes the name of the current directory (see Chapter 5 [Files and Directories], page 125). A tilde character (~) denotes your home directory, which is where youll nd yourself when you log in. For example, a typical users shell prompt, when in his home directory, might look like Figure 3-1.
~ $
Figure 3-1. A Bash shell promt. If your shell prompt shows a pound sign (#) instead of a $, this means that youre logged in with the superuser, or root, account. Beware: The root account has complete control over the system; one wrong keystroke and you might accidentally break it something awful. You need to have a dierent user account for yourself, which you use for your regular activities (see Recipe A.6.1 [Making a User Account], page 717). You may sometimes hear the shell called the command shell, because you run commands through it, but the shell isnt just a prompt where you run other programsit is also a programming language. Its built-in facilities for writing programs is very powerful. In this chapter, I will show you the basics to get you started, but you should know that many books have been written on shell programming. There are many shells available for Linux. Some may look similar to each other, but they can behave quite dierently. Were going to cover the Bash shell, which is the most commonly used shell on Linux systems and is almost always the default Linux shell. (Its name stands for Bourne again shella pun on the name of Steve Bourne, who was author of the traditional unix shell, the Bourne shell.)
54
A list of other recommended shells is given at Recipe 3.9.5 [Using Other Shells], page 92. For more information on using Bash beyond what this chapter provides, consult the Info documentation for bash (see Recipe 2.8.5 [Reading an Info Manual], page 48).
RET
or
CTRL
55
Kill, or cut, all text on the input line, from the character the cursor is underneath to the end of the line. Kill everything on the input line to the left of the cursor. Yank, or paste, the text that was last killed. Text is inserted where the cursor is. Move the cursor to the beginning of the input line. Move the cursor to the end of the input line.
CTRL
CTRL
Movement CTRL - A
CTRL
E CTRL
or or
ALT ALT
Move the cursor to the right (forward) one character. Move the cursor to the left (backward) one character. Move the cursor forward one word. Move the cursor backward one word.
CTRL
F B
CTRL
Clear the terminal screen, redrawing the current input line at the top.
NOTES: These keyboard commands are the same as those used by the Emacs editor (see Recipe 10.1 [Using Emacs], page 232). Many other Emacs keyboard commands also work on the command line (see Recipe 10.1.3 [Using Basic Emacs Editing Keys], page 237). And, for Vi acionados, it is possible to congure Bash to recognize Vi-style bindings instead (see Recipe 3.7.3 [Using Shell Startup Files], page 86).
56
To insert a formfeed character (Control-L) at the current location in the input line, type:
CTRL - V CTRL - L
57
To echo the string "$HOSTNAME" is nice!, where $HOSTNAME is a shell variable to be expanded, type:
$ echo \"$HOSTNAME\" is nice\! RET "lucky" is nice! $
The last two examples use the special Bash variable HOSTNAME, whose value is always the name of the current host (see Recipe 3.5 [Using Shell Variables], page 77). First, the text $HOSTNAME is displayed because its $ is escaped, and then second, the $HOSTNAME variable is expanded to the value it contains. In this example, the systems hostname is lucky. NOTES: For only one reserved character, this is the simplest quoting method; while you certainly can quote any complex quotation this way, it is cumbersome to add all the backslashes. When passing a phrase to a command that takes multiple arguments, you will have to escape spaces, too. So the phrase in the rst example becomes Isn'\t\ this\ nice? METHOD #2 Quote a literal phrase by enclosing it in single quote characters ('). All characters inside the quotes are taken literally, and not for any reserved meaningso theres no way to expand variables in single-quoted text. You can even quote newlines with this method. The only character you cant pass in single quotes is a single quote itself.
58
Here are some ways to use this. To echo a backslash character, type:
$ echo '\' RET \ $
To echo the string "$HOSTNAME" is nice!, where there is a newline character after the second double quote character, type:
$ echo '"$HOSTNAME" RET > is nice!' RET "$HOSTNAME" is nice! $
NOTES: This second method is one of the simpler methods of quoting. METHOD #3 Quote a phrase by enclosing it in double quote characters (") to retain the special meaning of some characters: the dollar sign ($), backtick (`), exclamation point (!), and backslash (\). This means that: Variables are expanded to their values (see Recipe 3.5 [Using Shell Variables], page 77), command output may be specied (see Recipe 3.1.11 [Specifying the Output of a Command as an Argument], page 65), command history may be referenced (see Recipe 3.4 [Using Your Command History], page 74), and single characters may be escaped, as described in Method #1 above. You can pass single quote and newline characters; to pass double quotes, dollar signs, backticks, or backslashes, escape them rst with a backslash (\). Pass an exclamation point by escaping it outside of the double quotes.
59
Here are some ways to use this. To echo Isn't it great?, type:
$ echo "Isn't it great?" RET Isn't it great? $
To echo Isn't this $HOSTNAME?, where $HOSTNAME is a shell variable to be expanded, type:
$ echo "Isn't this $HOSTNAME?" RET Isn't this lucky? $
To echo Wow! This isn't "$HOSTNAME"!, where there is a newline character after the rst exclamation point, type:
$ echo "Wow"\!" RET > This isn't \"\$HOSTNAME\""\! RET Wow! This isn't "$HOSTNAME"! $
In the second-last example, the systems hostname is lucky. In the second and the last examples, the text $HOSTNAME is quoted literally and is not expanded as a variable; by omitting the backslash directly preceding the dollar sign, the shell will expand the variable. NOTES: You can sometimes get away with quoting an exclamation point in double quotes, but because its reserved for referencing your Bash command history, using it in the wrong context can have unexpected results. Unless
60
youre only using the single quotes method, its safest to escape an exclamation point outside of the double quotes. METHOD #4 To pass special characters as a string, give them as $'string', where string is the string of characters to be passed. This is called ansi-c style quoting. Special backslash escape sequences for certain characters are commonly included in a string, as listed in the following table. \a \b \e \f \n \r \t \v \\ \NNN Alert (rings the system bell). Backspace. Escape. Form feed. Newline. Carriage return. Horizontal tab. Vertical tab. Backslash. Character whose ascii code is NNN in octal (base 8).
Here are some ways to use this. To echo the string Hello followed by two newline characters, type:
$ echo Hello$'\n\n' RET Hello
61
To append a newline character and a pilcrow sign character (octal character code 266) to the le draft, type:
$ echo $'\n\266' >> draft RET
1
The unix way of saying this is that the command rings the system bell.
62
Notice how by typing only the letter e followed by TAB twice brings up a series of les, while em is completed to emacs, because all options in this directory beginning with the letters em complete to at least that word. The nal two TAB completions were made without ringing the bell, meaning that the completions made were the only possibilities. NOTES: Many applications also support command and/or le name completion; the most famous example of this is the Emacs text editor (see Recipe 10.1 [Using Emacs], page 232).
This operation xes the misspelled frmo with from, and so the input line looks like this:
$ echo from
This operation correctly forms the command to view the bash manual page:
$ man bash
63
By typing more than once, you can go back to earlier commands youve typed; this is a function of your command history, explained further in Recipe 3.4 [Using Your Command History], page 74. NOTES: You can also search through your command history to repeat a command you typed earlier; See Recipe 3.4.2 [Searching Through Your Command History], page 75.
NOTES: There are many useful things you can do when combining commands in this way. One popular use of this technique is to run sleep rst and then some other command next, to run that second command on a delay. This is good for making screen shots in some other window (see Recipe 19.1.1 [Taking a Screen Shot in X], page 441).
64
METHOD #2 You can also run a list of commands by putting them in a le, one per line. Use the special . command, and give the name of the le as an argument. This runs, in the current shell, all of the commands that are in the le. To run the commands in the le ~/lists/nightly, type:
$ . ~/lists/nightly RET
NOTES: This method is good for running many commands with long arguments. For example, you might want to run a tool that takes an url as an argument, and you have a long series of such urls to run it on. Use a text editor to copy the urls into a le, one on each line, and then insert the name of the tool at the beginning of each line. The built-in source command is a synonym for the period; the act of running commands from a le with this method is often called sourcing a le.
To search the le operations for the word planning regardless of case, and then peruse operations only if that word was found in it, type:
$ grep -i planning operations && less operations RET
65
shell will run it and ignore the second command; if the rst command doesnt exist, returns an error, or otherwise returns with a non-zero exit status, the shell will run the second command. To run either w or who, type:
$ w || who RET
In this example, if w exists and runs without errors, the shell will run it and exit; otherwise, it will run who.
To output something instead of y, specify it as an argument. To specify a certain number of times to output, pipe yes through head with the number to output as an option. Here are two ways to use this. To use mv to move all of the les ending in .sample in the current directory to a directory called live, but answer no to overwriting any existing les, type:
$ yes n | mv *.sample live RET
To run a command farboo and automatically answer ve prompts with your username, type:
$ yes `whoami` | head -5 | farboo RET
66
NOTES: You can nest substitutions, putting one substitution inside another one. METHOD #1 To substitute a commands output, give the command enclosed in parentheses and preceded by a dollar sign ($). To locate any les on the system containing your username somewhere in its name, type:
$ locate $(whoami) RET
METHOD #2 To substitute a commands output, give the command enclosed in backtick characters (`). To locate any les on the system containing your username somewhere in its name, type:
$ locate `whoami` RET
NOTES: This is the old-fashioned way of doing it. The backticks enclosing any nested substitutions must be each preceded with backslash characters (\); also use backslash to specify dollar sign or literal backslash characters.
67
Here are two ways to use this. To echo the string verylongword while typing it out over two screen lines, type:
$ echo ver\ RET > ylongword RET verylongword $
To echo the string verylongword while typing it out over four screen lines, type:
$ ech\ RET > o verylo\ RET > ngwor\ RET > d RET verylongword $
NOTES: It may not always look as tidy, but you can type a long command without using this technique.
68
input from. For example, instead of giving a list of keywords as arguments to apropos (see Recipe 2.8.1 [Finding the Right Tool for the Job], page 44), you can redirect standard input to a le containing a list of keywords to use. To redirect standard input for apropos to a le named keywords, type:
$ apropos < keywords RET
As with redirecting the standard output, there are two variations; 2>> works just like 2> but it appends the standard error to a le, if the le already exists. To append the standard error of apropos shells to an existing le command.error, type:
$ apropos shells 2>> command.error RET
69
To redirect both standard output and standard error to the same le, use &> instead of the stdout and stderr operators. To redirect the standard output and the standard error of apropos shells to a le named commands, type:
$ apropos shells &> commands RET
NOTES: The &> operator overwrites pre-existing les; there is no &>> operator for appending both stdin and stderr in such cases.
This redirects the standard output of the command apropos bash shell shells to the standard input of the command less, which displays it on the screen for perusal.
70
To write a copy of the output of apropos bash shell shells to a le called shell.commands, and peruse the output with less at the same time, type:
$ apropos bash shell shells | tee shell.commands | less RET
Use the -a option to append to the le, and not overwrite any existing data. To redirect to multiple les, string multiple tee commands together. To write a copy of the output of apropos bash shell shells to a le called shell.commands, append a copy of the output to a le named command.suggestions, and peruse the output with less at the same time, type (all on one line):
$ apropos bash shell shells | tee shell.commands | tee -a command.suggestions | less RET
NOTES: Sending to /dev/null is a common phrase. Now you know what it means when people do this. Some people call it the bit bucket. Now you know that, too.
71
The shell assigns each job a unique job number. You can use it as an argument to specify the job to commands. Do this by preceding the job number with a percent sign (%). To nd the job number of a job you have running, list your jobs (see Recipe 3.3.4 [Listing Your Jobs], page 73). The following sections describe the various commands for managing jobs.
In this example, the job number is 1 and the command that has stopped is info -f manual.info. The + character next to the job number indicates that this is the most recent job. If you have any stopped jobs when you log out, the shell will tell you this instead of logging you out, as in Figure 3-2.
$ logout RET There are stopped jobs. $
Figure 3-2. Stopped jobs when logging out. At this point, you can list your jobs (see Recipe 3.3.4 [Listing Your Jobs], page 73), stop any jobs you have running (see Recipe 3.3.5 [Stopping a Job], page 73), and then log out.
72
The shell outputs the job number (in this case, 1) and process ID (in this case, 6575), and then returns to a shell prompt. When the background job nishes, the shell will list the job number, the command, and the text Done, indicating that the job has completed successfully:
[1]+ Done apropos shell >shell-commands
To move a job from the foreground to the background, rst suspend it (see Recipe 3.3.1 [Suspending a Job], page 71) and then type bg (for background). For example, to start the command apropos shell > shell-commands in the foreground, suspend it, and then specify that it nish in the background, you would type:
$ apropos shell > shell-commands RET CTRL - Z [1]+ Stopped $ bg RET [1]+ apropos shell & $ apropos shell >shell-commands
If you have suspended multiple jobs, specify the job to be put in the background by giving its job number as an argument. To run job 4 in the background, type:
$ bg %4 RET
NOTES: Running a job in the background is sometimes called backgrounding or amping o a job.
73
To move a specic job to the foreground when you have multiple jobs in the background, specify the job number as an option to fg. To bring job 3 to the foreground, type:
$ fg %3 RET
This example shows two jobsapropos shell > shell-commands and apropos bash > bash-commands. The + character next to a job number indicates that its the most recent job, and the - character indicates that its the job previous to the most recent job. If you have no current jobs, jobs returns nothing. To list all of the processes you have running on the system, use ps instead of jobssee Recipe 2.7 [Listing Processes], page 41.
74
To run the cat tool and then interrupt it while it is running in the foreground, type:
$ cat RET CTRL - C RET $
Use kill to interrupt (or kill) a background job, specifying the job number as an argument. To kill job number 2, type:
$ kill %2 RET
75
This command shows the contents of your command history le, listing one command per line, each prefaced by its event number. Use an event number to specify that event in your history (see Recipe 3.4.3 [Specifying a Command from Your History], page 76). If your history is a long one, this list will scroll o the screen, in which case you may want to pipe the output to less in order to peruse it. Its also common to search for a past command by piping the output to grep (see Recipe 3.2.4 [Redirecting Output to Another Commands Input], page 69, and Recipe 14.1 [Searching Text for a Word], page 333). To search your history for the text apropos, type:
$ 2 3 5 $ history apropos apropos history | grep apropos RET shell >shell-commands bash >bash-commands | grep apropos
This command will show the events from your history containing the text apropos. (The last line of output is the command you just typed.)
76
the text foo, and the last command you typed containing foo appears on the input line. Like the Emacs command of the same name (see Recipe 14.9.1 [Searching Incrementally in Emacs], page 352), this is called an incremental search because it builds the search string in character increments as you type. Typing the string cat will search for (and display) the last input line containing a c, then ca, and nally cat, as you type the individual characters of the search string. Typing CTRL - R again retrieves the next previous command line that has a match for the search string. Here are two ways to use this. To put the last command you entered containing the string grep back on the input line, type:
$ CTRL - R (reverse-i-search)`': grep
To put the third-to-last command you entered containing the string grep back on the input line, type:
$ CTRL - R (reverse-i-search)`': grep CTRL - R CTRL - R
NOTES: When a command is displayed on the input line, type it. You can also edit the command line as usual.
RET
to run
METHOD #2 You can also pipe your history through grep to output lines that match a pattern (see Recipe 14.2 [Searching Text for a Phrase], page 334). This does not put anything on the input line, but will give all the matches at once. You might also want to pipe this output to a text pager such as less so you can peruse it (see Recipe 9.1 [Perusing Text], page 211). To peruse all the lines in your command history containing the text newfile, type:
$ history | grep newfile | less RET
77
( ) takes you back through past events, and the down arrow key ( ) moves you forward to more recent events. When a history event is on the input line, you can edit it as normal, and type RET to run it as a command; it will then become the newest event in your history. To specify the second-to-last command in your history, type:
$
To specify a history event by its event number, enter an exclamation point (!, sometimes called bang) followed by the event number. (Get the event number by viewing your history; see Recipe 3.4.1 [Viewing Your Command History], page 74). To run history event number 1, type:
$ !1 RET
NOTES: The special event number ! is the last event, so typing !! is another way to run the last command you typed.
78
Values themselves may contain variables, which are then expanded when the variable is assigned. You can use any quoting method to give the value, and you can specify the output of a command (see Recipe 3.1.11 [Specifying the Output of a Command as an Argument], page 65). Here are two ways to use this. To give a variable called NAME a value of the contents of the FIRSTNAME and LASTNAME variables, with a space between them, type:
$ NAME="$FIRSTNAME $LASTNAME" RET
To give a variable called NAME a value of the output of the whoami command, type:
$ NAME=`whoami` RET
To change the contents of an existing variable, just give its name as the variable to use. To assign a new value to an existing variable called NAME, type:
$ NAME="whoami" RET
79
If the value of the the NAME variable is whoami, referencing it as a command will run the whoami tool (see Recipe 2.6.1 [Displaying Your Username], page 39). In this example, thats what happened, and the username is mary.
In this example, the variable NAME is shown to contain the string whoami. When you want to output other characters immediately after the name of a variable, enclose the variable name in curly braces ({}), with the dollar sign on the outside and immediately preceding it. To display the contents of the variable NAME followed by the string now, type:
$ echo ${NAME}now RET whoaminow $
Without the curly braces, it would have looked to the shell as though you were referencing a variable called NAMEnow.
80
To remove a variable itself, regardless of the value it contains, use unset and give the name of the variable. To remove a variable called NAME, type:
$ unset NAME RET
Since the replacement text has spaces in it, Ive quoted it (see Recipe 3.1.3 [Quoting Reserved Characters], page 56). You can put special characters in the prompt variable in order to output special text. For example, the characters \w in the value of PS1 will list the current working directory at that place in the shell prompt text. To change your prompt to the default Bash promptthe current working directory followed by a $ charactertype:
$ PS1='\w $ ' RET ~ $
The following table lists some special characters and their text output at the shell prompt.
81
\a \d \h \n \t \@ \w \u \!
An alert or bell character, which rings the system bell (you can ring it yourself by typing CTRL - G ). The current date. The hostname of the system. A newline character. The current system time, in 24-hour format. The current system time, in 12-hour a.m./p.m. format. The current working directory. Your username. The history number of this command.
You can combine any number of these special characters with regular characters when creating a value for PS1. To change the prompt to the current date followed by a space character, the hostname of the system in parentheses, and a greater-than character, type:
$ PS1='\d (\h)>' RET 14 Dec 1999 (ithaca)>
You can add the directory /home/nancy/bin to this path, by editing the line like so:
PATH="/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/nancy/bin"
NOTES: See Chapter 5 [Files and Directories], page 125, for a complete description of directories and the path.
82
The MAIL variable contains the full pathname to your system mail le, usually a directory in /var/spool/mail/ whose name is the same as your username. This is where your incoming mail arrives on the system, and it is the le that the shell checks to see if you have mail. When new messages are written to this le, the shell will tell you, before giving you another input line, that you have mail waiting. To turn o mail call, set MAIL to nothing. To turn o mail call in the shell, type:
$ MAIL= RET
NOTES: To nd out how long the shell has been running in minutes, hours, or some other unit of time, you can convert the number of seconds output with units (see Recipe 29.5.1 [Converting an Amount between Units of Measurement], page 567).
83
Once you see how an alias works, you might be tempted to make an alias for everything. However, there are dierences between aliases and scripts (discussed in the next section) that you should know. With an alias, the command you run will show up in your shell history instead of the alias name you use to call it, whereas with a shell script, only the name of the script will appear and not the commands in the script. Only you can run an alias; a script, if it is put in a public bin directory, can be run by everyone on the system. Aliases are best for calling a tool, with or without options or arguments, by another name. How to do that is shown below.
This command makes bye an alias for the exit tool in the current shell, so typing bye would then run exit. You can also include options and arguments in an alias. When you do, be sure to enclose the entire alias in double quotes. To make ls an alias for the command to list a directory in color on terminals that allow color display, type:
$ alias ls="ls --color=auto" RET
This command makes ls an alias for the ls le listing tool with its -color=auto option specied, which sets color when the output is directed to a terminal that is capable of displaying it. This is a common alias, and many Linux systems come precongured with it in the default .bashrc le. Its also common to make l an alias for ls with the -l option (see Recipe 5.3.3 [Listing File Attributes], page 136). When you have this alias dened you can still pass other options to ls just by specifying them; so typing ls -l in this case will execute ls --color=auto -l as the actual command. Aliases are always expanded before the shell looks on your path, so to run a tool or program whose name is also an alias, give the full path name of
84
the program to run (see Chapter 5 [Files and Directories], page 125, for more about the path). To run the actual ls tool with the -l option when ls is already dened as an alias for something, type:
$ /bin/ls -l RET
NOTES: When you dene an alias, it only works in the current shell. To make an alias work every time you run a shell, put it in your .bashrc startup le, which is a hidden le in your home directory.
NOTES: If you set an alias in your .bashrc or .bash_profile le, this will remove itbut only for the current shell. To remove such an alias from all future sessions, edit the le where it is dened, and remove that particular alias line.
85
or
#!/bin/sh
The pound sign and exclamation point (#!) in both examples indicates to the shell that the le contains commands to be executed; the full path name that follows tells the shell which program to execute the commands with this can be the name of a shell, perl, sed, awk, or some other command language. The rst example tells Bash that the le is to be executed by the bash program itself (the executable le /bin/bash) and not some other program. The second example tells Bash that the le is to be executed by /bin/sh, which on modern systems is another name for the bash executable.2 sh used to be the old Bourne shell, which Bash replaced. Bash can run any Bourne shell script, and youll nd that many people still write /bin/sh in their Bash scripts. To make a Bash shell script named hello that just outputs the text Hello, world to the standard output, do the following: 1. Use a text editor to put the following in a le named hello:
#!/bin/sh echo Hello, world
Technically, /bin/sh is a symbolic link to /bin/bash, done for purposes of backwardscompatibility with older scripts (see Recipe 5.7 [Giving a File More Than One Name], page 152).
86
set (see Recipe 6.3.6 [Making a File Executable], page 170). Scripts can take arguments, just like other kinds of programs. If a script is stored in a directory thats on your path (see Recipe 3.5.7 [Adding to Your Path], page 81), just type the name of the script to run it. Otherwise, give the path name of the script, either full or relative, to run it (full and relative path names are discussed in Chapter 5 [Files and Directories], page 125). Here are some ways to use this. To run a script called hello that is kept in a directory on your path, type:
$ hello RET
To run a script called hello that is kept in the current directory but isnt on your path, type:
$ ./hello RET
To run a script called hello that is kept in the directory ~/input/files/new, type:
$ ~/input/files/new/hello RET
NOTES: To keep things neat, and to avoid having to call scripts by full path names, you should consider keeping them in your own directory for binaries, as described in Recipe C.1 [Using a Directory for Personal Binaries], page 727.
87
88
There are separate conguration les for login and all other shells so that you can put specic customizations in your .bash_profile that only run when you rst log in to the system. To avoid having to put commands in both les when you want to run the same ones for all shells, append the following to the end of your .bash_profile le:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
This makes Bash run the .bashrc le in your home directory when you log in. In this way, you can put all of your customizations in your .bashrc le, and they will be run both at log in and for all subsequent shells. Any customizations before this line in .bash_profile run only when you log in. For example, a simple .bash_profile might look like Figure 3-3, and a simple .bashrc le, in turn, might look like Figure 3-4. The .bash_profile in Figure 3-3 prints a welcome message with the figlet text font tool (see Recipe 16.4.1 [Outputting Horizontal Text Fonts], page 401), and then runs the users .bashrc le. The .bashrc in Figure 3-4 sets a few useful command aliases and uses a custom path and shell prompt whenever a new shell is run. When you log out, Bash reads and executes the commands in the .bash_logout le in your home directory, if it exists. To run commands when you log out, put them in this le. To clear the screen every time you log out, your .bash_logout should contain the following line:
clear
This executes the clear command, which clears the screen of the current terminal. NOTES: Some distributions come with default shell startup les lled with all kinds of interesting things. Debian users might want to look at the example startup les in /usr/share/doc/bash/examples/startup-files.
89
The rst and last lines of the le show the beginning and ending time and date of the capture session. To stop recording the typescript, type exit at a shell prompt. By default, typescripts are saved to a le called typescript in the current directory; specify the le name as an argument. To create a typescript of a shell session and save it to the le log.19990525, type:
$ script log.19990525 RET Script started, output file is log.19990525 $ hostname RET erie $ apropos bash > bash.commands RET $ exit RET exit Script done, output file is log.19990525 $
In this example, the typescript records a shell session consisting of two commands (hostname and apropos) to a le called log.19990525. The typescript looks like Figure 3-5.
Script started on Tue May 25 14:21:52 1999 $ hostname erie $ apropos bash > bash.commands $ exit exit Script done on Tue May 25 14:22:30 1999
Figure 3-5. A typescript of a shell session. NOTES: You wont be happy with the output if you record a session with an interactive program such as Emacs or Vi. This is because such programs control the display; all of their screen-manipulating sequences will be saved to the typescript, where they will appear as junk characters to human eyes. Its possible, but usually not desirable, to run script from within another script session. This usually happens when youve forgotten that you are running it, and you run it again inside the current typescript, even multiple
90
times. As a result, you may end up with multiple sessions nested inside each other like a set of Russian dolls.
METHOD #2 To run a shell in place of your current shell, use exec. Give as an argument the name of the command of the new shell you want to run. This stops your current shell and replaces it with the new shell. If you run this command from a login shell, then when you exit the new shell, you will be logged out. To run Csh in place of your current shell, type:
$ exec csh RET
NOTES: You can use exec to run any command in place of the current shell, not just another shell.
91
NOTES: Exiting your login shell will log you out of the system (see Recipe 2.2.2 [Logging Out of the System], page 31).
In this example, ksh is the current shell. NOTES: This will output the name of the current shell in most shells, but there are rare exceptions. With the shell-like tclsh and wish programs, this will output the following error message: can't read "0": no such variable.
92
installed on the system.3 If you have second thoughts, just hit asksthen, your login shell will not be changed. To change your default shell to pdmenu, type:
$ chsh RET Password: sesame RET Changing the login shell for suzie Enter the new value, or press return for the default Login Shell [/bin/bash]: pdmenu RET $
RET
when it
In this example, the user suzie with a password of sesame changed her login shell to pdmenu, a shell described in the next recipe.
Ash
netbsds ash (the Almquist shell) is smaller than Bash and has features similar to the original Bourne shell. Useful for Linux-on-a-oppy and small installations. DEB: ash RPM: ash WWW: http://sources.isc.org/utils/shell/ash.txt
93
Csh
The interface of the sea shell is like the C programming language and, having originated on the bsd avor of unix, is popular on those systems. DEB: csh RPM: tcsh WWW: http://tcshrc.sourceforge.net/ The easy shell is a small shell that uses a Lisp-like syntax as the primary means of interface. DEB: esh RPM: esh WWW: http://olympus.het.brown.edu/doc/esh/esh.html A complete Emacs command shell, using Emacs Lisp as the interface. DEB: eshell WWW: http://www.emacswiki.org/johnw/EmacsShell.html Inspired by old pc command interpreters, this is a shell for novices who have had dos experience but are new to unix. DEB: lsh A shell that uses the syntax and features of the perl programming language. DEB: psh RPM: psh WWW: http://sourceforge.net/projects/psh/ at&ts Korn shell, named after its author David Korn, brought together the features of Csh and the original shell; Pdksh is a public domain implementation of this old unix standby. DEB: pdksh RPM: pdksh WWW: http://web.cs.mun.ca/~michael/pdksh/
Esh
Eshell
Lsh
Psh
Pdksh
94
Pdmenu
This is a full-screen text menuing system, in color, intended as a way for inexperienced users to select and run programs. DEB: pdmenu RPM: pdmenu WWW: http://kitenet.net/programs/pdmenu/ Based on the at&t Plan 9 shell, this is a fast shell with a syntax similar to the C programming language. DEB: rc WWW: http://www.star.le.ac.uk/~tjg/rc/ The tenex C shell is an enhanced version of Csh. DEB: tcsh RPM: tsch WWW: http://www.tcsh.org/ Similar to the Korn shell, but with features like spelling correction and scripting enhancements. DEB: zsh RPM: zsh WWW: http://www.zsh.org/
rc
Tcsh
Zsh
95
4.1 Running X
When you start X, you should see a mouse pointer appear on the screen as a large, black X. If your X is congured to start any tools or applications, they should each start and appear in individual windows. A very plain and simple X session might look like Figure 4-1. The root window is the background behind all of the other windows. It is usually set to a color, but you can change it (see Recipe 4.7.3 [Changing the
1
Sometimes you might catch it being called X Windows, but this term is technically incorrect.
96
Root Window Parameters], page 118). Each program or application in X runs in its own window. Each window has a decorative border around some or all of its sides, called the window border; l-shaped corners, called frames; a top window bar, called the title bar, which displays the name of the window; and several title bar buttons on the left and right sides of the title bar (described in Recipe 4.3 [Manipulating X Client Windows], page 105). Depending on the window manager and its settings, any of these elements may be invisible.
Figure 4-1. A simple X session. The entire visible work area, including the root window and any other windows, is called the desktop. The box in the lower right-hand corner, called the pager, allows you to move about a large desktop (see Recipe 4.4 [Moving Around the Desktop], page 108). A window manager is a program that controls the way windows look and are displayedthe window dressing, as it wereand can provide some additional menu or program-management capabilities. The window manager starts as soon as you run X. There are many dierent window managers to choose from, each with a variety of features and capabilities; part of the fun of starting to use Linux is trying them all out to nd a favorite. See Recipe 4.7.5 [Using Other Window Managers], page 120, for a list of some of the more popular or interesting ones.
97
Window managers typically allow you to customize the colors and borders that are used to display a window, as well as the type and location of buttons that appear on the window (see Recipe 4.2 [Running a Program in X], page 101). For example, in the image above, the clock itself is the oclock program, while the title bar above it is drawn by the fvwm2 window manager. With the AfterStep window manager, the title bar would look a little dierent, as in Figure 4-2.
Figure 4-2. An oclock in AfterStep. There are many window managers you can choose from, all dierent; instead of describing only one, or describing all of them only supercially, this chapter explains the basics of X, the fundamentals that everyone must know to use X regardless of his particular setup, and that are common to all window managers. In recent years, desktop environments have also become popular. These are application suites that run on top of the window manager (and X), with the purpose of giving your X session a standardized look and feel; these suites normally come with a few basic tools, such as clocks and le managers. The two principal desktops are gnome (the gnu Projects gnu Network Object Model Environment) and kde (the K Desktop Environment).2 If you have a recent Linux distribution and chose the default install, chances are good that you have either gnome or kde installed, with something like Window Maker or fvwm2 assigned as the default window manager. (While you can have more than one window manager installed on your system, you can only run one at a time.)
2
Desktops are designed to be an intuitive and user friendly interface to X, so in this book I explain the fundamentals of using X itself; learn more about these desktop environments from their Web sites: http://gnome.org/ and http://kde.org/.
98
4.1.1 Starting X
There are two principal ways to start X. How you start it on your system will depend on whether or not the X Display Manager is installed. METHOD #1 Xdm DEB: xdm RPM: xdm WWW: http://www.xfree86.org/
If the X Display Manager, xdm, is installed, use it to manage your X session. Systems that have it installed are typically congured to go to the seventh virtual console when the system boots, so youll see a graphical xdm login screen right away. Some distributions customize this login screenfor example, Fedora shows a Fedora Core logo and draws a box underneath it for entering your username. You can log in directly to an X session from this screen, typing your username and password in the appropriate boxes. When xdm is running but the system is not congured to go to the seventh virtual console at boot time, switch to it so you can log in to an X session. To switch to the seventh virtual console, type:
ALT - F7
METHOD #2 On systems not running xdm, the virtual console reserved for X will be blank, until you start X yourself by running startx in another virtual console. Messages from startx, including any error messages, are displayed in the console you run it in, while X itself will run in the seventh virtual console. Here are two ways to use this. To start X yourself from another virtual console, type:
$ startx RET
To run startx and redirect both its standard output and standard error to a log le, type:
$ startx &> ~/startx.log RET
99
Both of these examples start X on the seventh virtual console, regardless of which console you are at when you run the commandyour console automatically switches to X on the seventh console. You can always switch to another console during your X session (see Recipe 2.3 [Using Consoles and Terminals], page 32). The second example writes any error messages or output of startx to a le called startx.log in your home directory. When you start X, you can specify the color depth to use, which is the number of bits used to render possible colors for each pixel on the display.3 It is specied in terms of power to two; therefore, 8-bit color means a pixel can be 28 or any one of 256 possible colors, 16-bit color gives 65,536 possible colors (216 ), and with 24-bit color (224 ), pixels can be any one of 16,777,216 colors (1-bit color, then, is exactly two colors). Color depth is limited by display hardware. Depending on your systems conguration and graphics card, X may start with a default color depth anywhere from 8-bit to 24-bit. You can specify another color depth by using startx with the special -bpp option; follow it with a number indicating the color depth to use, and precede the option with two hyphen characters (--), which tells startx to pass the options that follow it to the X server itself. To start X from a virtual console and specify 24-bit color depth, type:
$ startx -- -bpp 24 RET
NOTES: If your system runs xdm, you can always switch to the seventh virtual console (or whichever console xdm is running on), and then log in at the xdm login screen.
4.1.2 Stopping X
There are a few methods for stopping X. METHOD #1 The normal way to end an X session is to do it through your window manager. Most window managers have an Exit X menu option or something similar that you can select with the mouse; others have keystroke commands for exiting X.
A bit is the computers smallest unit of information, and can be either a binary 0 or 1; pixels are the individual colored dots that make up your display screen.
100
Here are some ways to use this. To end your X session if you are running the fvwm2 window manager, do the following: 1. Click the left mouse button anywhere in the root window to pull up the start menu. 2. Choose Really quit? from the Exit Fvwm submenu. To end your X session if you are running the AfterStep window manager, do the following: 1. Click the left mouse button anywhere in the root window to pull up the start menu. 2. Choose Exit? from the Quit submenu. 3. Click Logout. To end your X session if you are running the Ion window manager, do the following: 1. Press
F12
If you started your X session with startx, these commands will return you to a shell prompt in the virtual console where the command was typed. If, on the other hand, you started your X session by logging in to xdm on the seventh virtual console, you will be logged out of the X session and the xdm login screen will appear; you can then switch to another virtual console or log in to X again. METHOD #2 To exit X immediately and terminate all X processes, press the CTRL - ALT BKSP combination (if your keyboard has two ALT and CTRL keys, use the left ones). Youll lose any unsaved application data, but this is useful when you cannot exit your X session normallyin the case of a system freeze or other problem. To exit X immediately, type:
CTRL - ALT - BKSP
101
Figure 4-3. An analog xclock. METHOD #2 You can also start a client by running it from a shell windowuseful for starting a client that isnt on the menu, or for when you want to specify options or arguments. When you run an X client from a shell window, the
102
client opens in its own window, but runs as a foreground job in that shell; to use the shell window while the client is running, run the client in the background (see Recipe 3.3.2 [Putting a Job in the Background], page 72). To run a digital clock from a shell window, type:
$ xclock -digital & RET
This command runs xclock in the background from a shell window; thedigital option species a digital clock. The following sections explain how to specify certain command line options common to most X clients, such as window layout, colors, and fonts.
The values in these four elds are usually given in pixels, although some applications measure WIDTH and HEIGHT in characters. While you must give these values in order, you can omit either pair. For example, to specify just the size of the window, give values for WIDTH and HEIGHT only. Here are some ways to use this. To start a small xclock, 48 pixels wide and 48 pixels high, type:
$ xclock -geometry 48x48 RET
To start a large xclock, 480 pixels wide and 500 pixels high, type:
$ xclock -geometry 480x500 RET
To start an xclock with a width of 48 pixels and the default height, type:
$ xclock -geometry 48 RET
To start an xclock with a height of 48 pixels and the default width, type:
$ xclock -geometry x48 RET
You can give positive or negative numbers for the XOFF and YOFF elds. Positive XOFF values specify a position from the left of the screen; negative values specify a position from the right. If YOFF is positive, it species a position from the top of the screen; if negative, it species a position from the
103
bottom of the screen. When giving these osets, you must specify values for both XOFF and YOFF. To place the window in one of the four corners of the desktop, use zeroes for the appropriate XOFF and YOFF values, as follows: +0+0 +0-0 -0+0 -0-0
$ xclock -geometry +0-0 RET
Upper left-hand corner. Lower left-hand corner. Upper right-hand corner. Lower right-hand corner.
To start a default size xclock in the lower left-hand corner, type: Or, to put it all together, you can specify the size and location of a window with one geometry line that includes all four values. To start an xclock with a width of 120 pixels, a height of 100 pixels, an x-oset of 250 pixels from the right side of the screen, and a y-oset of 25 pixels from the top of the screen, type:
$ xclock -geometry 120x100-250+25 RET
Use the -iconic option to start a client as an icon, so that it appears as an icon as soon as it is run. The client will start, but it will be displayed as a small icon until you click on it (see Recipe 4.3.5 [Deiconifying an X Window], page 107). To start an xclock as an icon, but that will open in the upper right-hand corner when you maximize it, type:
$ xclock -geometry -0+0 -iconic RET
Press Q to exit xcolors. To specify a color to use for the window background, window border, and text or graphics in the window itself, give the color name as an argument
104
to the appropriate option: -bg for background color, -bd for window border color, and -fg for foreground color. To start an xclock with a light blue window background, type:
$ xclock -bg lightblue RET
You can specify any combination of these attributes. To start an xclock with a sea green window background and a turquoise window foreground, type:
$ xclock -bg seagreen -fg turquoise RET
NOTES: The -bordercolor, -background, and -foreground options are synonymous with -bd, -bg, and -fg.
Figure 4-4. A digital xclock with Helvetica type. NOTES: If you specify the font for a shell window, you can resize it after its running, as described in Recipe 16.1.4 [Resizing the Xterm Font], page 398. The -font option is synonymous with -fn.
105
To start an xclock 225 pixels wide with a title of As Time Goes By, type:
$ xclock -title "As Time Goes By" -geometry 225 RET
106
107
108
To get information about a client window, do the following: 1. Run xwininfo in a terminal window:
$ xwininfo RET xwininfo: Please select the window about which you would like information by clicking the mouse in that window.
2. Click the left mouse button anywhere in the window youd like information on. This command outputs, in the terminal window you typed it in, a list of information on the client window you selected with the mouse.
109
the lower right-hand corner of your screen, even when you scroll across a virtual desktop. Both your current desktop and active X client are highlighted in the pager. The default fvwm2 virtual desktop size is nine desktops in a 3x3 grid, as in Figure 4-5.
Figure 4-5. An fvwm2 pager. In the preceding illustration, the current desktop is the second one in the top row. The rst desktop contains two X client windowsa small one and a large onebut there are no windows in any other desktops (including the current one). To switch to another desktop, click the left mouse button on its corresponding view in the pager, or use a keyboard shortcut if your window manager provides one. In fvwm2, the default keys for switching between desktops are ALT in conjunction with the arrow keys; in AfterStep, use the CTRL key in place of ALT . To switch to the desktop to the left of the current one while running . fvwm2, type ALT To switch to the desktop directly to the left of the current one while running AfterStep, type CTRL .
110
vt102/220 and Tektronix 4014 video terminals.4 You can run commands in an xterm window just as you would in a virtual console; a shell in an xterm acts the same as a shell in a virtual console (see Chapter 3 [The Shell], page 53). You can use all of the standard X client options with xterm (see Recipe 4.2 [Running a Program in X], page 101), but it also has many options of its own, which are described in the next recipe. To open a new window with a shell, setting the text font to Lucida Sans Typewriter face at a body size of 18 pixels, type:
$ xterm -fn lucidasanstypewriter-18 RET
This example requires that you already have a terminal emulator running, with a shell prompt you can type from. If you dont have one, then you will have to start an xterm by selecting it from an application menu, as provided through your window manager. To open a new window with a shell when using the Ion window manager, setting the text font to Lucida Sans Typewriter face at a body size of 18 pixels, type:
F3
You can cut and paste text from an xterm to another X client (see Recipe 10.3 [Manipulating Selections of Text], page 253). To scroll through text that has scrolled past the top of the screen, type SHIFT - PgUp . The number of lines you can scroll back to depends on the value of the scrollback buer, specied with the -sl option; its default value is 64.
To see what the original hardware looks like, see the following: http://www.cs.utk.edu/~shuford/terminal/dec.html and http://www.cs.utk.edu/~shuford/terminal/various.html#tek.
111
Always highlights the cursor, even when the window is no longer in focus. When the window is not in focus, makes the cursor hollow (the default). Turns on auto-wraparound, so that text reaching past the right margin is wrapped over to the next line (the default). Turns o auto-wraparound; text reaching past the right margin is deleted in such a way so that the last character of a line is printed as the last character before the margin. Species the size, in pixels, of the inner border (the default is two). Turns o display of bold characters in color, rather than in bold (the default). Displays bold characters in color. Disables recognition of ansi control sequences. Enables recognition of ansi control sequences (the default). Species the color to be used for the text cursor. Species the font used for bold text (the default is to overstrike the normal text font.) The value you give must have the same height and width used for normal text. Sets the color used in the background of highlighted or selected text (the default is to use a reverse of the normal text colors). Turns on jump scrolling, where quick-owing text is scrolled by jumping past many lines at once instead of scrolling every line on the screen; recommended for increasing speed when going through a lot of text (the default).
+aw
-hc color
-j
112
+j -leftbar
Turns o jump scrolling. Places the scrollbar along the left margin of the window (the default), if also enabled with the -sb option. Uses a login shell for the shell (i.e., for Bash users, this means that the .bash_profile is run on startup; this is the default). Species not to use a login shelluses a normal subshell instead (i.e., for Bash users, this means that the .bash_profile is not run). Turns on a margin bell, which rings when the cursor approaches the right margin. Turns o the margin bell (the default). Species the time, in milliseconds, between multiple clicks when selecting text. Species the color for the X mouse pointer, when its in the xterm window (this is sometimes called the pointer cursor; the value defaults to the foreground color). Species the number of characters, from the right margin, at which point the margin bell should ring, if used (the default is ten). Enables the display of underlining (the default). Disables the display of underlining. Enables pc-style bold colors (brighter color values; the default). Disables pc-style bold colors. Place the scrollbar along the right margin of the window, if also enabled with the -sb option.
-ls
+ls
-nb color
113
-rw
Allows for reverse-wraparound, where the cursor may back up from one line to the right margin of the previous one, when editing long command lines (the default). Does not allow reverse-wraparound. Enables a scrollbar so that lines scrolled o the top of the window can be viewed by scrolling back on the bar. Disables the scrollbar (the default). Species that when a key is pressed when using the scrollbar to view previous text, the window display moves forward to the current input line (the default). Species that when a key is pressed when using the scrollbar to view previous text, the window display does not move forward to the current input line. Species the number of lines that scroll o the top of the screen that should be saved, for viewing with the scrollbar. Species that underlined characters should not be displayed in color (the default). Species that underlined characters should be displayed in color instead of being underlined. Species that a visual bell is to be used rather than an audible one (the window is quickly ashed). Disables any visual bell (the default).
+rw -sb
+sb -sk
+sk
-sl number
There are even more options than this; consult the xterm man page for a complete listing (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46).
114
the name of the command to run as an argument. An xterm will open with that command, and it will run in its own window; when that command exits, the xterm window will close. This is handy for when you just want to run a particular command in its own window, but dont need a shell. To run bc in its own X window, type:
$ xterm -e bc RET
When you exit the command, the shell will exit and the window will close. You can also pass arguments to the command. To run lynx with the url file:/usr/local/, type:
$ xterm -e lynx file:/usr/local/ RET
In this example, lynx opens the given url in its own window, and will remain until you either kill the window or exit lynx. NOTES: If calling xterm with other options, the -e option must be the last option specied in the command line.
AfterStep XVT
This color vt102 terminal emulator was made to work with the AfterStep window manager, but can also be used with others; has many special eects such as tinting and shading, yet is smaller than xtermand uses less swap space, too. DEB: aterm RPM: aterm WWW: http://aterm.sourceforge.net/ This color vt102 terminal emulator was made to work with the Enlightenment window manager, but can also be used with others; supports themes and has many features to control its appearance. DEB: eterm RPM: Eterm WWW: http://www.eterm.org/
115
Konsole
This graphical terminal emulator for kde allows you to run multiple terminals in a single window. DEB: konsole RPM: konsole WWW: http://konsole.kde.org/ This graphical terminal emulator for gnome features enhancements inspired by Konsole, that allow for multiple terminals in a single window. DEB: multi-gnome-terminal RPM: multi-gnome-terminal WWW: http://multignometerm.sourceforge.net/ As the name implies, this terminal emulator supports various foreign language encodings. DEB: mlterm RPM: mlterm WWW: http://mlterm.sourceforge.net/ This color terminal emulator allows multiple terminals in the same window that you can switch between by clicking on tab buttons. DEB: powershell RPM: powershell WWW: http://powershell.sourceforge.net/ Known to everyone by its command name, rxvt, this is a color vt102 terminal emulator designed to be a xterm replacement, and is smaller and less memory-intensive as the latter, but with less emulation options and congurability. DEB: rxvt RPM: rxvt WWW: http://sourceforge.net/projects/rxvt/ This DEB: RPM: WWW: is xterm with Unicode support. xterm xterm http://dickey.his.com/xterm/
PowerShell
ouR XVT
Unicode
116
Wterm
This is based on ouR XVT, but optimized for the Window Maker window manager. Its features include tranparency, tinting, and background images. DEB: wterm RPM: wterm WWW: http://largo.windowmaker.org/files.php#wterm
2. Click the middle mouse button in the upper left-hand corner of the region to magnify. 3. Move the pointer to the lower right-hand corner of the region, and then release the middle mouse button. To run xmag on a three-second delay, to give you time to change to another desktop window before it runs, type:
$ sleep 3; xmag RET
4.7 Conguring X
There are some aspects of X that people usually want to congure right away. This section discusses some of the most popular, including changing the video mode, automatically running clients at startup, and choosing a window manager. Youll nd more information on this subject in both The X Window
117
User HOWTO and The Conguration HOWTO (for how to read them, see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50).
To cycle through all available modes, type either of these key combinations repeatedly. NOTES: For more information on video modes, see The XFree86 Video Timings HOWTO (see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50).
118
#! /bin/sh # # A sample .xsession file.
aterm +sb -bg black -fg white -cr brown & asclock -geometry +0+0 & emacs ~/TODO & exec /usr/bin/afterstep
All clients start as background jobs, with the exception of the window manager on the last line, because when this le runs, the X session is running in the foreground (see Recipe 3.3 [Managing Jobs], page 70). Always put an ampersand (&) character at the end of any command line you put in your .xsession le, except for the line giving the window manager on the last line.
To change the root window pattern, use the -bitmap option, and give the name of the bitmap le to use. To tile the root window with a star pattern, type:
$ xsetroot -bitmap /usr/X11R6/include/bitmaps/star RET
When specifying a pattern, use the -fg and -bg options to specify the foreground and background colors. To tile the root window with a light slate gray star pattern on a black background, type (all on one line):
$ xsetroot -fg slategray2 -bg black -bitmap /usr/X11R6/include/bitmaps/star RET
119
Use xsetroot with the special -gray option to change the root window to a shade of gray designed to be easy on the eyes, with no pattern. To make the root window a gray color with no pattern, type:
$ xsetroot -gray RET
NOTES: You can also put an image in the root window (although this consumes memory that could be spared for a memory-hogging Web browser instead; but see Recipe 17.1.2 [Putting an Image in the Root Window], page 410, for how to do it).
You can turn the bell back on with the on argument. You can control the volume, pitch, and duration of the bell by giving three numbers as arguments to the b option: The rst is the volume as a percentage of its maximum value, the second is the pitch in Hertz, and the third is the duration in milliseconds. Running xset with the b option and no arguments returns the bell to its defaults. Here are two ways to use this. To set the bell for 75 percent of its maximum volume, ringing at 440 Hz for one second, type:
$ xset 75 440 1000 RET
NOTES: To make an xset setting permanent, aecting every X session you run, you will want to put the command in your .xsession le (see Recipe 4.7.2 [Running X Clients Automatically], page 117). When you start a terminal emulator, you can use the -vb option to turn o the audible bell in just that terminal window (see Recipe 4.5.1 [Changing the Default X Terminal Behavior], page 110).
120
9wm
9wm is a simple window manager inspired by at&ts Plan 9 window managerit does not use title bars or icons. It should appeal to those who like the Wily text editor (see Recipe 10.8 [Using Other Text Editors], page 263). DEB: 9wm RPM: 9wm WWW: http://www.plig.org/xwinman/archive/9wm/ AfterStep is inspired by the look and feel of the nextstep interface. DEB: afterstep RPM: AfterStep WWW: http://www.afterstep.org/ BlackBox is a fast, lightweight window manager with a contempoary look and feel. DEB: blackbox RPM: blackbox WWW: http://blackboxwm.sourceforge.net/ Enlightenment is a graphics-intensive window manager that uses desktop themes for decorating the various controls of the X session. DEB: enlightenment RPM: enlightenment WWW: http://www.enlightenment.org/
Afterstep
BlackBox
Enlightenment
121
Fluxbox
Fluxbox is based on BlackBox, adding new features including window tabs, keyboard shortcuts, and an icon bar. DEB: fluxbox RPM: fluxbox WWW: http://www.plig.org/xwinman/fluxbox.html fvwm95 makes X look like a certain proprietary desktop os from circa 1995. DEB: fvwm95 WWW: ftp://ftp.plig.org/pub/fvwm95/ Designed to be navigable by the keyboard, keeping applications and client windows in full-screen frames, Ion is becoming a favorite for those who value speed and eciency and dont particularly care for windowing systems in general. DEB: ion RPM: ion WWW: http://modeemi.cs.tut.fi/~tuomov/ion/ The Tab Window Manager is an older, simple window manager that is available on almost every system. (Its also sometimes called Toms Window Manager, after its primary author, Tom LaStrange.) DEB: twm RPM: twm WWW: http://www.plig.org/xwinman/vtwm.html wm2 is a minimalist, conguration-free window manager. DEB: wm2 RPM: wm2 WWW: http://www.all-day-breakfast.com/wm2/ The window manager of choice for the gnu Project, Window Maker is congurable through easy menus, and is often compared to nextstep. DEB: wmaker wmaker-data RPM: wmaker WWW: http://www.windowmaker.org/
FVWM95
Ion
TWM
WM2
Window Maker
To try one of these window managers out, select it from the application menu as given by the current window manager. This will exit your window
122
manager and start the new one. If you nd one you like and wish to make it the default, edit your .xsession le so that its last line contains exec followed by the full path name of the window manager to use (see Recipe 4.7.2 [Running X Clients Automatically], page 117). To make AfterStep your default window manager, put the following as the last line in your .xsession le:
exec /usr/bin/X11/afterstep
NOTES: Some window managers (such as twm and wm2) do not have application menus, so if you run such a window manager you wont be able to easily switch to another during that sessionyoull have to exit X and start it again.
II. FILES
123
II. FILES
124
125
126
Each user has a branch in the /home directory for his own les, called his home directory. The hierarchy in the previous illustration has two home directories: joe and jon, both subdirectories of /home.
dict bin usr jon play work joe home bin etc (root)
Figure 5-1. The root directory tree. When you are in a shell, you are always in some directory on the system, and that directory is called the current working directory. When you rst log in to the system, your home directory is the current working directory. Whenever specifying a le name as an argument to a tool or application, you can give the slash-delimited path name relative to the current working directory. For example, if /home/joe is the current working directory, you can use work to specify the directory /home/joe/work, and work/schedule to specify schedule, a le in the /home/joe/work directory. Every directory has two special les whose names consist of one and two periods: .. refers to the parent of the current working directory, and . refers to the current working directory itself. If the current working directory is /home/joe, you can use . to specify /home/joe and .. to specify /home. Furthermore, you can specify the /home/jon directory as ../jon. Another way to specify a le name is to specify a slash-delimited list of all of the directory branches from the root directory (/) all the way down to the
127
le you want to specify. This unique, specic path from the root directory to a le is called the les full path name. (When referring to a le that is not a directory, this is sometimes called the absolute le name). You can specify any le or directory on the system by giving its full path name. A le can have the same name as other les in dierent directories on the system, but no two les or directories can share a full path name. For example, user joe can have a le schedule in his /home/joe/work directory and a le schedule in his /home/joe/play directory. While both les have the same name (schedule), they are contained in dierent directories, so each has a unique full path name/home/joe/work/schedule and /home/joe/play/schedule. However, you dont have to type the full path name of a tool or application in order to start it. The shell keeps a list of directories, called the path, where it searches for programs. If a program is in your path, which means that it is in one of these directories, you can run it simply by typing its name. By default, the path includes /bin and /usr/bin. For example, the who command is in the /usr/bin directory, so its full path name is /usr/bin/who. Since the /usr/bin directory is in the path, you can type who to run /usr/bin/who, no matter what the current working directory is. The following table describes some of the standard directories on Linux systems. / The ancestor of all directories on the system; all other directories are subdirectories of this directory, either directly or through other subdirectories. Essential tools and other programs (or binaries). Files representing the systems various hardware devices. For example, you use the le /dev/cdrom to access the cd-rom drive. Miscellaneous system conguration les, startup les, et cetera. The home directories for all of the systems users. Essential system library les used by tools in /bin. Files that give information about current system processes.
/bin /dev
128
/root
The superusers home directory, whose username is root. (In the past, the home directory for the superuser was simply /; later, /root was adopted for this purpose to reduce clutter in /.) Essential system administrator tools, or system binaries. Temporary les. Subdirectories with les related to user tools and applications. Files relating to the X Window System, including those programs (in /usr/X11R6/bin) that run only under X. Tools and applications for users. Dictionaries and word lists (slowly being outmoded by /usr/share/dict). Miscellaneous system documentation. Games and amusements. Files for the Gnu Info hypertext system (see Recipe 2.8.5 [Reading an Info Manual], page 48). Libraries used by tools in /usr/bin. Local lesles unique to the individual system including local documentation (in /usr/local/doc) and programs (in /usr/local/bin). The online manuals, which are read with the man command (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46). Data for installed applications that is architectureindependent and can be shared between systems. A number of subdirectories with equivalents in /usr also appear here, including /usr/share/doc, /usr/share/info, and /usr/share/icons.
/usr/man
/usr/share
129
Program source code for software compiled on the system. Another directory for temporary les. Variable data les, such as spool queues and log les.
For more information on the directory structure of Linux-based systems, see the Filesystem Hierarchy Standard [http://www.pathname.com/fhs/]. On Debian systems, you can also view this information in the compressed les in the /usr/doc/debian-policy/fsstnd/ directory (see Recipe 9.1 [Perusing Text], page 211).
Files dont have to have any extensions at all, like myfile, and you can have les with multiple extensions, too, like long.file.with.many.extensions. A jpeg-format image le, for example, does not have to have a .jpg or .jpeg extension, and program les do not need a special extension to make them work. Extensions are particularly useful if youre sending les to users on other computers, particularly systems that require extensionssend a le in Microsoft Word format to a Windows user without giving it a .doc extension rst, and youre likely to be told the le doesnt work.
1
Technically, there are other characters that you can usebut doing so may get you into trouble later on.
130
The le name before any le extensions, but without the path, is called the base le name. For example, the base le name of /home/lisa/house.jpeg is house, without the dot or trailing jpeg, and without the path. For a list of commonly used le extensions and their meanings, see Appendix B [Conventional File Name Extensions], page 723. The following sections show how to make new les. To rename an existing le, just move it to a le with the new namesee Recipe 5.5 [Moving Files and Directories], page 144.
To create the le another_empty_file in the work/completed subdirectory of the current directory, type:
$ touch work/completed/another_empty_file RET
This tool touches the les you give as arguments. If a le does not exist, it creates it; if the le already exists, it changes the modication timestamp on the le to the current date and time, just as if you had used the le. NOTES: Often, you make a le when you edit it, such as with a text or image or sound editor; in that case, you dont need to make the le rst.
131
This makes a 2001 subdirectory in the directory called completed, which in turn is in a directory called work in the current directory; if the completed or the work directories do not already exist, they are made as well. If you know that work and completed both exist, the previous command works ne without the -p option.
You can also use double quote characters (") to quote; if a le name contains one kind of quote in its name, use the other. To list the contents of the directory named McHale's Restuarant, type:
$ ls "McHale's Restaurant" RET
132
METHOD #2 To use a le with space characters in its name, precede each space character with a backslash character (\). To change to the directory named Newspaper Photo Archive, type:
$ cd Newspaper\ Photo\ Archive RET
Use the backslash to precede other special characters, including quotes. To remove a le named A "tough" one, type:
$ rm -i A\ \"tough\"\ one RET
In this example, rm was called with the -i option, which removes les interactively, asking for conrmation before each remove takes place (see Recipe 5.6.2 [Removing Files Interactively], page 150). NOTES: If you dont want spaces in a le, but you would like the words in its name to be separated, you might change the spaces in the le name to underscore characters (_). This is a common unix convention.
133
In this example, pwd output the text /home/mrs, indicating that the current working directory is /home/mrs.
orange
134
In the rst example, the current working directory contains three les: apple, cherry, and orange. The following subsections describe some commonly used options for controlling which les ls lists, and what information about those les ls outputs. You can combine these options to get their combined eects; the order in which the options are specied does not matter. There are even more options than what is given here; the Info documentation for ls is worth perusing. It is one of the most often used le commands on unix-based systems. NOTES: There are a few other common ways to list the contents of directories. One that is common when in X, and when you want to peruse image les in those directories, is to use Mozilla or some other Web browser as a local le browser. Use the prex2 file:/ to view local les. Alone, it opens a directory listing of the root directory; file:/home/joe opens a directory listing of user joes home directory, file:/usr/local/src opens the local source code directory, and so on. Directory listings will be rendered in html on the y in almost all browsers, so you can click on subdirectories to traverse to them, and click on les to open them in the browser. This and other methods for browsing les are described in Recipe 5.10 [Browsing Files and Directories], page 157.
This command lists the root directory in color, as in Figure 5-2. (While this illustration is black and white, the actual directory listing is in color.)
2
135
Figure 5-2. A color directory listing. NOTES: Many systems are set up to use this ag by default, so that using ls with no options will list in color. If yours isnt set up this way, and youd like it to be, you can always make ls a shell alias word for ls --color in your .bashrc startup le (see Recipe 3.6.1 [Calling a Command by Some Other Name], page 83 and see Recipe 3.7.3 [Using Shell Startup Files], page 86).
136
To list the contents of the directory so that directories, executables, and special les are distinguished from all other les, type:
$ ls -F RET repeat* test1 $ test2 words/
In this example, the current directory contains an executable le named repeat, a directory named words, and some other regular les named test1 and test2.
listing
of
the
les
in
Figure 5-3. A verbose directory listing. The rst line of output gives the total amount of disk space, in 1024-byte blocks, that the les take up (in this example, 144). Each subsequent line displays several columns of information about one le. The rst column displays the les type and permissions. The rst character in this column species the le type; the hyphen (-) is the default and means that the le is a regular le. Directories are denoted by d, and symbolic links (see Recipe 5.7 [Giving a File More Than One Name], page 152) are denoted by l. The remaining nine characters of the rst column show the le permissions (see Recipe 6.3 [Controlling Access to Files], page 167). The
137
second column lists the number of hard links to the le. The third and fourth columns give the names of the user and group that the le belongs to. The fth column gives the size of the le in bytes, the sixth column gives the date of last modication, and the last column gives the le name. Other options change the defaults for the long-style output. To change the modication date from the abbreviated month, day, and then year output to show the full time and date (like the default of date, as described in see Recipe 27.1 [Displaying the Date and Time], page 537), use the special --full-time option. To output a verbose listing of the /usr/share/doc/bash directory, giving the full time and date of last modication, type:
$ ls -l --full-time /usr/share/doc/bash RET
This command outputs a verbose listing of the les in the /usr/share/doc/bash directory, showing the full time and date of last modication, as in Figure 5-4.
Figure 5-5. A verbose directory with human-readable numbers. To specify that the numbers in the output should be in a human readable form, instead of in blocks, use the -h option. When combined with -l, this will give the total amount of disk space and size of each le in bytes, kilobytes (followed by a k), or megabytes (followed by an M).
138
To output a verbose listing of the /usr/share/doc/bash directory, giving all numbers in a human readable form, type:
$ ls -lh /usr/share/doc/bash RET
This command outputs a verbose listing of the les in the /usr/share/doc/bash directory, giving all numbers in a human readable form, as in Figure 5-5.
Use the -A option to list almost all les in the directory: it lists all les, including dot leswith the exception of the .. and . directory les. To list all les in the current directory except for .. and ., type:
$ ls -A RET
When output from ls is piped to anywhere but the terminal, ls uses this single-column format. Normally, ls lists les in columns going verticallyrst the leftmost column will be lled, and then the next column, all the way over toward the right side of the screen. Use -x to make the columns list horizontally insteadso that the rst line across is lled with le names rst, and then the next line, until all les are listed.
139
Use the -m option to output les not in columns at all, but in a single horizontal line, separated by commas. To output the contents of /usr/bin in a single line, with le names separated by commas, type:
$ ls -m /usr/bin RET
METHOD #2 Use the -t option with ls to sort a directory listing by time, so that the les are listed according to when they were last modied, with the most recently modied listed rst. To list all of the les in the /usr/tmp directory sorted by their modication time, with the mostly recently modied les rst, type:
$ ls -t /usr/tmp RET
METHOD #3 To sort les by their extension, use the -X option. Files with no extension are listed rst. To list all les in the current directory, sorted by extension, type:
$ ls -X RET
140
METHOD #4 Use -v to give a version sort, where instead of sorting by character, the le names are sorted by the way they are numbered, so that file-2 will come between file-1 and file-10, and not after the two les as it would in a normal character sort. This is useful for sorting les whose names are numbered in some way, such as by versions, indices, or date. To list all of the les in the current directory ending in .jpeg and sorted by version, type:
$ ls -v *.jpeg RET
METHOD #5 Use -r to reverse the order of the sorted output. This works with all other sort options. Here are some ways to use this. To list les in the current directory from highest ascii character value to lowest, type:
$ ls -r RET
To list all of the les in the /usr/bin directory sorted by their size, with smallest les rst, type:
$ ls -Sr /usr/bin RET
To list all of the les in the current directory sorted by modication date, with the most recently modied les last, type:
$ ls -tr RET
METHOD #6 Use the -U option to turn o all sorting and output les in unsorted orderthe order they appear on the disk. To output all les in the current directory in the order they appear on the disk, type:
$ ls -U RET
141
contents of a directory recursively, outputting a listing of that directory and the contents of all of its subdirectories. To output a recursive directory listing of the current directory, type:
$ ls -R RET play work play: notes work: notes $
In this example, the current working directory contains two subdirectories, work and play, and no other les. Each subdirectory contains a le called notes. To list all of the les on the system, type:
$ ls -R / RET
This command recursively lists the contents of the root directory, /, and all of its subdirectories. It is common to combine this with the attribute option, -l, to output a verbose listing of all the les on the system:
$ ls -lR / RET
NOTES: You cant list the contents of some directories on the system if you dont have permission to do so (see Recipe 6.3 [Controlling Access to Files], page 167).
142
This command creates a new le called neighbor-copy that is identical to my-copy in every respect except for its name, owner, group, and timestamp the new le has a timestamp that shows the time when it was copied. The le my-copy is not altered. Use the -v (verbose) option to list les as they are copied. This is useful for large copies, where a lot of les are being copied, so you can monitor the progress. To copy all the les in the ~/workgroup/final directory to the ~/workgroup/backup directory, specifying verbose output so each le is listed as it is copied, type:
$ cp -v ~/workgroup/final/* ~/workgroup/backup RET
This command copies the le my-copy to a new le called neighbor-copy that is identical to my-copy in every respect except for its name. While -p does not copy any subdirectories a directory may contain, you can use the -a (archive) option instead, which preserves attributes whenever possible but also copies any subdirectories as well as symbolic links (see Recipe 5.7 [Giving a File More than One Name], page 152). This is good for making archival backups of one directory tree to another. To make an archival copy of the contents of /cdrom to the current directory, type:
$ cp -a /cdrom . RET
This command makes a copy of /cdrom, including any subdirectories it may contain, to the current directory. Original le attributes are preserved in the copy. NOTES: A snapshot is a copy of a directory tree that shows what it looked like at a particular time. Snapshots are usually made in software development projects upon each releaseto take a snapshot of the current version means to make an archival copy of the directory tree containing the sources.
143
To make a snapshot of a directory tree, use cp with the -a option as just described.
The -R option does not copy les that are symbolic links (see Recipe 5.7 [Giving a File More Than One Name], page 152), and it does not retain all original permissions. To recursively copy a directory, including links, and retain all of its permissions, use the -a (archive) option. This is useful for making a backup copy of a large directory tree. To make an archive copy of the directory tree public_html to the directory private_html, type:
$ cp -a public_html private_html RET
144
~/photographs/01/ ~/photographs/01/640x480 ~/photographs/01/320x280 ~/photographs/01/src ~/photographs/02 ~/photographs/02/640x480 ~/photographs/02/320x280 ~/photographs/02/src ~/photographs/03 ~/photographs/03/640x480 ~/photographs/03/320x280 ~/photographs/03/src ... continued ...
Figure 5-6. Subdirectories with a unique parent. To copy all src directories to the /mnt directory, giving each of the les the unique name of their parent directory in ~/photographs, type:
$ > > > $ for i in ~/photographs/* RET { RET cp -a $i/src /mnt`basename $i` RET } RET
This command copies all of the src directories in ~/photographs, giving them the uniqe names of their parentsso that ~/photographs/01/src becomes /mnt/01, ~/photographs/02/src becomes /mnt/02, and so on. You can use the semicolon character (;) to run this all on one command line as a single command (see Recipe 3.1.7 [Running a List of Commands], page 63). The following command is equivalent to the preceding example:
for i in ~/photographs/*; { cp -a $i/src /mnt`basename $i`; }
NOTES: To rename les by this method, use mv instead of cp (see Recipe 5.5 [Moving Files and Directories], page 144).
145
This command moves the le notes in the current directory to play, a subdirectory of the current working directorys parent. If a le notes already exists in play, that le is overwritten. If the subdirectory play does not exist, this command moves the le notes from the current directory to its parent directory, renaming the le play. To move a le or directory that is not in the current directory, give its full path name as an argument. To move the le /usr/tmp/notes to the current working directory, type:
$ mv /usr/tmp/notes . RET
This command moves the le /usr/tmp/notes to the current working directory. To move a directory, give the path name of the directory you want to move and the path name to move it to as arguments. To move the directory work in the current working directory to play, type:
$ mv work play RET
This command moves the directory work in the current directory to the directory play. If the directory play already exists, mv puts work inside playit does not overwrite directories. Renaming a le is the same as moving it; just specify as arguments the le to rename followed by the new le name. To rename the le notes to notes.old, type:
$ mv notes notes.old RET
The following recipes describe other ways to move and rename les.
146
on. If a le already exists, rename will output a warning and will not rename the le, but other les will be renamed. To use rename to change uppercase letters in le names to lowercase, use tr/A-Z/a-z/ as the expression. To change the le names of all of the les in the current directory to lowercase letters, type:
$ rename 'tr/A-Z/a-z/' * RET
You can specify which les to work on, and you can specify that only certain parts of a lename are to be changed. Here are some ways to use this. To rename all of the les in the current directory ending with .MP3 to les of the same names in lowercase letters, type:
$ rename 'tr/A-Z/a-z/' *.MP3 RET
To rename all of the les in the current directory ending with .MP3 to les of the same names with extensions in lowercase letters, type:
$ rename 's/.MP3/.mp3/' *.MP3 RET
In the rst example, a le with a name like Music-Recording.MP3 or ANOTHER-MUSIC-RECORDING.MP3 would be renamed to musicrecording.mp3 and another-music-recording.mp3, while in the second example, these les would be renamed to Music-Recording.mp3 and ANOTHER-MUSIC-RECORDING.mp3. METHOD #2 To change the uppercase letters in a group of le names to lowercase, use mv with the -i option to move the les interactively, deriving lowercase le names by piping the old names through the tr lter (see Recipe 13.4 [Transposing Characters in Text], page 316). Loop through all the les in the rst extension, running this command line on each of them, with Bashs built-in for construct (see the bash Info documentation for more information on this built-in). To rename all of the les in the current directory to all lowercase letters, type:
$ > > > $ for i in * RET { RET mv -i $i `echo $i | tr '[A-Z]' '[a-z]'` RET } RET
147
You can use the semicolon character (;) to run this all on one command line as a single command. The following command is equivalent to the preceding example:
for i in *; { mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`; }
The -i option is used with mv because otherwise this command may inadvertently remove lesif, for example, you have les named CAT, Cat, and cat, this command without the -i will remove two of them. Furthermore, for les that are not aected by the transformation to lowercase (for example, a le named dog), this command will do nothing, and a message will be output indicating that the original le name and the new le name are the same. To lowercase all of the le names in the current directory that have a .JPG extension, type:
$ for i in *.JPG; { mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`; } RET
You can use tr to perform any number of transformations on a group of les, such as translating all lowercase letters to uppercase, or deleting certain characters. Here are some ways to use this. To uppercase all of the le names in the current directory that have a .jpg extension, type (all on one line):
$ for i in *.jpg; { mv -i $i `echo $i | tr '[a-z]' '[A-Z]'`; } RET
To rename all of the les in the current directory that have 386 somewhere in their names, and delete the 386 from the name, type:
$ for i in *386*; { mv -i $i `echo $i | tr -d '386'`; } RET
148
To rename all the les in the current directory ending in .JPG to les ending in .jpeg, type:
$ rename 's/.JPG/.jpeg/' *.JPG RET
METHOD #2 Use mv to move the les, deriving the new le names with the basename tool. Loop through all of the les, running this command line on each of them, with Bashs built-in for construct (see the bash Info documentation for more information on this built-in). To rename all the les in the current directory then end in .JPG to les that end end in .jpeg, type:
$ > > > $ for i in *.JPG RET { RET mv -i $i `basename $i JPG`jpeg RET } RET
You can use the semicolon character (;) to run these commands on one command line. The following command is equivalent to the previous example:
for i in *.JPG; { mv -i $i `basename $i JPG`jpeg; }
METHOD #3 To rename a group of les from one extension to another, use mv with a for loop, as with Method #2, but instead of using basename, specify the new extension with the Bash shell parameter expansion feature.3 To rename all of the .jpg les in the current directory, so that they all have a .jpeg le name extension instead, type:
$ > > > $ for i in .jpg RET { RET mv $i "${i%.jpg}.jpeg" RET } RET
3
For more information on this feature, consult the Info documentation for bash (see Recipe 2.8.5 [Reading an Info Manual], page 48).
149
To remove a directory and all of the les and subdirectories it contains, use the -R (recursive) option. To remove the directory waste and all of its contents, type:
$ rm -R waste RET
To remove an empty directory, use rmdir; it removes the empty directories you specify. If you specify a directory that contains les or subdirectories, rmdir reports an error. To remove the directory empty, type:
$ rmdir empty RET
TAB
150
METHOD #2 When a le name begins with a control character or other strange character, you can specify the le name with a le name pattern that uniquely identies it (see Recipe 5.8 [Specifying File Names with Patterns], page 153, for tips on building le name patterns). Use the -i option to verify the deletion rst. To delete the le ^Acat in a directory that also contains the les cat and dog, type:
$ rm -i ?cat RET rm: remove `^Acat'? y RET $
In the preceding example, the expansion pattern ?cat matches the le ^Acat and no other les in the directory. The -i option was used because, in some cases, no unique pattern can be made for a lefor example, if this directory also contained a le called 1cat, the preceding rm command in the example would also attempt to remove it; with the -i option, you can answer n to it. METHOD #3 The two previous methods wont work with a le that begins with a hyphen character, because rm interprets such a le name as an option; to remove a le like that, use the -- optionit species that what follows are arguments and not options. To remove the le -cat from the current directory, type:
$ rm -- -cat RET
151
In the preceding example, rm will prompt for conrmation before deleting any le in ~/tmp. You might consider making an alias word for rm with the -i option, such as del, and get in the habit of using this word in place of rm (see Recipe 3.6.1 [Calling a Command by Some Other Name], page 83). You can get the same eect as an alias by making the following two-line shell script, which you might write to a le called del and put in your personal bin directory (see Recipe A.3.4 [Installing a Shell Script], page 708, and Recipe C.1 [Using a Directory for Personal Binaries], page 727):
#!/bin/sh /bin/rm -i $*
NOTES: Question 3.6 in the unix faq4 discusses this issue and gives a shell script called can that you can use in place of rmit puts les in a trashcan directory instead of removing them; you then periodically empty out the trashcan with rm.
NOTES: This is a dangerous operation! This command will permanently remove all les and directories you give it, so be certain you want them removed before you run it!
4
152
153
This command makes a hard link from an existing le, seattle, to a new le, emerald-city. You can read and edit the emerald-city le just as you would seattle; any changes you make to emerald-city are also written to seattle (and vice versa). But if you remove the emerald-city le, the seattle le is not removed (and vice versa). METHOD #2 To create a symbolic link, use ln with the -s option. To create a symbolic link from seattle to emerald-city, type:
$ ln -s seattle emerald-city RET
This command makes a symbolic link from an existing le, seattle, to a new le, emerald-city. If you remove the le emerald-city, the le seattle will not be removed, but removing the seattle le, on the other hand, will make emerald-city a broken link until some other le named seattle exists in its place againat which point emerald-city will point to that new le. NOTES: This recipe might also be called Linking a File to Another.
154
The asterisk matches a series of zero or more characters, and is sometimes called the wildcard character. For example, * alone expands to all le names in the given directory, a* expands to all le names that consist of an a character followed by zero or more characters, and a*b expands to all le names that begin with an a character and end with a b character, with any (or no) characters in between. The question mark matches exactly one character. Therefore, ? alone expands to all le names with exactly one character, ?? expands to all le names with exactly two characters, and a? expands to all le names that begin with an a character and have exactly one character following it. Curly brackets group a comma-delimited set of strings, all of which are to be matched. So {a,b}c expands to ac and bc. Square brackets match one character in list. For example, [ab] matches exactly two le names: a and b. The pattern c[io] matches ci and co, but no other le names. The tilde character expands to your home directory (the value of the HOME variable; see Recipe 3.5 [Using Shell Variables], page 77). For example, if your username were mary and your home directory were therefore /home/mary, then ~ would expand to /home/mary. You can follow the tilde with a path to specify a le in your home directoryfor example, ~/work would expand to /home/mary/work.
{string1,string2,...}
[list]
155
Brackets also have special meaning when used in conjunction with other characters, as described in the following table. A hyphen as part of a bracketed list denotes a range of characters to matchso [a-m] matches any of the lowercase letters from a through m. To match a literal hyphen character, use it as the rst or last character in the list. For example, a[-b]c matches two les: a-c and abc. Put an exclamation point at the beginning of a bracketed list to match all characters except those listed. For example, a[!b]c matches all les that begin with an a character, end with a c character, and have any one character (except a b character) in between; it matches the les aac, a-c, adc, and so on.
You can combine these special expansion characters in any combination, and you can specify more than one pattern as multiple arguments. The following examples show le expansion in action, using commands described earlier in this chapter. To list all les in the /usr/bin directory that have the text tex anywhere in their name, type:
$ ls /usr/bin/*tex* RET
To copy all les whose names end with .txt, .text, .doc, or .info to the doc subdirectory, type:
$ cp *.txt,text,doc,info doc RET
To output a verbose listing of all les whose names end with a threecharacter extension, sorting the list so that newer les are listed rst, type:
$ ls -lt *.??? RET
To move all les in the /usr/tmp directory whose names consist of the text song followed by an integer from 0 to 9 and a .cdda extension, placing them in a directory music in your home directory, type:
$ mv /usr/tmp/song[0-9].cdda ~/music RET
156
To remove all les in the current working directory that begin with a hyphen and have the text out somewhere else in their le name, type:
$ rm -- -*out* RET
To concatenate all les whose names consist of an a character followed by two or more characters, type:
$ cat a??* RET
In the preceding example, a tree graph is drawn showing the current directory, which contains the two directories projects and trip; the projects directory in turn contains the directories current and old. To output a tree graph of a specic directory tree, give the name of that directory tree as an argument.
157
To output a tree graph of your home directory and all its subdirectories, type:
$ tree ~ RET
To output a graph of a directory tree containing directory names only, use the -d option. This is useful for outputting a directory tree of the entire system, or for getting a picture of a particular directory tree. Here are some ways to use this. To output a tree graph of the entire system to the le tree, type:
$ tree -d / > tree RET
NOTES: Another tool for outputting directory trees is described in Recipe 24.2 [Listing a Files Disk Usage], page 502.
158
When browsing a directory, mc gives two display windows, called directory panels. Use the mouse to access the pull-down menus on the top menu bar. The function keys provide help and other menus; they are listed at the very bottom of the screen. Above them is a Bash command line, which you can use just as you normally do in the shell. Type F10 to exit mc and return to the shell where you ran it. An illustration of what the Midnight Commander looks like when browsing the root directory of a typical system is given in Figure 5-7.
Figure 5-7. Browsing local les with the Midnight Commander. METHOD #2 Lynx DEB: lynx RPM: lynx WWW: http://lynx.browser.org/ You can view and peruse local les in a Web browser, such as the text-only browser lynx or the graphical Mozilla browser for X. The lynx tool is very good for browsing les on the systemgive the name of the directory to browse as an argument, and lynx will display a listing of available les and directories in that directory.
159
You can use the cursor keys to browse and press RET on a subdirectory to traverse to that directory.6 You can use lynx to display plain text les, compressed text les, and les written in html; its useful for browsing system documentation in the /usr/doc and /usr/share/doc directories, where many software packages come with help les and manuals written in html. Use the -localhost option to disable any urls that point to remote hosts. Here are two ways to use this. To browse the system documentation les in the /usr/doc directory, disabling all links to other hosts, type:
$ lynx -localhost /usr/doc RET
An illustration of what Lynx looks like when browsing the root directory of a typical system is given in Figure 5-8.
Figure 5-8. Browsing local les with Lynx. NOTES: See Recipe 33.2 [Using Lynx], page 643, for more about using Lynx.
In X, you can also use the mouse; see Recipe 33.2.8 [Using Lynx with a Mouse], page 648.
160
METHOD #3
Mozilla DEB: mozilla-browser RPM: mozilla WWW: http://www.mozilla.org/ Use Mozilla to browse les much as with Lynx as described in Method #2, giving a full path name as an argument. To browse the system documentation les in the /usr/share/doc directory in Mozilla, type the following in Mozillas Location window, or give it as an argument to mozilla:
/usr/share/doc
An illustration of what Mozilla looks like when browsing the root directory of a typical system is given in Figure 5-9.
161
NOTES: Other Web browsers work in this way, too. For other recommended browsers to use, see the table in Recipe 33.11 [Using Other Web Browsers], page 667.
162
163
6. Sharing Files
Groups, le ownership, and access permissions are Linux features that enable users to share les with one another. But this topic is important to know even if you dont plan on ever sharing les with other users on the system; these are concepts that will help you understand how le access and security work in Linux, and enable you to control the way a le may be accessed. By changing the access permissions to les, les can be placed into a state so that they cant be modied, copied, or even viewed by certain usersincluding you!
This is the default on some systems, including the Debian distribution, but is not standard across all distributions; in such matters, this chapter will assume the Debian behavior.
164
This command uses the cat tool to output the entire contents of the le (see Recipe 9.2 [Displaying Text], page 216), listing all elds. Use cut to output only certain elds (see Recipe 13.7.4 [Removing Columns from Text], page 324). To output a list of all group names on the system, type:
$ cut -d : -f1 /etc/group RET
NOTES: For more information about the user group le, consult the group man page.
In this example, three groups are output: steward (the users login group), galley, and crew. To list the group memberships of user marlow, type:
$ groups marlow RET marlow : marlow $
In this example, the command outputs the given username, marlow, followed by the name of one group, marlow, indicating that user marlow belongs to only one group: his login group.
165
In this example, three usernames are output, indicating that these three users are the members of the galley group. NOTES: The members tool is not yet widely available outside of the Debian distribution; if you cant locate a copy, you can always install the sources from the Debian package (see Recipe 1.1.2 [Preparation of Recipes], page 3). METHOD #2 On systems without members conveniently installed, the members of a particular group may be listed by using grep in conjunction with cut. First, use grep to output the line in /etc/group whose rst eld matches the particular group name, and pipe the output to cut to output only the last eld, containing the list of users who belong to that group. To list all members of the crew group, type:
$ grep ^crew: /etc/group | cut -d : -f 4 RET
NOTES: For more information on grep and cut, see Recipe 14.1 [Searching Text for a Word], page 333 and Recipe 13.7.4 [Removing Columns from Text], page 324, respectively.
166
The user who owns this le is captain, and the group that owns it is crew. NOTES: When you create a le, it normally belongs to you and to your login group, but you can change its ownership, as described in the next recipe. You normally own all of the les in your home directory.
This command transfers group ownership of cruise to bridge; the les group access permissions (as shown in the following recipe) now apply to the members of the bridge group. Use the -R option to recursively change the group ownership of directories and all of their contents.
167
To give group ownership of the maps directory and all the les it contains to the bridge group, type:
$ chgrp -R bridge maps RET
168
NOTES: The superuser, root, can always access any le on the system, regardless of its access permissions. For more information on le permissions and access modes, see the fileutils Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
The rst character (-) is the le type; the next three characters (rwx) specify permissions for the user who owns the le; and the next three (rw-) specify permissions for all members of the group that owns the le except for the user who owns it. The last three characters in the column (r--) specify permissions for all other users on the system. All three permissions sections have the same format, indicating, from left to right, read, write, and execute permission with r, w, and x characters. A hyphen (-) in place of one of these letters indicates that permission is not given. In this example, the listing indicates that the user who owns the le, captain, has read, write, and execute permission, and the group that owns the le, crew, has read and write permission. All other users on the system have only read permission.
169
All users on the system; this is the same as ugo. Follow this with the operator denoting the action to take:
+ =
Add permissions to the users existing permissions. Remove permissions from the users existing permissions. Make these the only permissions the user has for this le. Finally, specify the permissions themselves with a special character:
r w x
For example, use u+w to add write permission to the existing permissions for the user who owns the le, and use a+rw to add both read and write permissions to the existing permissions of all users. (You could also use ugo+rw instead of a+rw.)
170
NOTES: Often, shell scripts that you obtain or write yourself do not have execute permission set, and youll have to do this yourself.
171
7. Finding Files
Sometimes you may want to locate les on the system that match given criteria, such as a particular name or le size. This chapter will show you how to nd a le when you know only part of the le name, and how to nd a le whose name matches a given pattern. You will also learn how to list les and directories by size and how to nd the locations of commands. These are not searches for matching the contents of les. That kind of activity is described in Chapter 14 [Searching Text], page 333. A method of searching the contents of les you nd is given in Recipe 7.2.7 [Running Commands on the Files You Find], page 178. For more information on nding les, consult the find Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
To nd all the les on the system whose le names end with a .c extension, type:
$ locate *.c RET
Sometimes, a locate search will generate a lot of output. Pipe the output to less to peruse it (see Recipe 9.1 [Perusing Text], page 211). To peruse a list of all .cfg les on the system, type:
$ locate .cfg | less RET
172
NOTES: Searches are case-sensitive. Thus, a search for *history* will match ~/.bash_history and /usr/local/history_data/README, but not ~/History_of_a_nation.
This command will search all directories on the system to which you have access; if you dont have execute permission for a directory, find will report that permission is denied to search the directory. The -name option is case-sensitive; use the similar -iname option to nd a name regardless of case. To list all les on the system whose le name is top, regardless of case, type:
$ find / -iname top RET
This command would match any les whose name consisted of the letters top, regardless of caseincluding Top, top, and TOP.
173
Use le expansion characters (see Recipe 5.8 [Specifying File Names with Patterns], page 153) to nd les whose names match a pattern. Give these le name patterns between single quotes. Here are some ways to use this. To list all les on the system whose names begin with the characters top, type:
$ find / -name 'top*' RET
To list all les whose names begin with the three characters top followed by exactly three more characters, type:
$ find / -name 'top???' RET
To list all les whose names begin with the three characters top followed by ve or more characters, type:
$ find / -name 'top?????*' RET
To list all les in your home directory tree that end in .tex, regardless of case, type:
$ find ~ -iname '*.tex' RET
To list all les in the /usr/share directory tree that end with .jpg or .jpeg, regardless of case, type:1
$ find /usr/share -iname '*.jp*g' RET
To list all les in the /usr/share directory tree with the text farm somewhere in their name, type:
$ find /usr/share -name '*farm*' RET
Use -regex in place of -name to search for les whose full or relative path names match a regular expression, a pattern describing a set of strings (see Recipe 14.3 [Matching Patterns of Text], page 335). Here are two ways to use this. To list all les in the current directory tree whose relative path names have either the string net or comm anywhere in them, type:
$ find . -regex '.*\(net\|comm\).*' RET
To list all les in the /usr/share directory tree that end only with .jpg or .jpeg, regardless of case, type:
$ find /usr/share -iregex '.*\.\(jpg\|jpeg\)' RET
1
This pattern also matches les that contain any other character or characters in place of the efor example, .jpog or .jp123g. To match les ending only with .jpg or .jpeg, use the -regex or -iregex search that is described next.
174
The -regex option matches the whole path name, relative to the directory tree you specify, and not just le names; for this reason, the regexps in the previous examples began with .*, so that characters making up the path were matched rst. To only match le names in a search for a word or phrase, exclude the forward slash character (/) after the string youre searching for, and exclude directory names with \! -type d (see Recipe 7.4.5 [Finding the Number of Files in a Listing], page 184). To list all les in the current directory tree whose names have either the string net or comm anywhere in their le names, type:
$ find . -regex '.*\(net\|comm\).[^/]*' \! -type d RET
To list all les in your home directory tree less than 300 bytes in size, type:
$ find ~ -size -300b RET
To list all les on the system whose size is exactly 42 512-byte blocks, type:
$ find / -size 42 RET
Use the -empty option to nd empty lesles whose size is 0 bytes. This is useful for nding les that you might not need, and can remove. To nd all empty les in your home directory tree, type:
$ find ~ -empty RET
NOTES: To nd the largest or smallest les in a given directory, output a sorted listing of that directory (see Recipe 7.4 [Finding Files in Directory Listings], page 182).
175
-amin species the number of minutes ago that the le was accessed; you can also nd les that were accessed more recently than the le name given as an argument to -anewer was modied. Finally, -atime species the number of 24-hour periods ago when the le was last accessed. Here are some ways to use this. To nd all les in your home directory tree that were last accessed one hour ago, type:
$ find ~ -amin 60 RET
To nd all les in your home directory tree that were last accessed within the past sixty minutes, type:
$ find ~ -amin -60 RET
To nd all les in the /usr/share directory tree that were last accessed twenty-four hours ago, type:
$ find /usr/share -atime 1 RET
To nd all les in the /usr/share directory tree that were last accessed more recently than the le ~/template was modied, type:
$ find /usr/share -anewer ~/template RET
Include the -daystart option to measure time from the beginning of the current day, instead of 24 hours ago. This option must precede the time expression it works on. To nd all les in the /usr/share directory tree that were last accessed two days ago, type:
$ find /usr/share -daystart -atime 2 RET
176
To nd all the les on the system whose status has changed more recently than the le /etc/inittab was modied, type:
$ find / -cnewer /etc/inittab RET
To nd all les in the current directory tree whose status last changed exactly twenty-four hours ago, type:
$ find . -ctime 1 RET
To nd all les in the current directory tree whose status has changed within the last twenty-four hours, type:
$ find . -ctime -1 RET
Include the -daystart option to measure time from the beginning of the current day, instead of 24 hours ago. This option must precede the time expression it works on. To nd all les in the current directory tree whose status last changed a week ago, type:
$ find . -daystart -ctime 7 RET
To list the les in the /usr/local directory tree that were modied exactly 24 hours ago, type:
$ find /usr/local -mtime 1 RET
To list the les in the /usr directory tree that were modied exactly ve minutes ago, type:
$ find /usr -mmin 5 RET
To list the les in the /usr/local directory tree that were modied within the past 24 hours, type:
$ find /usr/local -mtime -1 RET
177
To list the les in the /usr directory tree that were modied within the past ve minutes, type:
$ find /usr -mmin -5 RET
Include the -daystart option to measure time from the beginning of the current day, instead of 24 hours ago. This option must precede the time expression it works on. Here are some ways to use this. To list all of the les in your home directory tree that were modied yesterday, type:
$ find ~ -daystart -mtime 1 RET
To list all of the les in the /usr directory tree that were modied one year or longer ago, type:
$ find /usr -daystart -mtime +365 RET
To list all of the les in your home directory tree that were modied from two to four days ago, type:
$ find ~ -daystart -daystart -mtime +2 -mtime -4 RET
In the preceding example, the combined options -mtime +2 and -mtime -4, each prefaced by the -daystart option, matched les that were modied between two and four days ago. To nd les newer than a given le, give the name of that le as an argument to the -newer option. To nd les in the /etc directory tree that are newer than the le /etc/motd, type:
$ find /etc -newer /etc/motd RET
To nd les newer than a given date, use the trick described in the find Info documentation: Create a temporary le in /tmp with touch whose timestamp is set to the date you want to search for, and then specify that temporary le as the argument to -newer. To list all les in your home directory tree that were modied after May 4 of the current year, type:
$ touch -t 05040000 /tmp/timestamp RET $ find ~ -newer /tmp/timestamp RET
In this example, a temporary le called /tmp/timestamp is written; after the search, you can remove it (see Recipe 5.6 [Removing Files and Directories], page 149).
178
NOTES: You can also nd les that were last accessed a number of days after they were modied by giving that number as an argument to the -used option. This is useful for nding les that get little useles matching -used +100, say, were accessed 100 or more days after they were last modied.
The -group option is similar, but it matches group ownership instead of user ownership. To list all les in the /dev directory tree owned by the audio group, type:
$ find /dev -group audio RET
In this example, the command grep organic le is executed for each le that find nds, with le being the name of each le in turn. To have find pause and conrm execution for each le it nds, use -ok instead of -exec. To remove les from your home directory tree that were accessed more than one year after they were last modied, pausing to conrm before each removal, type:
$ find ~ -used +365 -ok rm '{}' ';' RET
179
To compress all the les in your home directory tree that are two megabytes or larger, and that are not already compressed with gzip (having a .gz le name extension), type (all on one line):
$ find ~ -size +2000000c -regex '.*[^gz]' -exec gzip '{}' ';' RET
As all options are combinable, you can use multiple calls of the same option. So you can combine several of the same time options to get a range of times, for instance. To nd all les in your home directory whose contents were modied today, but at least 120 minutes ago, type:
$ find ~ -daystart -mtime 0 -mmin +120 RET
Use the special -o option (the or operator), to separate two options when either of them are to be matched. For example, you can use it with multiple -name options to nd dierent le names in the same directory tree. To nd all les ending in .ps, .pdf, or .dvi in the current directory tree, type (all on one line):
$ find . -name '*.ps' -o -name '*.pdf' -o -name '*.dvi' RET
The following tables describe some of the many options you can use with find. The rst table lists and describes finds general options for specifying its behavior. -daystart -depth -maxdepth levels -mount or -xdev Use the beginning of today rather than 24 hours previous for time criteria. Search the subdirectories before each directory. Species the maximum number of directory levels to descend in the specied directory tree. Do not descend directories that have another disk mounted on them.
180
The following table lists and describes finds options for specifying which les to nd. Specify the numeric arguments to these options in one of three ways: preceded by a plus sign (+) to match values equal to or greater than the given argument; preceded by a hyphen or minus sign (-) to match values equal to or less than the given argument; or list the number alone to match exactly that value. -amin minutes -anewer le -atime days -cmin minutes -cnewer le -ctime days -empty -group group -iname pattern Time in minutes since the le was last accessed. File was accessed more recently than le. Time in days since the le was last accessed. Time in minutes since the le was last changed. File was changed more recently than le. Days since the le was last changed. File is empty. Name of the group that owns le. Case-insensitive le name pattern to match (report matches the les Report, report, REPORT, etc.). Full path name of le matches the pattern pattern, regardless of case (./r*rt matches ./records/report and ./Record-Labels/ART. Path name of le, relative to specied directory tree, matches the regular expression regexp, regardless of case (t?p matches TIP and top). Number of links to the le (see Recipe 5.7 [Giving a File More Than One Name], page 152). Number of minutes since the les data was last changed. Number of days since the les data was last changed. Base name of the le matches the pattern pattern.
-ipath pattern
-iregex regexp
181
-newer le -path pattern -perm access mode -regex regexp -size size -type type -user user
File was modied more recently than le. Full path name of le matches the pattern pattern (./r*rt matches ./records/report). Files permissions are exactly access mode (see Recipe 6.3 [Controlling Access to Files], page 167). Path name of le, relative to specied directory tree, matches the regular expression regexp. File uses size space, in 512-byte blocks. Append size with b for bytes or k for kilobytes. File is type type, where type can be d for directory, f for regular le, or l for symbolic link. File is owned by user.
The following table lists and describes finds options for specifying what to do with the les it nds. -exec commands Species commands, separated by semicolons, to be executed on matching les. To specify the current le name as an argument to a command, use '{}'. Like -exec, but prompts for conrmation before executing commands. Outputs the name of found les to the standard output, each followed by a newline character so that each is displayed on a line of its own (the default). Use C-style output (the same as used by the printf function in the C programming language), as specied by string format.
-printf format
The following table describes the variables that may be used in the format string used by the -printf option. \a \b \f Rings the system bell (called the alarm on older systems). Outputs a backspace character. Outputs a formfeed character.
182
\n \r \t \\ %% %b %f %h %k %s
Outputs a newline character. Outputs a carriage return. Outputs a horizontal tab character. Outputs a backslash character. Outputs a percent sign character. Outputs les size, rounded up in 512-byte blocks. Outputs base le name. Outputs the leading directories of les name. Outputs les size, rounded up in 1 k blocks. Outputs les size in bytes.
To nd all of the directories in your home directory tree with the string audio anywhere in their names, type:
$ find ~ -name *audio* -type d RET
183
outputs les sorted alphabetically). Include the -l option to output the size and other le attributes. To list the les in the current directory, with their attributes, sorted with the largest les rst, type:
$ ls -lS RET
NOTES: Pipe the output to less to peruse it (see Recipe 9.1 [Perusing Text], page 211).
To output a list of the subdirectories in the /usr/local directory tree, sorted in descending order by size, type:
$ du -S /usr/local | sort -nr RET
184
In this example, the command outputs the numeral 19, indicating that there are 19 les in the current directory. Since ls does not list hidden les by default (see Recipe 5.3.4 [Listing Hidden Files], page 138), the preceding command does not count them. Use lss -A option to count dot les as well. To count the number of lesincluding dot lesin the current directory, type:
$ ls -A | wc -l RET 81 $
This command outputs the numeral 81, indicating that there are 81 les, including hidden les, in the current directory. To list the number of les in a given directory tree, and not just a single directory, use find instead of ls, giving the special find predicate \! -type d to exclude the listing (and therefore, the counting) of directories. Here are some ways to use this. To list the number of les in the /usr/share directory tree, type:
$ find /usr/share \! -type d | wc -l RET
To list the number of les and directories in the /usr/share directory tree, type:
$ find /usr/share | wc -l RET
185
In this example, which output /usr/bin/perl, indicating that the perl binary is installed in the /usr/bin directory. NOTES: This is also useful for determining which binary would execute, should you type the name, because some systems may have dierent binaries of the same le name located in dierent directories. In that case, you can use which to nd which one would execute.
186
187
8. Managing Files
File management tools include those for splitting, comparing, and compressing les, making backup archives, and tracking le revisions. Other management tools exist for determining the contents of a le, and for changing its timestamp.
This command reports that the le /usr/doc/HOWTO/README.gz contains data that has been compressed with the gzip tool. To determine the original format of the data in a compressed le, use the -z option.
188
To determine the format of the compressed data contained in the le /usr/doc/HOWTO/README.gz, type:
$ file -z /usr/doc/HOWTO/README.gz RET /usr/doc/HOWTO/README.gz: English text (gzip compressed data, deflated, original filename, last modified: Sun Apr 26 02:51:48 1998, os: Unix) $
This command reports that the data in /usr/doc/HOWTO/README.gz, a compressed le, is English text. NOTES: Currently, file dierentiates among more than one hundred dierent data formats, including several human languages, many sound and graphics formats, and executable les for many dierent operating systems. For more information on le formats, see Appendix B [Conventional File Name Extensions], page 723.
189
To specify a timestamp other than the current system time, use the -d option, followed by the date and time that should be used enclosed in quote characters. You can specify just the date, just the time, or both. Here are some ways to use this. To change the timestamp of le pizzicato to May 17, 1990 at 2:16 p.m., type:
$ touch -d '17 May 1990 14:16' pizzicato RET
To change the timestamp of le pizzicato to May 17th of the current year, type:
$ touch -d '17 May' pizzicato RET
To change the timestamp of le pizzicato to 2:16 p.m. of the current day, type:
$ touch -d 14:16 pizzicato RET
NOTES: When only the time is given, the date is set to the current date, and when only the date is given, the time is set to 0:00. When just a year is given, the current day and month is used, and when a day and month but no year is given, the current year is used. For more information on date input formats, consult the Info documentation for date (see Recipe 2.8.5 [Reading an Info Manual], page 48).
190
mpeg2, level 3 (mp3) format. Your le, large.mp3, is 4,394,422 bytes in size, and you want to transfer it from your desktop to your laptop, but your laptop and desktop are not connected on a networkthe only way to transfer les between them is by oppy disk. Because this le is much too large to t on one oppy, you use split.1 The split tool copies a le, chopping up the copy into separate les of a specied size. It takes as optional arguments the name of the input le (using standard input if none is given) and the le name prex to use when writing the output les (using x if none is given). The output les names will consist of the le prex followed by a group of letters: aa, ab, ac, and so onthe default output le names would be xaa, xab, and so on. Specify the number of lines to put in each output le with the -l option, or use the -b option to specify the number of bytes to put in each output le. To specify the output les sizes in kilobytes or megabytes, use the -b option and append k or m, respectively, to the value you supply. If neither -l nor -b is used, split defaults to using 1,000 lines per output le. To split large.mp3 into separate les of one megabyte each, whose names begin with large.mp3., type:
$ split -b1m large.mp3 large.mp3. RET
This command creates ve new les whose names begin with: large.mp3. The rst four les are one megabyte in size, while the last le is 200,118 bytesthe remaining portion of the original le. No alteration is made to large.mp3. You could then copy these ve les onto four oppies (the last le ts on a oppy with one of the larger les), copy them all to your laptop, and then reconstruct the original le with cat (see Recipe 10.6 [Concatenating Text], page 256). To reconstruct the original le from the split les, type:
$ cat large.mp3.* > large.mp3 RET $ rm large.mp3.* RET
In this example, the rm tool is used to delete all of the split les after the original le has been reconstructed.
1
Another method for splitting les is to use gnu shar, the shell archiver, which bundles les into archives made especially for transmission by email. It can split and compress les as it archives them.
191
192
To compare two directories with mc, do the following: 1. Use the cursor keys to select the rst directory to compare in the current column. 2. Type
TAB
3. Use the cursor keys to select the second directory. 4. Type CTRL - X d to compare the two selected directories, and select which method to use from the pop-up menu. The number of bytes that dier, in the total number of diering les, is displayed at the bottom of the rst column; the number of bytes in the number of les that are the same in both directories is displayed at the bottom of the second column. METHOD #2 The second method is to use cmp on all les in each of the directories. Loop through all of the les, running this command on each of them, using the Bash built-in for construct (see the bash Info documentation for more information on this built-in). To compare all of the les in the directory ~/site/current with all of the les in the directory ~/development/latest, type:
$ for i in ~/site/current/*; { cmp $i ~/development/latest/$i; }
NOTES: This cmp method only works on directories that contain regular les; if the directories contain subdirectories, this method will fail.
193
To compare the les manuscript.old and manuscript.new, writing the dierence report to a le named manuscript.diff, type:
$ diff manuscript.old manuscript.new > manuscript.diff RET
The dierence report is meant to be used with commands such as patch, in order to apply the dierences to a le. For more information on diff and the format of its output, consult its Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48). To better see the dierence between two les, use sdiff instead of diff; instead of giving a dierence report, it outputs the les in two columns, side by side, separated by spaces. Lines that dier in the les are separated by a pipe character (|); lines that appear only in the rst le are ended with a less-than sign (<), and lines that appear only in the second le are preceded with a greater-than sign (>). To peruse the les laurel and hardy side by side on the screen, with any dierences indicated between columns, type:
$ sdiff laurel hardy | less RET
To output the dierence between three separate les, use diff3. To output a dierence report for les larry, curly, and moe, and output it in a le called stooges, type:
$ diff3 larry curly moe > stooges RET
In this example, the dierences between each le in one directory and its counterpart in the other directory are displayed in turn; press N to move to the next le, and P to move to the previous one.
194
To make a patch to change the ~/apples directory tree to match the ~/oranges directory tree, specifying all les in ~/apples and its subdirectories to be changed to their equivalents in the ~/oranges tree, and writing the patch to a le in the current directory called fruit-patch.diff in unied format, type:
$ diff -r -u -N apples oranges > fruit-patch.diff RET
To apply one of these patches, use patch with the -p1 option, which eliminates leading slashes in lenames. Put the patch le in the directory you want to patch, and run the patch tool from that directory. Use the -s option to work silently, omitting any output to the standard output. To silently apply the patch le fruit-patch.diff to the ~/apples directory, type:
$ mv fruit-patch.diff ~/apples RET $ cd ~/apples RET $ patch -p1 -s < fruit-patch.diff RET
195
To forgo the default annotations and instead make annotations good for sending to a printer, use the -p option; deleted text is underlined and inserted text is output in bold. Here are two ways to use this. To print an annotated copy of the le story_draft.1, showing the changes necessary to make it identical to the le story_draft.2, type:
$ wdiff -p story_draft.2 story_draft.1 | lpr RET
To peruse an annotated copy of the le story_draft.1, showing the changes necessary to make it identical to the le story_draft.2 with underlining and bold lettering, type:
$ wdiff -p story_draft.2 story_draft.1 | less RET
Use wdiff with the -s option to display a number of statistics about the dierences: the total number of words; the number of common words and the percentage relative to the total; the number of words deleted or inserted, and the percentage relative to the total; and the number of words changed, and the percentage relative to the total. These statistics are output as two lines at the end, after an annotation of the second le is output.
196
Here are two ways to use this. To output the dierences in words between les story_draft.1 and story_draft.2, showing statistics about the dierences, type:
$ wdiff -s story_draft.1 story_draft.2 RET
To output the two lines of statistics about the dierences in words between les story_draft.1 and story_draft.2, type:
$ wdiff -s story_draft.1 story_draft.2 | tail -2 RET
NOTES: The wdiff command is not included with all Linux distributions.
197
This command compresses the le codewar-and-peace, putting it in a new le named war-and-peace.gz; gzip then deletes the original le, war-andpeace. NOTES: The amount of compression to use can be specied by giving a number in the range from 1 to 9 as an option, with 1 being minimal compression with the fastest compressing speed, and 9 being the best possible compression, at the expense of taking the most amount of time to compress. The default behavior is set to use a value of 6. Specifying the ratio used is not necessary during uncompression; les uncompress at the same speed regardless of the datas compression ratio. Special options -fast and -best are synonymous with -1 and -9, respectively. METHOD #2 Bzip2 DEB: bzip2 RPM: bzip2 WWW: http://sources.redhat.com/bzip2/ Use the bzip2 tool, giving as arguments the names of any les to compress; it writes compressed versions of the specied les, appends a .bz2 extension to their le names, and then deletes the original les. To compress the le war-and-peace, type:
$ bzip2 war-and-peace RET
This command compresses the le war-and-peace, putting it in a new le named war-and-peace.bz2; the original le, war-and-peace, is then deleted.
198
This command expands the le war-and-peace.gz and puts it in a new le called war-and-peace; gunzip then deletes the compressed le, war-andpeace.gz. NOTES: When uncompressing with gunzip, it is not necessary to specify the .gz extension. You can also view the contents of a le compressed with gzip without uncompressing it rst. This is useful when you want to view a compressed le but do not want to write changes to it, and therefore do not need to compress it. Do this either with zless, for gzip-compressed text les (see Recipe 9.1 [Perusing Text], page 211), or with see, which displays text and other les that have been compressed with either gzip or bzip2 style compression (see the following recipe). METHOD #2 Bzip2 DEB: bzip2 RPM: bzip2 WWW: http://sources.redhat.com/bzip2/ To access the contents of a le compressed with bzip2, use bunzip2 to uncompress it.
199
As with bzip2, bunzip2 takes as an argument the name of the le or les to work on. It expands the specied les, writing the output to new les without the .bz2 extension, and then it deletes the compressed les. To expand the le war-and-peace.bz2, type:
$ bunzip2 war-and-peace.bz2 RET
This command expands the le war-and-peace.bz2 and puts it in a new le called war-and-peace; bunzip2 then deletes the compressed le, warand-peace.bz2.
NOTES: see will not work for compressed images; to view their contents without uncompressing them, use display. It can view compressed image le formats (see Recipe 17.1 [Viewing an Image in X], page 407). The see command is not commonly included with some Linux distributions. You can install a copy from the sources on its Debian package page (see Recipe A.4 [Managing deb Packages], page 709).
200
in the previous section, and the les in the archive retain the structure and permissions of the original les. Use the tar tool to create, list, and extract les from archives.2 Archives made with tar are sometimes called tar les, tar archives, orbecause all the archived les are rolled into one big letarballs. The following recipes show how to use tar to create an archive, list the contents of an archive, and extract the les from an archive. Two common options used with all three of these operations are -f and -v: to specify the name of the archive le, use -f followed by the le name, and use the -v (verbose) option to have tar output the names of les as they are processed. While the -v option is not necessary, it lets you observe the progress of your tar operation. NOTES: The name of this tool comes from tape archive, because it was originally made to write the archives directly to a magnetic tape device. It is still used for this purpose, but today, archives are almost always saved to a le on disk. For more information about managing archives with tar, consult its Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
This command creates an archive le called project.tar containing the project directory and all of its contents. The original project directory remains unchanged. Use the -z option to compress the archive as it is being written. This yields the same output as creating an uncompressed archive and then using gzip to compress it, but it eliminates the extra step.
2
zip archives, popular on other operating systems, are discussed in Recipe 26.7 [Managing zip Archives], page 533.
201
To create a compressed archive called project.tar.gz from the contents of the project directory, type:
$ tar -zcvf project.tar.gz project RET
This command creates a compressed archive le, project.tar.gz, containing the project directory and all of its contents. The original project directory remains unchanged. NOTES: When you use the -z option, you should specify the archive name with a .tar.gz extension and not a .tar extension, so the le name shows that the archive is compressed. This is not a requirement, but it serves as a reminder and is the standard practice.
This command lists the contents of the project.tar archive. Using the code-v option along with the -t option causes tar to output the permissions and modication time of each le, along with its le namethe same format used by the ls command with the -l option (see Recipe 5.3.3 [Listing File Attributes], page 136). Include the -z option to list the contents of a compressed archive. To list the contents of a compressed archive called project.tar.gz, type:
$ tar -ztvf project.tar.gz RET
This command extracts the contents of the project.tar archive into the current directory. If an archive is compressed, which usually means it will have a .tar.gz or .tgz extension, include the -z option.
202
NOTES: If there are les or subdirectories in the current directory with the same name as any of those in the archive, those les will be overwritten when the archive is extracted. If you dont know what les are included in an archive, consider listing the contents of the archive rst as shown in the preceding recipe. Another reason to list the contents of an archive before extracting them is to determine whether the les in the archive are contained in a directory. If not, and the current directory contains many unrelated les, you might confuse them with the les extracted from the archive. To extract the les into a directory of their own, make a new directory, move the archive to that directory, and change to that directory, where you can then extract the les from the archive.
203
popular for managing free software projects on the Internet. For information on using cvs, consult its Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
Figure 8-1. First revision of novel. To check in the le novel with rcs, type:
$ ci novel RET novel,v <-- novel enter description, terminated with single '.' or end of file: NOTE: This is NOT the log message! >> The Great American Novel. RET >> . RET $
This command deposits the le in an rcs repository le called novel,v, and the original le, novel, is removed. To edit or access the le again, you must check out a revision of the le from rcs to work on (see the next recipe for how to do this). Whenever you have a new revision that you want to save, use ci again to check in the le. This begins the process all over again.
204
For example, suppose you have checked out the rst revision of novel and changed the le so that it now looks like Figure 8-2.
This is a very long tale about a great many things, including my long voyage across America, and back home again.
Figure 8-2. A new revision of novel. To deposit this revision in rcs, type:
$ ci novel RET novel,v <-- novel new revision: 1.2; previous revision: 1.1 enter log message, terminated with single '.' or end of file: >> Second draft. RET >> . RET $
If you create a subdirectory called RCS (in all uppercase letters) in the current directory, rcs recognizes this specially named directory instead of the current directory as the place to store the ,v revision les. This helps reduce clutter in your work directory. If the le you are depositing is a text le, you can have rcs insert a line of text in the le, every time the le is checked out, containing the name of the le, the revision number, the date and time in utc (Coordinated Universal Time), and the user id of the author. To do this, put the text $Id$ at a place in the le where you want this text to be written. You only need to do this once; each time you check the le out, rcs replaces this string in the le with the header text. For example, this chapter was written to a le, managing-files.texinfo, whose revisions were tracked with rcs; the $Id$ string in this le currently reads:
$Id: managing-files.texinfo,v 2.11 2004/07/03 18:54:01 m Exp m $
NOTES: You should always make your log message descriptive enough so that later, you wont be confused about what you had done to the le.
205
To check out the latest revision of a le that you intend to edit (and to check in later as a new revision), use the -l (for lock) option. Locking a revision in this fashion prevents overlapping changes from being made to the le, should another revision be accidentally checked out before this revision is checked in. To check out the latest revision of the le novel for editing, type:
$ co -l novel RET
This command checks out the latest revision of le novel from the novel,v repository, writing it to a le called novel in the current directory. (If a le with that name already exists in the current directory, co asks whether or not to overwrite the le.) You can make changes to this le and then check it in as a new revision (see the previous recipe). You can also check out a version of a le as read only, where changes cannot be written to it. Do this to check out a version to view only and not to edit. To check out the current version of a le for examination, type co followed by the name of the le. To check out the current revision of le novel, but not permit changes to it, type:
$ co novel RET
This command checks out the latest revision of the le novel from the rcs repository novel,v (either from the current directory or in a subdirectory named RCS). To check out a version other than the most recent version, specify the version number to check out with the -r option. Again, use the -l option to allow the revision to be edited. To check out revision 1.14 of le novel, type:
$ co -l -r1.14 novel RET
NOTES: Before checking out an old revision of a le, remember to check in the latest changes rst, or they may be lost. It is possible to make branching revisions; otherwise, your old revisions with changes will be checked in as the newest revision on the main branch (see the rcs man page for more information on branching in rcs).
206
This command outputs the revision log for the le novel; it lists information about the rcs repository, including its name (novel,v) and the name of the actual le (novel). It also shows that there are two revisionsthe rst, which was checked in to rcs on 20 June 1991, and the second, which was checked in to RCS the next day, on 21 June 1991.
207
If a le is unchanged, ci normally reverts to the last revision; to force a check in, useful for when you want to give a particular revision number to a group of les when some may be unchanged, use the -f option. You can use the Bash for directive so that you can check in all of the les at once, and not have to do them individually. Use the -m option to specify a common message to all of themgive the quoted log message as an argument, and again make sure there is no space between the option and the argument. To check in all of the .html les in the current directory at once, giving each le a log message of Updated for new product release and a revision number of 3.0, even if the le is unchanged, and then checking out and locking the latest version, type:
$ for i in *.html RET > { RET > ci -f -r3.0 -m"Updated for new product release" $i RET > co -l $i RET > } ... log messages ... $
You could give the command in the preceding example on one long line, like so:
for i in *.html; { ci -f -r3.0 -m"Updated for new product release" $i; co -l $i; }
208
III. TEXT
209
III. TEXT
210
211
9. Viewing Text
Dealing with textual matter is the meat of Linux (and of most computing), so there are going to be many chapters about the various aspects of text. This rst chapter in this part of the book shows how to view text on your display screen. Text les come in any number of formats, from formatted text in some particular languagesuch as English or the c programming languageto saved email messages or html les. Plain text les dont have to have a .txt or .text le name extension, although they often do (see Appendix B [Conventional File Name Extensions], page 723). If you are not sure whether the content of a le is text or not, use file to nd out, as described in Recipe 8.1.1 [Determining a Files Type and Format], page 187. A tool that just allows you to view text on the screen, but not edit it, is called a pager. When most people view text without editing it, they use less, which is described in the following recipes. There are many ways to view or otherwise output text. For example, you can view text as you browse les and their contents, as described in Recipe 5.10 [Browsing Files and Directories], page 157. When your intention is to edit the text of a le, you should open it in a text editor, as described in Chapter 10 [Editing Text], page 231. The Vi editor comes with a special command, view, to open a le in read-only mode with Vi, so that it can only be viewedyou cannot, accidentally or intentionally, make any changes to the le while it is open if you use this command. Some kinds of lessuch as PostScript, dvi, and pdf lesoften contain text in them, but they are technically not text les. These are image format les, and I describe methods for viewing them in Recipe 17.4 [Previewing Print Files], page 413.
212
Another tool, zless, is identical to less, but you use it to view compressed text les; it allows you to read a compressed text les contents without having to uncompress the le rst (see Recipe 8.4 [Using File Compression], page 196). Most of the system documentation in the /usr/doc and /usr/share/doc directories, for example, consists of compressed text les. You may, on occasion, be confronted with a reference to a command for paging text, called more. It was the standard tool for paging text until it gave way to less in the early to mid 1990s; less comes with many more options its most notable advantage being the ability to scroll backward through a lebut at the expense of being almost exactly three times the size of more. Hence, there are two meanings to the saying, less is more. The following table summarizes the most essential keyboard commands for paging through text in less. It lists the keystrokes and describes the commands. Cursor Movement Scroll back through the text (up) one line. Scroll forward through the text (down) one line. or
PgUp
Scroll horizontally (left or right) one tab stop; useful for perusing les that contain long lines.
SPACEBAR
or
Scroll backward (up) through the text by one screenful. Scroll forward (down) through the text by one screenful. Move to the beginning of the le. Move to the end of the le. Search forward through the le for lines containing pattern. Search backward through the le for lines containing pattern.
PgDn
pattern
213
Miscellaneous R or CTRL - L
H V
Redraw (or repaint) the screen. Display a help screen. Open the le in the Vi editor, so you can edit it. (Then, when you write and save it with :wq or just exit with :q, you will be back in less.) Quit viewing the le and exit less.
NOTES: less has many command line options as well as key commands to be used while running, and there are all kinds of tricks you can do with it almost enough for a whole chapter. If this sort of thing interests you, its worth reading through the less man page.
This command starts less and displays the le README on the screen. You can move forward through the document a line at a time by typing , and you can move forward through the document a screenful at a time by typing PgDn . To move backward by a line, type , and type PgUp to move backward by a screenful. You can also search through the text you are currently perusingthis is described in Recipe 14.11 [Searching the Text Youre Perusing], page 354. To stop viewing the le and exit less, press Q .
214
NOTES: You can make your own custom prompt, making use of a number of variables that hold information about the le; see the less man page for information on how to do this.
215
METHOD #2 To display raw control characters in text, but try to keep the screen appearance, use less with the -R option. This displays raw control characters, but any disparities that may be caused by the control characters on the screen are controlled, whenever possible. To peruse the le live.transcript and display any raw control characters in it, but attempt to keep the screen in order, type:
$ less -R live.transcript RET
Figure 9-1. Viewing multiple les in less. METHOD #1 You can specify more than one le to page through with less, and you can specify le patterns in order to open all of the les that match that pattern. The les will be displayed in sequenceless displays each le in turn, beginning with the rst le you specify or the rst le that matches the given
216
pattern. To move to the next le, press N ; to move to the previous le, press P . To page through all of the unix faq les in /usr/doc/FAQ, type:
$ less /usr/doc/FAQ/unix-faq-part* RET
This command starts less, which then opens all of the les that match the given pattern /usr/doc/FAQ/unix-faq-part*, and begins displaying the rst one, as in Figure 9-1. METHOD #2 Another method is to use cat to concatenate all the les together, and pipe that output to less. There will be no indicator to mark where one le ends and another begins, but you can scroll through the entire text cleanly without pressing buttons to move from le to le. To page through all of the unix faq les in /usr/doc/FAQ all at once, type:
$ cat /usr/doc/FAQ/unix-faq-part* | less RET
There is no indicator when one le ends and the next begins, but rather, all are treated as one long le in the order given. (In this case, where the wildcard character was used, they are displayed in the order in which the shell expands the * to all of their names.)
If you have a small text le that you want to look at, you just cat it to the screen. Its quick, it gets the job done, you dont have to think about it. But while it is useful for concatenating text (see Recipe 10.6 [Concatenating Text], page 256), it isnt always the best way to peruse or read texta very large text will scroll o the top of the screen, for example.
217
Sometimes, simple outputting of text is quite appropriate, such as when you just want to display one line of a le, or when you want to display the rst or last part of a le. This section describes the tools used for such purposes. These tools are best used as lters, often at the end of a pipeline, taking their input from the output of other commands. To display text in a font, rst convert it to PostScript and view that (see Recipe 15.2 [Outputting Text to PostScript], page 359).
To visually display the end of each line, use the -E option; it species that a $ should be output after the end of each line. This is useful for determining whether lines contain trailing space characters. (You can also use grep to output lines containing trailing spaces.) Also useful is the -T option, which outputs tab characters as their literal control character, written in hat notation as ^I. The -A option combines all three of these optionsit is the same as specifying -vET. Here are some ways to use this. To output the le translation with a $ character displayed at the end of every line, type:
$ cat -E translation RET
To output the le translation with all tab characters written as ^I instead of literal tabs, type:
$ cat -T translation RET
To output the le translation with non-printing characters, including tabs, displayed in hat notation, and with a $ character displayed at the end of each line, type:
$ cat -A translation RET
218
You can specify as a numeric option the number of lines to output. If you specify more lines than a le contains, head just outputs the entire text. Here are two ways to use this. To output the rst line of le placement-list, type:
$ head -1 placement-list RET
To output a given number of characters (bytes) instead of lines, give the number of characters to output as an argument to the -c option. To output the rst character in the le placement-list, type:
$ head -c1 placement-list RET
NOTES: An old unix tool named line just output the rst line of its input. This tool does not exist for Linux, but you can make a pretty good imitation with head by dening line as an alias for head -1 (for more information on making aliases, see Recipe 3.6 [Using Alias Words], page 82).
To specify which part of the text to output by its relation to the beginning of the text, precede the number with a plus sign (+).
219
Here are two ways to use this. To output the end part of the le placement-list, beginning with the third line, type:
$ tail +3 placement-list RET
To output the end part of the le placement-list, beginning with the hundredth character, type:
$ tail -c +100 placement-list RET
It is sometimes useful to view the end of a le on a continuing basis; this can be useful for a growing le, a le that is being written to by another process. To keep viewing the end of such a le, use tail with the -f (follow) option. Type CTRL - C to stop viewing the le. To follow the end of the le access_log, type:
$ tail -f access_log RET
NOTES: You can achieve the same result with less; to do this, type F while perusing the text (see Recipe 9.1 [Perusing Text], page 211).
To output a region of more than one line, give the starting and ending line numbers, separated by a comma. To output lines 47 to 108 of le placement-list, type:
$ sed '47,108!d' placement-list RET
METHOD #2 To output the middle part of some text, you can also combine multiple head or tail commands on a pipeline (see Recipe 3.2.4 [Redirecting Output to Another Commands Input], page 69).
220
Here are some ways to use this. To output the tenth line in the le placement-list, type:
$ head placement-list | tail -1 RET
To output the fth and fourth lines from the bottom of le placement-list, type:
$ tail -5 placement-list | head -2 RET
To output the rst character on the fth line of the le placementlist, type:
$ head -5 placement-list | tail -1 | head -c1 RET
In the preceding example, three commands were used: The rst ve lines of le placement-list are passed to tail, which outputs the last line in the output (the fth line in the le); then, the last head command outputs the rst character in that last line, which achieves the desired result.
To output all of the lines of text except those between two patterns, omit the -n option. To output all the text from le book-draft, except that which lies between the text Chapter 3 and Chapter 4, type:
$ sed '/Chapter 3/,/Chapter 4/p' book-draft RET
NOTES: For more on sed, see Recipe 10.5 [Editing Streams of Text], page 255.
221
METHOD #2 You can get the same eect as od with hexdump. Use the -c option, which displays each byte in the le as the character it represents. As with Method #1, 16 characters of the input is displayed on each line, separated by spaces, and a column is written on the left-hand side showing the oset value of the le, except in this case the oset is given in hexadecimal. To display the literal characters in the le exam, grouped 16 per line, with each line prefaced by an oset number in hexadecimal, type:
$ hexdump -c exam RET
222
There are several methods for doing this, each with its own output format. All of them are capable of outputting in hexadecimal (or hex for short); these outputs are sometimes called hex dumps. METHOD #1 The hexdump lter dumps its input in any one of a number of formats, showing a number of characters from the le per line, and preceded with a number indicating the location in the le of the rst character in that line. To display text in hex, rst use the tr lter to eliminate carriage returns from the input, and pass this text to hexdump with the -c option, which displays its input in hexadecimal, with one byte per character. 16 characters of the input are displayed on each line, separated by spaces, and a column is written on the left-hand side showing the oset value of the le, in hexadecimal. To peruse the contents of the le tarpon in hexadecimal, type:
$ tr -d '\r' < tarpon | hexdump -c | less RET
METHOD #2 Use od, octal dump, to make a literal and unambiguous dump of some text. It works as a lter or takes the name of a le as an argument, and can output in octal, hexadecimal, or other formats Use the -t option to specify the format type of the output, and give x1 as an argument to specify that the display should be in hexadecimal, with one byte per integer (with an argument of x2, a hex integer is displayed for every two bytes of input). To peruse the contents of the le details in hex, type:
$ od -t x1 details | less RET
This command outputs the values of each literal character of the le details in hexadecimal, 16 characters per line, separated by spaces. Each line is preceded by an oset value (in octal) indicating the oset in the le of the rst character in that line. To change the oset display from octal to decimal, use the -A option and give d as an argument (or give x if you want hex). To display the printable characters in a new column on the right-hand side of the screen, add a z to the end of your argument to the -t option. Each line of the column will be prefaced with a greater-than sign (>) and end with a less-than sign (<).
223
To peruse the contents of the le details in hex, showing the les printable characters in its own column, type:
$ od -t x1z details | less RET
METHOD #3 Midnight Commander DEB: mc-common mc RPM: mc WWW: http://www.ibiblio.org/mc/ When you view a le in mc, you can toggle the display of hex values. To do this, type F3 on a le in the directory listing to view the le, and then type F4 while viewing the le to toggle between viewing the ascii characters or their hex values; type F10 to exit viewing the le, and type F10 again to exit mc. METHOD #4 To view a hex dump of a buer in Emacs, use hexl-mode. To view a hex dump of the current buer, type:
ALT - X
hexl-mode RET
NOTES: This mode is good for viewing and editing binary les in Emacs.
224
METHOD #2 To view an html-formatted text le with the html formatting applied to the text, open the le in a Web browser as described in Methods #2 and #3 of Recipe 5.10 [Browsing Files and Directories], page 157. To view the html-formatted text le homepage.html as rendered html, type:
$ mozilla homepage.html RET
To convert the nroff le program.1 to text, and write that text to a new le program.txt, type:
$ man -l program.1 > program.txt RET
In this last example, the new le program.txt will contain overstrike characters for boldface text. The original le program.1 is unaltered. NOTES: All man pages are written in nroff format, hence the use of that command to view it.
225
METHOD #1 Cutils DEB: cutils WWW: http://www.sigala.it/sandro/software.html#cutils Use the chilight lter, distributed as part of the Cutils package, to view C program source code with language highlighting. Given the name of a le as an argument (or the standard input if the le name is omitted), chilight outputs the C program source code, highlighted in one of a number of formats. Specify the highlighting format by giving one of the following as an argument to the -f option; the default value is tty. ansi_color ansi_bold html_color html_font roff tty ascii text with ansi color. ascii text with ansi bold. html with color highlights. Monochrome html with bold and italic highlights. troff input text. ascii text with overstrikes (the default).
Since ansi highlights in text consist of non-printing control sequences, to peruse such output use less with the -R option (see Recipe 9.1.4 [Perusing Raw Text], page 214). To peruse the C program source code in the le myprog.c with colorized language highlighting, type:
$ chilight -f ansi_color myprog.c | less -R RET
By default, chilight sends its output to the standard output. To write to a le instead, give the le name to write to as an argument to the -o option. To format the C program source code in the le myprog.c as html with color highlighting and write the output to the le myprog.html, type:
$ chilight -f color_html -o myprog.html myprog.c RET
METHOD #2 To view C program source code with highlighting, use enscript to prettyprint it, as described in Recipe 15.2.4 [Outputting Text with Language Highlighting], page 365.
226
This method outputs the text in PostScript, which you then view or print. It also works with many other languages and formats, and not just Csee the table in the aforementioned recipe. To display the C program source code in the le myprog.c as PostScript with language highlighting, type:
$ enscript -Ec -o i myprog.c | gv - RET
In this example, the gv command was used to display the enscript output.
If the text to match contains spaces, quote it. To display all lines of the sorted le parts-list that begin with the text Part No. 42, type:
$ look "Part No. 42" parts-list RET
NOTES: Without a second argument, look uses the system dictionary. This is described in Recipe 11.2.1 [Listing Words That Match a Pattern], page 283.
227
There are a few methods for viewing text containing backspace underlines in dierent ways. METHOD #1 Use less to peruse text containing backspace underlines (see Recipe 9.1 [Perusing Text], page 211). To peruse the le term-paper so that you can view any backspace underlines it contains, type:
$ less term-paper RET
METHOD #2 Use the ul tool to output text containing backspace underlines, so that these underlines are displayed correctly on your terminal. To output the le term-paper so that you can view underlined text, type:
$ ul term-paper RET
This command converts any backspace underlines in term-paper to character sequences that your terminal can display; thus, if you have cat or some other command further on a pipeline, the text will be displayed properly on your screen. To output the le term-paper with cat, showing any underlined text on your terminal, type:
$ ul term-paper | cat RET
METHOD #3 Use colcrt to convert backspace underlining to dashing (a row of hyphen characters, like ------) drawn beneath the underlined text. To output the le term-paper, with all backspace underlining converted to dashing, type:
$ colcrt term-paper RET
Dashing inserts a new line in the text directly underneath any underlined text, and this is not always desirable. Use the - option to supress underlining entirely, and display any underlined text as plain text. To output the le term-paper, with all backspace underlining removed, type:
$ colcrt - term-paper RET
228
To peruse the formatted output of any text strings in the le table.com, type:
$ strings table.com | fmt | less RET
This displays the values of each character in octal, decimal, and hexadecimal, and also displays their escape codes. These values can be useful for quoting special characters. The iso_8859_1 man page contains the entire iso 8859-1 character set, including all extended characters above the standard 127 ascii characters.
229
You can use this page to see all of the characters in this character set and how to input them. NOTES: Theres a special way to quote these characters in Emacs; this technique is described in Recipe 10.1.4 [Inserting Special Characters in Emacs], page 239. The miscfiles package also contains charts for these character sets, as explained in Recipe 11.4 [Using Word Lists and Reference Files], page 289.
230
231
232
mode in Emacs, wordstar-mode, which emulates its key bindings). A list of other recommended editors concludes the chapter.
233
Here are two ways to do this. To start gnu Emacs at a shell prompt, type:
$ emacs RET
Upon startup in X, a typical gnu Emacs window looks like Figure 10-1 (the client window will dier depending on your window manager):
Figure 10-1. Emacs upon startup. The welcome message appears when Emacs rst starts, and it tells you, among other things, how to run a tutorial (which well look at in just a minute). The bar running along the entire left-hand side of the window is called the scroll bar. The X client window in which an Emacs session is displayed (or the terminal screen, when not running in an X window) is called the frame. Notice that there is no border along the sides (if you look closely, you can see that even the side with the scroll bar is lacking a border); that is because many of todays window managers, including the one in the illustration, only draw borders on the top and bottom sides of a window. The top bar is called the menu bar, and you can pull down its menus with the mouse by left-clicking a menu and then dragging it down. When you run Emacs in a terminal, you cant use the mouse to pull down the menus, but
234
you can access and choose the same menu items in a text menu window by typing F10 .1 A le or other text open in Emacs is held in its own area called a buer. By default, the current buer appears in the large area underneath the menu bar. To write text in the buer, simply type it. The place in the buer where the cursor sits is called point, and is referenced by many Emacs commands. The lled-in area on the scroll bar represents the text that is displayed in the window in relation to the rest of the buer. Thus, the scroll bar will be lled completely in a new, small, or empty buer (as in the illustration), and when you are near the bottom of a very large buer, only a tiny portion near the bottom of the scroll bar will be lled. The horizontal bar near the bottom of the Emacs window and directly underneath the current buer is called the mode line; it gives information about the current buer, including its name, what percentage of the buer ts on the screen, what line point is on, and whether or not the buer is saved to a le. The mode line also lists the modes active in the buer. Emacs modes are general states that control the way Emacs behavesfor example, when overwrite-mode is set, the text you type overwrites the text at point; in insert-mode (the default), the text you type is inserted at point. Usually, either fundamental-mode (the default) or text-mode will be listed. Just beneath the mode line is the echo area where Emacs writes brief status messages, such as error messages; it is the last line in the Emacs window. When you type a command that requires input, that input is requested in this area (and when that happens, the place you type your input, in the echo area, is then called the minibuer). If you look closely, you can see that it has its own scroll bar, too. Emacs makes extensive use of CTRL and ALT key combinations. Because Emacs is dierent in culture from the editors and approach of the Microsoft Windows and Apple macos world, it has gotten a rather unfounded reputation in those corners that it is odd and dicult to use. This is not so. The keyboard commands to run its various functions are designed for ease of use and easy recallonce you get used to this concept, you can type these key combinations very quickly. In Emacs notation, these keypresses are written a certain way. Many commands are begun by typing CTRL - X , which is written C-x (the command to exit Emacs, for example, is CTRL - X CTRL - C , and is written C-x C-c.)
1
The F10 key also works in X, where it behaves the same as in a terminal.
235
Functions are prefaced by ALT - X , which in Emacs is written as M-x.2 You can toggle various modes on or o by functions. For example, you can make the menu bar appear or disappear by toggling menu-bar-mode. Typing F10 to activate the menu pull-downs works whether menu-bar-mode is on or o; if its o, the menu choices will appear in a new buer window. You can run any Emacs function by typing ALT - X followed by the function name and pressing RET . To run the menu-bar-mode function, thus turning o the top menu bar, type:
ALT - X
menu-bar-mode RET
(If the menu bar is already turned o, running this function will turn it back on.) Type CTRL - G in Emacs to quit a function or command that you are typing; if you make a mistake when typing a command, this is useful for canceling and aborting the keyboard input. The find-file function prompts for the name of a le and opens a copy of the le in a new buer; its keyboard accelerator is CTRL - X CTRL - F (you can keep CTRL depressed while you press and release the X and F keys). To run the find-file function, type:
ALT - X
find-file RET
This command runs the find-file function, which prompts for the name of a le and opens a copy of the le in a new buer. Emacs can have more than one buer open at once. Any le names you give as an argument to emacs will open in separate buers:
$ emacs diary etc/todo etc/rolo RET
(You can also make new buers and open les in buers later, of course.) Just as functions are prefaced by the ALT - X keystroke, many commands are prefaced by the similar CTRL - X keystroke, particularly commands that work on buers, les, or have to do with exiting Emacs. To switch between buers, type CTRL - X CTRL - B . Then, give the name of the buer to switch to, followed by RET ; alternatively, type RET without a buer name to switch to the last buer you visited. (Viewing a buer in Emacs is called visiting the buer.)
2
Technically, this refers to the META key. Chances are that your keyboard has an ALT key and no META key, though, in which case you use ALT to type it, so Ive used ALT to notate this key (see Recipe 1.2 [Typographical Conventions], page 6).
236
todo RET
If a buer does not exist, Emacs will make a new buer with the name you give. When you start Emacs, a special buer named *scratch* exists, which you can use for writing notes and other things you dont want to save; its contents arent saved, and the next time you run Emacs the *scratch* buer will be empty again. To switch to the *scratch* buer, type:
CTRL - X CTRL - B
*scratch* RET
To write some text in the current buer, just type it. Text you type is inserted at point. To insert a line of text at point in the current buer, type:
This is how to type in Emacs. RET
Close a buer by killing it with the CTRL - X k command. Emacs asks for the name of the buer to kill in the minibuer. The default is the current buer; just pressing RET will kill it. If the contents of the buer is from a le, and the buer contains unsaved work, Emacs will ask you to conrm killing the buer. If its the *scratch* buer or a new buer whose contents has never been written to a le, C command will kill it without asking. To kill *scratch* when its the current buer, type:
k RET Kill buffer: (default *scratch*) RET
CTRL - X
Now that we have run through the essential Emacs terminology, Ill show you how to exit the program. To kill Emacs, use CTRL - X CTRL - C which also gives you a chance to save any unsaved buers before Emacs is killed. You can also type CTRL - Z to suspend Emacs as a background job, so that you can return to it later (see Recipe 3.3.3 [Putting a Job in the Foreground], page 73). In X, CTRL - Z does not suspend Emacs but rather it iconies the Emacs window. Deiconify it to bring it back (see Recipe 4.3.5 [Deiconifying an X Window], page 107). Here are some ways to use this. To kill Emacs, with a chance to save any unsaved buers rst, type:
CTRL - X CTRL - C RET
237
This command opens the tutorial, a special read-only le, into its own buer. NOTES: Incidentally, CTRL - H is the Emacs help key; all help-related commands begin with this key. For example, to read the Emacs faq, type CTRL H F, and to run the Info documentation browser (which contains The gnu Emacs Manual), type CTRL - H i.
Move point up to the previous line. Move point down to the next line. Move point back (to the left) through the buer one character. Move point forward (to the right) through the buer one character. Move point forward one word.
CTRL
CTRL
238
Move point backward one word. Move point back to the next start-of-paragraph. Move point forward to the next end-of-paragraph.
or or A E L CTRL ALT
PgUp PgDn
Move point forward through the buer one screenful. Move point backward through the buer one screenful. Move point to the beginning of the current line. Move point to the end of the current line. Re-center the text in the Emacs window, placing the line where point is in the middle of the screen. Toggle overwrite-mode.
Transpose the character at point with the character to the left of point. Transpose the word at point with the word to the left of point.
CTRL CTRL
ALT
BKSP DEL
or or
Delete character to the left of point. Delete character to the right of point. Yank text in the kill ring at point (see Recipe 10.3.2 [Pasting Text], page 254). Set mark (see Recipe 10.3.1 [Cutting Text], page 254). Undo the last action (control-underscore).
SPACEBAR
K W
Kill text from point to end of line. Kill text from mark to point.
239
Start the Emacs tutorial. Describe keystroke. List all Emacs commands related to function. Open a copy of the Emacs FAQ in a new buer. Start Info. Cancel the current command. Repeat the next command or keystroke you type number times.
C
H H
k keystroke a function
H H
F i
number
Save all buers open in Emacs, and then exit the program. Open le in a new buer for editing. To create a new le that does not yet exist, just specify the le name you want to give it. To browse through your les, type TAB instead of a le name. Display a menu of all open buers, sorted by major mode (works in X only). Display a font selection menu (works in X only).
CTRL
le
RET
-left-click
240
Here are two ways to use this. To insert a formfeed character at point by specifying its actual keystroke ( CTRL - L ), type:
CTRL - Q CTRL - L
To insert a formfeed character at point by specifying its octal character code, type:
CTRL - Q
014 RET
The preceding examples both do the same thing: They insert a formfeed character at point. An interesting use of CTRL - Q is to underline text. To do this, insert a literal CTRL - H character followed by an underscore (_) after each character you want to underline. To underline the character before point, type:
CTRL - Q CTRL - H
You can then use ul to output the text to the screen (see Recipe 13.9 [Underlining Text], page 327). Another kind of special character insert you might want to make is for accented characters and other characters used in various languages. There are two methods for inserting them in a buer. METHOD #1 To insert an accented character, use iso-accents-mode. When this mode is active, you can type a special accent character followed by the character to be accented, and the proper accented character will be inserted at point. The following table shows the special accent characters and the key combinations to use. Prex . . . " " " " " " ' ' Plus This Letter a e i o u s a e Yields This Result a e i o u a e
241
To write the text Emacs ist spa! at point in the current buer, type:
ALT - X iso-accents-mode RET Emacs ist spa"ss!
In the event that you want to type the literal key combinations that make up an accented character in a buer where you have iso-accents-mode on, type the prex character twice. To type the text 'o (and not the accent character o) in a buer while iso-accents-mode is on, type:
''o
242
METHOD #2 To insert accented characters and other special language characters in a buer without entering iso-accents-mode, use CTRL - X 8 followed by the special key combination of accent prex and character, as described in the previous table. Non-letter characters do not require the accent prex with this method. To write the text Hasta Ma~ana! at point in the current buer, type: n
CTRL - X 8 ! Hasta Ma CTRL - X 8
~ nana!
NOTES: When a buer contains accented characters, it can no longer be saved as plain ascii text, but must instead be saved as text in the iso-8859-1 character set (see Recipe 9.3.7 [Viewing a Character Set], page 228). When you save a buer, Emacs will notify you that it must do this. Recently, a number of internationalization functions have been added to gnu Emacs. A complete discussion of their use is beyond the scope of this book; for more information on this topic, consult the International Character Set Support section of The gnu Emacs Manual.
abbrev-mode RET
To dene an abbrev, type the abbrev you want to use and then type CTRL aig. Emacs will prompt in the minibuer for the text you want the abbrev to expand to; type that text and then type RET . To dene ww as an abbrev for Walla Walla, Washington, do the following: 1. First, type the abbrev itself:
X
ww
aig
243
Now, whenever you type the text ww followed by a whitespace or punctuation character in the current buer, that text will expand to the text Walla Walla, Washington. To save the abbrevs you have dened so that you can use them later, use the write-abbrev-file function. This saves all of the abbrevs currently dened to a le that you can read in a future Emacs session. (You can also open the le in a buer and edit the abbrevs if you like.) To save the abbrevs you have currently dened to the le ~/.abbrevs, type:
ALT - X
Then, in a future Emacs session, you can use the read-abbrev-file function to dene those abbrevs for that session. To read the abbrevs from the le ~/.abbrevs, and dene them for the current session, type:
ALT - X
NOTES: Emacs mode commands are toggles. So to turn o abbrev-mode in a buer, just type ALT - X abbrev-mode RET again. If you turn abbrevmode on in that buer later on during the Emacs session, the abbrevs will be remembered and will expand again.
244
20 CTRL - X e
NOTES: Macros are fundamental to how Emacs worksin fact, the name Emacs is derived from Editing MACroS, because the rst version of Emacs in 1976 was actually a collection of such macros written for another text editor.
10.2 Using Vi
Nvi DEB: RPM: WWW: WWW: nvi nvi http://www.bostic.com/vi/ http://vasc.ri.cmu.edu/old_help/Editors/Vi/
The following recipes work for the Vi editor. Its name, pronounced vye, or sometimes vee-eye, is short for visual ; when it was rst invented, it was
245
among the rst text editors to visually display the text on the entire screen for interactive editing (other interactive editors of the time typically displayed les line by line). As with Emacs, there are many variants of Vi; a few of the more popular ones today are Vim and Elvis, both newer implementations that have many more features than the original Vi. This section will assume use of Nvi, a new implementation of the original Vi for bsd that is commonly found on most Linux systems today.
Vi is a modal editor, where the meaning of text you type depends on the current editing mode the editor is in. When you start, Vi is in command mode, which means that the text you type is interpreted as literal Vi commands. A typical Vi session, upon startup in command mode with a new le, looks like Figure 10-2. The cursor is positioned in the upper right-hand corner. Vi lls lines on the screen after the end of the le with the tilde character (~); so when you are in a new le, such as when you start Vi with no arguments, the screen is lled with tildes because there is nothing yet in the le. The bottom line of the screen is called the command line, and is where Vi displays important messages and information about the le you are editing. When Vi starts, the command line displays three things: First, the name of the recovery le used for this le.3 Second, Vi displays the name of the le
3
Vi uses the /tmp directory to store temporary les for all les that you edit; it saves your editing work so that you can recover it in the event of a crash, or if you accidentally exit Vi before you save it.
246
being edited; in this case, the le doesnt have a name yet, so new file is written on the command line. The third thing displayed on the command line is the line number of the le that the cursor is on.
Figure 10-2. Vi upon startup. Type ZZ to exit Vi when you are in command mode. To exit Vi from command mode, type:
ZZ
To begin editing a particular le, give its name as an argument; if you specify a le that doesnt exist, Vi will begin editing a new le, and when you write it to disk, it will be saved with the name you gave it. To start Vi and open a le named planner, type:
$ vi planner RET
When in command mode, execute a command by typing it. To cancel a command you have begun typing, press ESC . Some commands, particularly those for writing les, are preceded by a colon character (:); technically, pressing the colon brings you to a new mode, command line mode. To change to insert mode, where text you type is inserted in the le you are editing,4 you can use one of several commands; the i command enters insert mode at the point where the cursor is currently located, and allows you to insert text you type at that point. To exit insert mode and move to command mode, type ESC .
247
This moves from command mode to insert mode, inserts the text Hello, world. and a newline character in the current le, where the cursor was, and then brings Vi back to command mode. The command to get help is :help, and to get a list of commands and their usage, run the :viusage command. To get a list of Vi commands and their usage, type:
:viusage RET
When you open a le in Vi, the content of the le is placed in its own buer, as with Emacs. Changes are not made to a le on disk until you write them. To write a buer to a le, use :w and give the name of the le to write to. Use :wq instead to write the le to disk and quit, and use :q! to abandon all unsaved editing, and quit Vi. Here are two ways to use this. To write the contents of the buer to the le my_practice_file, and then exit Vi, type:
:wq my_practice_file RET
NOTES: You can also type ZZ to write the changes to the current le and exit.
248
To run the vi tutorial, type the following from your home directory:
$ cp /usr/doc/nvi/vi.beginner.gz . RET $ gunzip vi.beginner.gz RET $ vi vi.beginner RET
NOTES: An advanced tutorial is also available in /usr/doc/nvi. The vim editor has an interactive tutorial that you run as its own command, vimtutor.
Scroll text down one full screen. Scroll text up one full screen. Scroll text down one half-screen. Scroll text up one half-screen. Move down one character. Move up one character. Move to the left one character. Move to the right one character. Move to top of screen. Move to bottom of screen. Move forward one word. Move backward one word. Move forward one sentence.
B D U
or j or k or h or l H L w b (
249
Move backward one sentence. Go to line number. (With no number preceding it, G goes to the last line in the le.) Go to beginning of line cursor is on. Go to end of line cursor is on. Delete character cursor is on. Delete line cursor is on. Delete everything from the cursor to the end of the line. Join the line the cursor is on with the line that follows it (i.e., delete the newline character between them). Paste, after the cursor, the last text that was deleted. Paste, before the cursor, the last text that was deleted. Yank current line. If preceded by a number, then yank that number of lines. Undo last edit made. Redo last edit made. Search forward for pattern (if none given, then search for the next forward occurrence of the last pattern searched for). Searches wrap from end of le to beginning. Search backward for pattern (if none given, then search for the next backward occurrence of the last pattern searched for). Searches wrap from beginning of le to end.
?pattern
RET
250
Appends text just after the cursor. Appends text at the end of the line the cursor is on. Inserts text just before the cursor. Inserts text at the beginning of the line that the cursor is on. Opens a new line below the line the cursor is on, and begins inserting text there. Opens a new line above the line the cursor is on, and begins inserting text there. Replaces the character the cursor is over with one you type. Replaces existing text with the text you type. Substitutes the character under the cursor with the text you type, deleting that character and inserting text at that point. Substitutes the line the cursor is on with the text you type, deleting that line and inserting text at that point.
Quitting Vi :q :q!
RET RET
Quit Vi only if there are no unsaved edits. Quit without saving, even if there have been changes to the le.
RET
Write le to disk; if name is given, write it to that le name. Write le to disk and quit Vi; if name is given, write it to that le name. Write le and quit Vi.
RET
251
in input
To insert a formfeed character (Control-L) before the cursor when you are already in input mode, type:
CTRL - V CTRL - L
NOTES: After this last example, you can return to input mode by typing a command such as i.
252
10.2.7 Customizing Vi
There are a number of options you can set in Vi; use the set command followed by the name of the option to set it. Given alone, set lists all of the options that have changed from their defaults, and given with the all option, set lists all options that are available. Here are two ways to use this. To show all the options that have been changed from their default behavior, type:
:set RET
The following table lists some of the set options and describes their actions. autoindent autowrite beautify columns=number flash leftright lines=number list Automatically indent new lines. Automatically write les to disk when changing to another le. Do not display control characters. Set the number of columns (default 80, sometimes larger in X). Flash the screen instead of ringing the system bell (the default). Allow for scrolling to the left and right. Set number of lines shown on the screen at once (default is 24, sometimes larger in X). Text is displayed unambiguously, so that tab characters appear as ^I instead of as eight spaces, and a $ is given at the end of every line. Lines are not prefaced with line numbers (the default). Lines are prefaced with line numbers. Draw a ruler on the command line, showing the current line number and column number.
253
showmatch showmode
Note when closing parentheses or curly braces match their opening partner. Show the name of the current editing mode on the right side of the command line, and display an asterisk (*) when the le has been modied. Give verbose error messages.
verbose
NOTES: For the complete list of options, consult the vi man page.
254
255
The utility of a token is that when you leave that part of the text, you can quickly return to it later by searching for the token string. The string you use for a token must be something unique that does not appear in the text proper, and yet is something that you can recognize. Use it to bookmark a point in a text you are editing, for when you need to move elsewhere in the text to do some other thing, but have intend to come back to this place later. Its also handy for when you are editing a text and have to keep a space blank for the time being, such as someones name that you will add later, once it becomes known. When you want to go back to the place you have marked with the token, just search for the token using the editors search facilities. (In Vi, you can use the m command to set a named mark in the le at the point where the cursor is.) My favorite token is tk, the printers mark. This two-letter combination occurs rarely in English text, and it is very short, so it is a good one to use for such purposes.5 Some people use a silly nonsense word that they can remember, and others use *** or ### or some other thing.
In printing, where this mark has its origin, it stands for to kum, meaning that the text where this token was put is to come at some later time. Writers would intentionally misspell this and other marks on the copy they submitted, so that the typesetters would know that they were instructions to them, and not a literal part of the text to typeset.
256
stream and replace it with some other pattern in the output stream is s/searchpattern/replacepattern/g; to lter the output of a command, you can quote this command as an argument to sed and put it on a pipeline. To output a calendar of the current month, with all 1 characters replaced with l characters, type:
$ cal | sed 's/1/l/g' RET
This example uses cal to display a calendar (see Recipe 27.3.1 [Displaying a Calendar], page 539). The output of cal is edited by sed and then sent to standard output. You can also use sed to edit the contents of les by giving some lespec as a second argument; the content of the les are sent to standard output with the specied editing changes, and the original les are not altered. Here are two ways to use this. To output the contents of the le remarks, replacing every instance of the text quite pleased; with absolutely delighted, type (all on one line):
$ sed 's/quite pleased/absolutely delighted/g' remarks RET
To output the contents of all les in the current directory whose le names end with remarks, replacing every instance of the text surprised and nearly shocked with utterly astounded, type (all on one line):
$ sed 's/surprised\|nearly shocked/utterly astounded/g' *remarks RET
NOTES: See Appendix D [References for Further Interest], page 731, for more information on sed.
257
The Great Gatsby Tender Is the Night The Love of the Last Tycoon
Figure 10-4. The later le. To concatenate these les into a new le, novels, type:
$ cat early later > novels RET
This command redirects the standard output to a new le, novels, whose contents would look like Figure 10-5. The les early and later are not altered.
This Side of Paradise The Beautiful and Damned The Great Gatsby Tender Is the Night The Love of the Last Tycoon
Figure 10-5. The novels le. Had you run cat later early > novels instead, the les would be concatenated in that reversed order instead, beginning with later; so the le novels would look like Figure 10-6.
The Great Gatsby Tender Is the Night The Love of the Last Tycoon This Side of Paradise The Beautiful and Damned
Figure 10-6. The novels le reversed. The following sections give other recipes for concatenating text. NOTES: You can also use cat to concatenate les that are not text, but its most popular usage is with text les. Another way to concatenate les of text in an automated way is to use le inclusionsee Recipe 10.7 [Including Text from Other Files], page 261. A similar tool, zcat, works on the contents of compressed les.
258
In this example, the text le novels was created and contains four lines of text (the last line with the CTRL - D is never part of the le). Typing text like this without an editor will sometimes do in a pinch but, if you make a mistake, there is not much recourse besides starting overyou can type CTRL - U to erase the current line, and CTRL - C to abort the whole thing and not write the text to a le at all, but thats about it.
259
In this example, no les were specied to cat for input, so cat used the standard input; then, one line of text was typed, and this text was appended to le novels, the le used in the previous recipe. So now this le would look like Figure 10-5.
Figure 10-7. The ins le. To insert one or more lines of text at the beginning of a le, give the name of the le into which the text should be inserted as an argument to ins; ins will read lines of text from the standard input and insert them at the beginning of the le. (It works by opening the le in ed, a simple line editor.) Give the eofthat is, type CTRL - D on a line by itselfto signify the end of the lines of text to insert.
260
This command inserts two lines of text at the beginning of novels, the le used in the previous examples in this section. This le would now look like Figure 10-8.
The Novels of F. Scott Fitzgerald --------------------------------This Side of Paradise The Beautiful and Damned The Great Gatsby Tender Is the Night The Love of the Last Tycoon
Figure 10-8. The novels le with a new beginning. METHOD #2 To use cat to insert text at the beginning of a le, use cat to concatenate the standard input and the le; redirect this to a new le name that will contain the le with the inserted text at the beginning. To insert several lines of text at the beginning of the le novels, type:
$ cat - novels > novels.tmp RET The Novels of F. Scott Fitzgerald RET --------------------------------- RET CTRL - D $
This command writes a new le, novels.tmp, containing the lines you typed and then the contents of novels. To keep the le with this inserted text, move novels.tmp to novels.
261
When you process this le for inclusion, the line with the include statement is replaced with the contents of the le le (whose path is relative to the current directory of the include le). Use the m4 tool, the gnu macro processor, to process an include le. It takes as an argument the name of the include le, and it outputs the inclusion to the standard output. You can use redirection to redirect the output to a le.6 For example, suppose you have three les: soups as in Figure 10-9, sandwiches as in Figure 10-10, and menu as in Figure 10-11.
Clam Chowder Lobster Bisque Vegetable
This is a fairly simple use of m4; it can do much more, including run commands, manipulate text, and run custom macros. Consult its Info documentation for more (see Recipe 2.8.5 [Reading an Info Manual], page 48).
262
BLT Ham on Rye Roast Beef
Figure 10-11. The menu le. To process the le and write it to the le monday.txt, type:
$ m4 menu > monday.txt RET
263
NOTES: You can write more than one include le that will use your lesand these include les themselves can have inclusions of their own.
AEE
The advanced easy editor has a pop-up menu interface and is meant to be usable with no prior instruction; includes an interface for use in X, xae. DEB: aee RPM: aee WWW: http://mahon.cwx.net/
264
Cooledit Cooledit is a popular, fast text editor for use in X; its features include anti-aliased fonts, Unicode support, and extensibility via the Python programming language. Its based on the Midnight Commanders terminal editor, and its unique in that it is unlike either Emacs or Vi. DEB: cooledit RPM: cooledit WWW: http://cooledit.sourceforge.net/
Figure 10-14. Cooledit. DEdit DEdit is a simple editor for use in X with gnome installed. It can read compressed les and display Japanese characters. DEB: dedit
265
E3
A tiny editor (10 kb in size) with available keyboard bindings that emulate Emacs, Vi, pico, Nedit, and WordStar. DEB: e3 RPM: e3 WWW: http://www.sax.de/~adlibit/
Figure 10-16. E3. EE Intended to be an editor that novices can begin using immediately, the Easy Editor features pop-up menus and is based on aee, described previously. DEB: ee WWW: http://mahon.cwx.net/
266
Elvis
Elvis is a modern implementation of Vi that comes with many new features and extensions. DEB: elvis RPM: elvis WWW: http://elvis.vi-editor.org/
Figure 10-18. Elvis. Emacs Emacs is one of the two most popular text editors. A section all about it located earlier in this chapter (see Recipe 10.1 [Using Emacs], page 232). DEB: emacsen-common emacs21 RPM: emacs WWW: http://www.emacs.org/
267
Glimmer Intended for use with computer programming languages, it has many features that appeal to programmers. DEB: glimmer RPM: glimmer WWW: http://glimmer.sourceforge.net/
Figure 10-20. Glimmer. JED John E. Daviss editor oers many of the conveniences of Emacs and is geared specically toward programmers. Features unique to it include drop-down menus that work in terminals; jed loads quickly, and makes editing les at a shell prompt easy and fast. DEB: jed RPM: jed WWW: http://www.jedsoft.org/jed/
268
JOE
Joes Own Editor, joe, is a full-screen editor with a look and feel reminiscent of the old dos text editors, such as edit. DEB: joe RPM: joe WWW: http://sourceforge.net/projects/joe-editor/
Figure 10-22. Joes Own Editor. Le A multi-lingual editor for use in a terminal, with support for operating on rectangular blocks of text. DEB: le RPM: le WWW: http://tinyurl.com/23325
269
MCedit
This is the full-screen terminal editor that comes with the Midnight Commander. DEB: mc-common mc RPM: mc WWW: http://www.ibiblio.org/mc/
Figure 10-24. Midnight Commanderx. Nano Gnu Nano is a free software editor inspired by pico, the editor that is included with the University of Washingtons proprietary pine email program. Its also faster than pico, and comes with more features. DEB: nano RPM: nano WWW: http://www.nano-editor.org/
270
Ted
Ted is a wysiwyg, typewriter-like text editor for use in X. It reads and writes rtf les (Microsofts Rich Text Format). DEB: ted RPM: Ted WWW: http://www.nllgg.nl/Ted/
Figure 10-26. Ted. THE The Hessling Editor (the) is a congurable editor that uses the Rexx macro language. It was inspired by the xedit editor for vm/cms and the Kedit editor for dos. DEB: the the-doc RPM: THE WWW: http://hessling-editor.sourceforge.net/
271
Vi
Vi is a visual, or full-screen, editor. It is probably the most popular editor on Linux, and on unix-based systems in general. Touch typists often nd its keystroke commands enable very fast editing. A section all about it is located earlier in this chapter (see Recipe 10.2 [Using Vi], page 244). DEB: nvi RPM: nvi WWW: http://www.bostic.com/vi/
Figure 10-28. Vi. Vim Like the Elvis editor, Vim (Vi improved) is a modern implementation of Vi; it has more commands and versatility, and new features include syntax coloring, scrollbars and menus, mouse support, and built-in help. DEB: vim RPM: vim WWW: http://www.vim.org/
272
Wily
Wily, an interesting mouse-centric editor, is inspired by the Acme editor from at&ts Plan 9 experimental operating system. Wily commands consist of various combinations of the three mouse buttons, called chords. DEB: wily WWW: http://www.cs.yorku.ca/~oz/wily/
Figure 10-30. Wily. Xcoral A mouse-centric text editor for X that uses multiple windows. DEB: xcoral RPM: xcoral WWW: http://xcoral.free.fr/
273
Xedit
Xedit is a simple text editor that comes with, and works in, X. It lets you insert, delete, copy, and paste text as well as open and save lesthe very basics. DEB: xbase-clients RPM: XFree86 WWW: http://www.xfree86.org/
Figure 10-32. Xedit. XEmacs XEmacs is a version of Emacs with advanced capabilities for use in X, including the ability to display images. DEB: emacsen-common xemacs21 RPM: xemacs WWW: http://www.xemacs.org/
274
275
NOTES: If you are using the wrong word to begin with, none of the computerized spell-check tools will correct this errorfor example, if you have there when you mean their, the computer cannot catch it (yet!).
On an increasing number of systems, this le is being replaced with /usr/share/dict/words; administrators should make a symbolic link from this to the shorter, preferred form. In other words, they are correct whether they appear entirely in lowercase letters, capitalized, or entirely in uppercase letters.
276
In this example, spell echoed the word occurance, meaning that this word was not in the system dictionary and therefore was quite likely a misspelling. Then, CTRL - D was typed to exit spell.
In this example, three words are output: occurance, willl, and occurance again, meaning that these three words were found in falllecture.draft, in that order, and were not in the system dictionary (and so were probably misspelled). Note that the misspelling occurance appears twice in the le. To correct the misspellings, you could then open the le in your preferred text editor and edit it. Later in this section, Ill describe an interactive spell checker that allows you to correct misspellings as they are found. Still another option is to use a text editor with spell-checking facilities built in, such as Emacs. To spell-check the le fall-lecture.draft, and output any possibly misspelled words to a le fall-lecture.spelling, type:
$ spell fall-lecture.draft > fall-lecture.spelling RET
277
In this example, the standard output redirection operator (>) is used to redirect the output to a le (see Recipe 3.2.2 [Redirecting Output to a File], page 68). To output an alphabetical list of the misspelled words, pipe the output to sort; then pipe the sorted output to the uniq lter to remove duplicates from the list (uniq removes duplicate adjacent lines from its input, outputting the unique lines). To output a sorted list of the misspelled words that are in the le falllecture.draft, type:
$ spell fall-lecture.draft | sort | uniq RET
NOTES: You can also add (or remove) words by manually editing the le with a text editor, but take care to keep the list in alphabetical order!
3
If a word is reasonably universal, you may, of course, contact the global maintainers of wenglish or other appropriate packages, and try to convince them that said word ought to be included. On newer systems, this le is sometimes replaced by ~/aspell_default.
278
Over time, personal dictionaries begin to look very personal, as a reection of their owners; Gregory Cosmo Haun made a work of conceptual art by photographing the portraits of a dozen users superimposed with listings of their personal dictionaries [http://www.reed.edu/~cosmo/art/DictPort.html].
When you type this, ispell begins checking the le. It stops at the rst misspelling it nds, as in Figure 11-1. On the top line of the screen, ispell displays the misspelled word, followed by the name of the le. Underneath this is the sentence in which the misspelling appears, with the word in question highlighted. Following this is a list of suggested words, each oset by a numberin this example, ispell has only one suggestion: lectures. To replace a misspelling with a suggested word, type the number that corresponds to the suggested word (in this example, you would type 0 to replace the misspelling with lectures). You only need to type the number of your selectiona RET is not required.
5
aspell is designed to be a drop-in replacement for ispell, with greatly improved suggestion algorithms. If your system has aspell, use it instead; it otherwise works like ispell.
279
Figure 11-1. A misspelling caught by ispell. You can also type a correction yourself; this is useful when ispell either oers no suggestions, or when it does and the word you want is not one of them. To do this, type r (for replace) and then type the replacement word, followed by RET . Sometimes, ispell will question a word that you may not want to count as a misspelling, such as proper names and the likewords that dont appear in the system dictionary. There are a few things you can do in such cases, as follows. To accept a misspelled word as correct for the current ispell session only, type a; from then on during the current session, this word will be considered correct. If, however, you want ispell (and spell, and all other tools that access the system dictionary) to remember this word as being correct for this and all future sessions, insert the word in your own personal dictionary. Type u to insert a copy of the word uncapitalized, in all lowercase lettersthis way, even if the word is capitalized at the beginning of a sentence, the lowercase version of the word is saved. From then on, in the current ispell session and in future sessions, this word will be considered correct whether it appears entirely in lowercase letters, capitalized, or entirely in uppercase letters. When case is important to the spellingfor example, in a word that is a proper name such as Seattle, or a word with mixed case, such as DeSalletype i to insert a copy of the word in your personal dictionary with its case just as it appears; this way, words spelled with the same letters but with dierent cases will be considered misspellings. When ispell nishes spell-checking a le, it saves its changes to the le and then exits. It also makes a copy of the original le, without the changes
280
applied; this le has the same name as the original but with .bak added to the endin our example, the backup le is called fall-lecture.notes.bak. This is useful if you regret the changes youve made and want to restore the le to how it was before you mucked it upjust remove the spell-checked le and then rename the .bak le to its original name. The following table is a reference to the ispell key commands, listing the keys and describing their actions.
SPACEBAR
Accept misspelled word as correct, but only for this particular instance. Replace misspelled word with the suggestion that corresponds to the given number. Display a help screen. Accept misspelled word as correct for the remainder of this ispell session. Accept misspelled word as correct and add it to your private dictionary with the capitalization as it appears. Look up words in the system dictionary according to a pattern you give. Quit checking and restore the le to how it was before this session. Replace misspelled word with a word you type. Accept misspelled word as correct and add it to your private dictionary in all lowercase letters. Save changes made so far, and then stop checking this le.
number ? a i
l q r u x
281
The rst command, ispell-word, checks the spelling of the word at point; if there is no word at point, it checks the rst word to the left of point. This command has a keyboard shortcut, ALT - $ . The second command, ispellregion, checks the spelling of all words in the currently selected region of text. The third command, ispell-buffer, checks the spelling of the entire buer. Here are some ways to use this. To check the spelling of the word at point, type:
ALT - X
ispell-word RET
To check the spelling of all words in the currently selected region of text, type:
ALT - X
ispell-region RET
ispell-buffer RET
Another useful Emacs spelling feature is flyspell-mode. When this mode is set in a buer, any misspelled words in the buer are highlighted. This mode is useful when you are writing a rst draft, because it lets you catch misspellings as you type them. To turn on flyspell-mode in a buer, type:
ALT - X
flyspell-mode RET
NOTES: This mode is a toggle; run it again to turn it o. To correct a word in flyspell-mode, click and release the middle mouse button on the word to pull up a menu of suggestions; you then use the mouse to select the replacement word or add it to your personal dictionary. If there are words you frequently misspell, you can dene abbrevs for them (see Recipe 10.1.5 [Making Abbreviations in Emacs], page 242). Then, when you type the misspelled word, Emacs will automatically replace it with the correct spelling. Finally, if you prefer the sparse, non-interactive interface of spell, you can use the Emacs interfaces to that command instead: spell-word, spellregion, and spell-buffer. When any of these functions nd a misspelling, they prompt for a replacement in the minibuer but do not oer suggestions or provide any of ispells other features.
282
Figure 11-2. The WordNet browser. Between the dialog box and the output window, there are menus for searching for synonyms and other word senses. A separate menu is given for each
283
part of speech a word may have; in the preceding example, the word browse can be either a noun or a verb, so two menus are shown. To get a list of all word sense information available for a given word, run wn with the word as an argument. This outputs a list of all word sense information available for the word, with each possible sense preceded with the name of the option to use to output it. To output a list of word senses available for the word browse, type:
$ wn browse RET
The following sections show how to use wn on the command line. NOTES: For more information on WordNet, consult the wnintro man page (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46).
This command outputs words like homeward and homework. Since the system dictionary is an ordinary text le, you can also use grep to search it for words that match a given pattern or regular expression (see Recipe 14.3 [Matching Patterns of Text], page 335). Here are some ways to use this. To list all words in the dictionary that contain the string dont, regardless of case, type:
$ grep -i dont /usr/dict/words RET
To list all words in the dictionary that end with ing, type:
$ grep ing^ /usr/dict/words RET
To list all of the words that are composed only of vowels, type:
$ grep -i '^[aeiou]*$' /usr/dict/words RET
To nd some words that rhyme with a given word, use grep to search /usr/dict/words for words ending in the same last few characters as the
284
word they should rhyme with (see Recipe 14.4.2 [Matching Lines Ending with Certain Text], page 343). To output a list of words that rhyme with friend, search /usr/dict/words for lines ending with end:
$ grep 'end$' /usr/dict/words RET
Finally, to do a search on the WordNet dictionary, use wn with one of the -grep options. When you give some text to search for as an argument, this command does the equivalent search as look, but only the particular kind of word sense you specify is searched: -grepn searches nouns, -grepv searches verbs, -grepa searches adjectives, and -grepr searches adverbs. You can combine options to search multiple word senses. Here are two ways to use this. To search the WordNet dictionary for nouns that begin with homew, type:
$ wn homew -grepn RET
To search the WordNet dictionary for both nouns and adjectives that begin with homew, type:
$ wn homew -grepn -grepa RET
NOTES: If you look up dictionary denitions frequently enough, it is handy to have an alias of def dened as wn $1 -over (see Recipe 3.6.1 [Calling a Command by Some Other Name], page 83).
285
Here are two ways to use this. To output all of the synonyms for the noun break, type:
$ wn break -synsn RET
286
There are a number of specialized dictionaries available from the dict Development Group as well. These dictionaries are plain text les. One such dictionary is called file, The Free Internet Lexicon and Encyclopedia. It is an eort to build a free, open source collection of modern-word, idiom, and jargon dictionaries. file is a volunteer eort and depends on the support of scholars and lexicographers; the dict pages contain information on how to help contribute to this worthy project.
There was also a set of tools for formatting text called the Documenters Workbench (dwb), and there was a planned Readers Workbench; today, we can only guess at what that might have been.
287
According to The UNIX Environment (see Appendix D [References for Further Interest], page 731), the diction tool that came with the old Writers Workbench just found the phrases, and a separate command called suggest would output suggestions. In the gnu version that works for Linux systems, both functions have been combined in the single diction command. In gnu diction, the words or phrases are enclosed in brackets [like this]. If diction has any suggested replacements, it gives them preceded by a right arrow, -> like this. When checking more than just a screenful of text, youll want to pipe the output to less so that you can peruse it on the screen (see Recipe 9.1 [Perusing Text], page 211), or pipe the output to a le for later examination. Here are two ways to use this. To check the le dissertation for clichs or other misused phrases, e type:
$ diction dissertation | less RET
To check the le dissertation for clichs or other misused phrases, e and write the output to a le called dissertation.diction, type:
$ diction dissertation > dissertation.diction RET
If you dont specify a le name, diction reads text from the standard input until you type CTRL - D on a line by itself. This is especially useful when you want to check a single sentence, as in Figure 11-3.
$ diction RET Let us ask the question we wish to state. RET (stdin):1: Let us [ask the question -> ask] [we wish to state -> (cliche, avoid)]. CTRL - D $
Figure 11-3. Checking a sentence with diction. To check the text of a Web page, use lynx with the -dump and -nolist options to output the plain text of a given url, and pipe this output to diction. (If you expect there to be a lot of output, add another pipe at the end to less so you can peruse it.) To peruse the url http://www.westegg.com/cliche/random.cgi with markings for possible wordy and misused phrases, type (all on one line):
$ lynx -dump -nolist http://www.westegg.com/cliche/random.cgi | diction | less RET
288
NOTES: To check text for overused words, use the method described in Recipe 12.2.4 [Counting Word Occurrences in Text], page 299.
Like diction, style reads text from the standard input if no text is giventhis is useful for the end of a pipeline, or for checking the writing style of a particular sentence or other text you type. The sentence characteristics of the text that style outputs are as follows: Number of characters Number of words, their average length, and their average number of syllables Number of sentences and average length in words Number of short and long sentences Number of paragraphs and average length in sentences Number of questions and imperatives The various readability formulas that style uses and outputs are as follows:
289
Kincaid formula, originally developed for Navy training manuals; a good readability test for technical documentation Automated Readability Index (ari) Coleman-Liau formula Flesch Reading Ease Score, which gives an approximation of readability from 0 (dicult) to 100 (easy) Fog Index, which gives a school-grade reading level wstf Index, a readability indicator for German documents Wheeler-Smith Index, Lix formula, and smog-Grading tests, all readability indicators that give a school-grade reading level
To get an idea how the ari ranks text, see its rankings for various popular Web sites at http://www.readability.info/commonscores.shtml.
290
291
North American (+1) telephone area codes. Precedence table for operators in the c programming language. Postal codes for U.S. and Mexican states and Canadian provinces. The Constitution of the United States of America and its twenty-seven Amendments (the rst ten are the Bill of Rights). On Debian systems, this le is placed in a directory named /usr/share/state. The Declaration of Independence of the Thirteen Colonies. On Debian systems, this le is placed in a directory named /usr/share/state. Indexes of Internet standardization Request For Comments (rfc) documents. On Debian systems, this le is placed in /usr/share/rfc. U.S. ve-digit Zip Codes.
us-declaration.gz
rfc-index.txt
zipcodes.gz
But miscfiles is not the only reference package available for Linux; other related packages include the following:
doc-iana
Internet protocol parameter registry documents, as published by the Internet Assigned Numbers Authority. DEB: doc-iana The Jargon File is the denitive dictionary of hacker slang, and goes back decades. Might be considered somewhat dated today; is no longer distributed as a single le. DEB: jargon-text RPM: jargon WWW: http://www.jargon.org/ Extensive list of computer acronyms. DEB: vera RPM: vera WWW: ftp://ftp.gnu.org/gnu/vera/
Jargon File
V.E.R.A.
292
NOTES: The ocial gnu miscfiles distribution also includes the Jargon File and the /usr/dict/words dictionary le, which are available in separate packages for Debian, and are removed from the Debian miscfiles distribution. On Debian systems, /usr/dict/words is part of the standard spelling packages, and the Jargon File comes in the optional jargon package and installs in /usr/share/jargon.
Typing wtf is lol produces an identical result. NOTES: While wtf is useful for decoding the acronyms of online writing, it doesnt know anything outside of this scope. So it cant tell you, for instance, what laser stands for (but the WordNet dictionary cansee Recipe 11.2 [Using Dictionaries], page 282), although it will tell you all about how ymmv even when you do rtfb, so you see it is nbd. Other collections of acronyms are available with the miscfiles collection (see Recipe 11.4.1 [Consulting Word Lists and Helpful Files], page 290).
293
When you specify more than one le, wc lists counts for each of the les and then gives total counts for all of them. To output the number of lines, words, and characters for all the les with a .txt le name extension in the current directory, type:
$ wc -w *.txt RET
To only output a combined count for several les, rst concatenate the les with cat, and then pipe the output to wc (for more about concatenating with cat, see Recipe 10.6 [Concatenating Text], page 256). To output the combined number lines, words, and characters for all the les with a .txt le name extension in the current directory, type:
$ cat *.txt | wc -w RET
Most of the following recipes for counting text use wc. NOTES: You can get a count of how many dierent words are in a text, too use the method described in Recipe 12.2.3 [Listing Only the Unique Words in Text of a Text], page 298, and pipe the output to wc. To count the average length of words, sentences, and paragraphs, use style (see Recipe 11.3.3 [Checking Text for Readability], page 288).
294
NOTES: This counts the number of words in a text; to count the number of times a word occurs, see Recipe 12.2 [Listing Words in Text], page 297.
METHOD #2 The count-lines-page function in Emacs outputs in the minibuer the number of lines on the current page (as delimited by pagebreak characters, if anysee Recipe 13.3 [Paginating Text], page 312), followed by the number of lines in the buer before the line that point is on, and then the number of lines in the buer after point. To count the number of lines per page in the current buer in Emacs, type:
CTRL - X
295
Emacs outputs the number of lines per page of the current buer in the echo area. For example, suppose the output in the minibuer is this:
Page has 351 lines (69 + 283)
This means that the current page contains 351 lines, and point is on line number 70there are 69 lines before this line and 283 lines after it.
To nd the number of lines in all of the les with a .txt extension in the /usr/share/doc/ directory tree that contain the string chapter, regardless of case, type:
$ grep -r -i chapter /usr/share/doc/ | wc -l RET
NOTES: This method is quick and easy, but it will not count more than one occurrence on the same line, and it wont nd occurrences that are broken by the end of a line. For more recipes for searching text, and more about grep, see Chapter 14 [Searching Text], page 333.
296
Here are two ways to use this. To count the number of characters, lines and words in a selection of text in the rst virtual console, do the following: 1. Switch to the second virtual console:
ALT - F2
4. Select the text to be counted by moving the mouse pointer to the beginning of it, pressing and holding the left button and dragging the pointer to the end of the text, and then letting go of the mouse button. 5. Switch back to the second virtual console:
ALT - F2
6. Click the middle mouse button. 7. Type CTRL - D to stop inputting text to wc.
To count the words in a selection of text on a Web page when you are in X, do the following: 1. Start wc in a terminal window:
$ wc -w RET
2. Select the text to be counted by moving the mouse pointer to the beginning of it in the browser window, pressing and holding the left button and dragging the pointer to the end of the text, and then letting go of the mouse button. 3. Move the mouse pointer to where the cursor is in the terminal window, and click the middle mouse button. (If you do not have a three-button mouse, click both the left and right buttons at the same time.) 4. Type CTRL - D in the terminal window.
297
To remove all of the punctuation from the listed words, pipe the output to another tr that deletes it. To peruse a list containing all of the words from the text le book as they appear in the text, but with punctuation removed, type:
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | less RET
Dashes are not removed with punctuation. If the text to lter contains em dashes consisting of two hyphens (--) with no spaces between the words on either side of the dashes, rst lter them out by with sed, replacing them with a space character (see Recipe 10.5 [Editing Streams of Text], page 255). Then pass that ltered text to tr.
298
To peruse a list containing all of the words from the text le book as they appear in the text, but with punctuation removed, type (all on one line):
$ sed 's/--/ /g' book | tr -s '[:blank:]' '\n' | tr -d '[:punct:]' | less RET
NOTES: If there is any whitespace before the rst word in the input, this method inserts a newline character at the beginning of the output. To remove it, add tail +2 to the end of the pipeline but before you peruse or print it (see Recipe 9.2.3 [Displaying the End Part of Text], page 218).
To peruse a list containing all of the words from the text le book sorted numerically, type:
$ tr -s '[:blank:]' '\n' < book | sort -n | less RET
This method is case-sensitive. To sort words regardless of case, rst convert all uppercase letters to lowercase by piping to tr again before sort (see Recipe 13.4.1 [Changing Characters in Text], page 317). To peruse a list containing all of the words from the text le book with punctuation removed, sorted alphabetically regardless of case, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | sort | less RET
299
Here are some ways to use this. To peruse a list containing all of the words from the text le book with punctuation removed, sorted alphabetically with duplicates removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq | less RET
To peruse a list containing all of the words from the text le book with punctuation removed, sorted alphabetically regardless of case, and with duplicates removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | sort | uniq | less RET
To peruse a list containing all of the words from the text le book sorted numerically, but with all duplicates removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | sort -n | uniq | less RET
300
To peruse a listing of all the words from the text le book with punctuation removed, sorted by their frequency regardless of case, listed with their number of occurrences and beginning with the most frequent, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -n -r | less RET
METHOD #2 To get the total number of dierent words in a text, use the method for listing unique words as described in the previous recipe, and pipe the output to wc with the -l option. This counts all the lines of its inputwhich in this case will be the list of unique words, one per line. To output a total count of the number of unique words in the text le book, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq | wc -l RET
To list the frequency of the words contents and index as they appear in the text le book with punctuation removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq -c | sort -n -r | grep 'contents\|index' RET
To list the frequency of the words ending in ing as they appear in the text le book with punctuation removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq -c | sort -n -r | grep 'ing$' RET
301
To search on the number of occurrences, grep for numbers that occur at the beginning of the line after any number of space characters and followed by a tab character (quote a tab to grep as CTRL - V ; see Recipe 3.1.2 [Typing a Control Character], page 55). Here are two ways to do this. To list the words that occur ten times in the text le book with punctuation removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq -c | sort -n -r | grep '^[ ]*10 CTRL - Q CTRL - V ' RET
To list the words that occur between eighty and eighty-ve times in the text le book with punctuation removed, type (all on one line):
$ tr -s '[:blank:]' '\n' < book | tr -d '[:punct:]' | sort | uniq -c | sort -n -r | grep '^[ ]*8[0-5] CTRL - Q CTRL - V ' RET
302
consist entirely of exactly identical lines). To specify the threshold value, give a number from 0 to 100 as an option after the two le names. To ignore exact duplicates, give a fourth option. This can be any value or character, so long as its there. Here are some ways to use this. To output a list of any lines in the les invitations and addresses that are similar to each other, type:
$ compare invitations addresses RET
To output a list of any lines in the les weddings and parties that match with a threshold level of 85 percent similarity, type:
$ compare weddings parties 85 RET
To output a list of any lines in the les invitations and addresses that are similar to each other, but not output exact duplicates, type:
$ compare invitations addresses 50 1 RET
NOTES: This tool has many handy uses. Use it whenever you might search for close similarities, but not necessarily identical strings, in two samples of text. For example, comparing catalog or sale lists with collector wish lists; detecting plagiarism and authorship; and comparing reading lists. Its author uses it to nd and identify allusions in works of literature.
r t
303
When remembrance-agent is running, suggested buers will be displayed in the small *Remembrance* buer at the bottom of the screen. To open a suggestion in a new buer, type CTRL - C r number, where number is the number of the suggestion. To open the second suggested le in a new buer, type:
CTRL - C
r 2
304
305
METHOD #2 Use cat with the -s option to squeeze multiple adjacent blank lines into one. To output the le term-paper with multiple blank lines output as only one blank line, type:
$ cat -s term-paper RET
306
METHOD #3 You can combine both of these commands to output text with multiple adjacent lines removed and with uniform spacing between words. The following example sends the output of the combined commands to less so that it can be perused on the screen. To peruse the text le term-paper with multiple blank lines removed and giving the text uniform spacing between words, type:
$ cat -s term-paper | fmt -u | less RET
Notice that in this example, both fmt and less worked on their standard input instead of on a lethe standard output of cat (the contents of termpaper with extra blank lines squeezed out) was passed to the standard input of fmt; its standard output (the space-squeezed term-paper, now with uniform spacing) was sent to the standard input of less, which displayed it on the screen.
This command outputs all lines that are not emptyso lines containing only non-printing characters, such as spaces and tabs, will still be output. METHOD #2 To remove from the output all empty lines, and all lines that consist of only space characters, use grep with [^ ]. as the regexp to search for. To output only the lines from the le term-paper that contain more than just space characters, type:
$ grep '[^ ].' term-paper RET
307
NOTES: This regexp will still output lines that contain only tab characters. METHOD #3 To remove from the output all empty lines, and lines that contain only a combination of tab or space characters, use grep with [^[:space:]]. as the regexp to search for. It uses the special predened [:space:] regexp class, which matches any kind of space character at all, including tabs. To output only the lines from the le term-paper that contain more than just space or tab characters, type:
$ grep '[^[:space:]].' term-paper RET
METHOD #4 If a le is double-spaced, where all even lines are blank, you can remove those lines from the output by using sed with the n;d expression. To output only the odd lines from le term-paper, type:
$ sed 'n;d' term-paper RET
To double-space the le term-paper and send the output directly to the printer for printing, type:
$ pr -d -t term-paper | lpr RET
NOTES: The pr (print) tool is a text pre-formatter, often used to paginate and otherwise prepare text les for printing; more discussion on the use of this tool is in Recipe 13.3 [Paginating Text], page 312.
308
To triple-space the le term-paper and write the output to the le termpaper.print, type:
$ sed 'G;G' term-paper > term-paper.print RET
The G expression appends one blank line to each line of seds output; using ; you can specify more than one blank line to append (but you must quote this command, because the semicolon (;) has meaning to the shellsee Recipe 3.1.3 [Quoting Reserved Characters], page 56). You can use multiple G characters to output text with more than double or triple spaces. To quadruple-space the le term-paper, and write the output to the le term-paper.print, type:
$ sed 'G;G;G' term-paper > term-paper.print RET
NOTES: sed is described in Recipe 10.5 [Editing Streams of Text], page 255.
Use the -w option to specify the maximum line width, in characters. To output the le term-paper with lines up to 80 characters long, type:
$ fmt -w 80 term-paper RET
309
To output the le owners-manual with a 5-space (or 5-column) margin to a new le, owners-manual.pr, type:
$ pr -t -o 5 -w 77 owners-manual > owners-manual.pr RET
This command is almost always used for printing, so the output is usually just piped to lpr instead of being saved to a le. Many text documents have a width of 80 and not 72 columns; if you are printing such a document and need to keep the 80 columns across the page, specify a new width of 85. If your printer can only print 80 columns of text, specify a width of 80; the text will be reformatted to 75 columns after the 5-column margin. Here are two ways to use this. To print the le owners-manual with a 5-column margin and 80 columns of text, type:
$ pr -t -o 5 -w 85 owners-manual | lpr RET
To print the le owners-manual with a 5-column margin and 75 columns of text, type:
$ pr -t -o 5 -w 80 owners-manual | lpr RET
To convert only initial tab characters to spaces in le list, and write the output to the standard output, type:
$ expand -i list RET
To convert multiple space characters to tabs, use unexpand. By default, it only converts leading spaces into tabs, counting eight space characters for each tab. Use the -a option to specify that all instances of eight space characters be converted to tabs.
310
Here are two ways to use this. To convert every eight leading space characters to tabs in le list2, and write the output to list, type:
$ unexpand list2 > list RET
To convert all occurrences of eight space characters to tabs in le list2, and write the output to the standard output, type:
$ unexpand -a list2 RET
To specify the number of spaces to convert to a tab, give that number as an argument to the -t option. To convert every leading space character to a tab character in list2, and write the output to the standard output, type:
$ unexpand -t 1 list2 RET
NOTES: You can also use col with the -x option to turn all tabs in its input to spaces.
To replace the newline character with some other character, use tr, giving the newline character as the rst quoted set, and the character to replace it with as the second. To take the text in the le many and replace any newlines with a formfeed, and then send the output to the printer, type:
$ tr '\n' '\f' < many | lpr RET
311
that is typed); in some operating systems, lines end with both a newline character and a carriage return character (represented by \m). This shows up as ^M in a le. Remove them with col. To process a le named operating_plan.txt, ltering out any carriage returns from the text, and writing this ltered text to a new le called operating_plan, type:
$ col < operating_plan.txt > operating_plan RET
You can then view the literal characters of both the raw and the processed les to see that the carriage returns, displayed as \r in the raw le, are gonesee Recipe 9.2.6 [Displaying the Literal Characters of Text], page 221.
NOTES: The brackets contain two characters: a space and a tab. In order to pass the literal tab to this command, you do a verbatim insert by rst typing CTRL - V and then the key you wantin this case, TAB .
312
To center-justify the text in the le log using eighty columns, and write it to a new le called log2, type:
$ tr -d '\n' < log | fold -w80 > log2 RET
There are many options that you can use to customize the output of text you paginate.
313
NOTES: Its also common to use pr to change the spacing of text (see Recipe 13.1 [Spacing Text], page 305).
NOTES: If a page has more lines than a printer can t on a physical sheet of paper, it will automatically break the text at that line as well as at the places in the text where there are formfeed characters.
Use the -t option to omit the header and footer on each page entirely, and use -T to omit the header, footer, and any formfeed characters that are in the le.
314
To paginate the text in the le listings with no headers or footers, but retaining any existing formfeeds, type:
$ pr -t listings RET
NOTES: There is currently no pr option to place headers on all but the rst page, so if you need to format text in this common convention, rst use pr to output to a le without headers, then use pr to output to another le with the headers you want for the remaining pages. Then, use a text editor to combine the rst page of the former with the remaining pages of the latter.
To paginate columns from multiple les, use -m. The contents of the les given as arguments are output together, each in its own column. To output the text in col.1, col.2, and col.3 in paginated columns with no headers, and with pages separated by formfeeds, outputting to a le called comparisons, type:
$ pr -t -f -m col.1 col.2 col.3 > comparisons RET
Columns are made to t pages of 72-character line widths; the columns are truncated to t this size unless you give the -J option, which makes columns big enough to t the text, regardless of line width. To print the le results.data in six columns and not truncating long lines, type:
$ pr -6 -t -J results.data | lpr RET
To t the columns on a line width that is between 72 and 79 characters, rst calculate the character length of an individual column by dividing the line width by the number of columns to use. Format the entire text for that length using fmt, giving the column length you calculated as an argument to the -w option. Pipe the output of that command to pr. To print the contents of the le editorial in two columns to t on 72character lines, type:
$ fmt -w 36 editorial | pr -2 | lpr RET
315
Use the -a option to output in rows (columns running across the page) instead of columns running down. To output the text in col.1, col.2, and col.3 in paginated columns going across, outputting to a le called comparisons, type:
$ pr -a -m col.1 col.2 col.3 > comparisons RET
To output to the printer the paginated contents of the le sales.feb, beginning at page 80, and with a header containing the text DRAFT COPY, type:
$ pr +80 -h "DRAFT COPY" sales.feb | lpr RET
NOTES: You can also use head or tail to display only a certain part of the text, such as an ending or a middle part, and pipe that to pr for pagination (see Recipe 9.2 [Displaying Text], page 216).
316
To paginate figures with control characters in hat notation and all non-printing characters in octal notation, type:
$ pr -c figures RET
317
A set can be a character class, which is a predened set of characters, as described in the following table. To specify a character class in a set, use [:class:], where class is the name of the class. alnum alpha blank cntrl digit graph lower print punct space upper xdigit All letters and digits. All letters. Blank spacestab and space characters. Control characters. Digits. All printing characters, excepting blank space. All lowercase letters. All printing characters, including blank space. Punctuation marks. Blank space. All uppercase letters. All hexadecimal digits.
There are many examples of tr elsewhere in this chapter and throughout this book, and there are many ways tr can be used in conjunction with other tools. The following recipes describe its basic functions.
To output the contents of the le CAPS, translating all uppercase letters to their lowercase equivalents, type:
$ tr A-Z a-z < CAPS RET
318
To output the contents of the le CAPS, translating all uppercase letters to their lowercase equivalents, type:1
$ tr [:upper:] [:lower:] < CAPS RET
To output the contents of the le CAPS, translating all uppercase letters from M to S as hyphen characters, type:
$ tr M-S - < CAPS RET
To output the contents of the le transmission, translating all newline characters to a forward slash character (/) and all Control-G characters to an asterisk character (*), type:
$ tr "\n\a" "/\*" < transmission RET
In this example, only one set is given; any characters in that set that repeat are squeezed into a single instance of the character. Use two sets to replace a set of repeated characters with some other set. To output the contents of the le moo, with all repeated o and O characters replaced by one instance of e or E, type:
$ tr -s oO eE < moo RET
In the preceding example, any repeated characters other than o and O are untouched, as are any o and O characters that are not repeated.
This example is equivalent to the previous example; one species text with a range and another with a character class, but both produce the same result.
319
Use the -i option to ignore case when making comparisons. To output the contents of the le options, with all duplicate lines ltered out, regardless of case, type:
$ uniq -i options RET
To output only the lines that have duplicates, use the -d option. To output only the lines that have duplicates, plus every instance of each duplicate line, use -D instead. Here are two ways to use this. To output only the lines in the le options that have duplicates, but not the duplicates themselves, type:
$ uniq -d options RET
To output all of the lines in the le options that have duplicates, and all the duplicates themselves, type:
$ uniq -D options RET
To output lines preceded by a count telling how many instances exist of that line, use the -c option. To output all of the lines in the le options, each preceded by a count of the number of instances of that line, type:
$ uniq -c options RET
METHOD #2 To lter out unique lines in some unsorted text, use sort with the -u option. This sorts the input lines alphabetically and runs uniq on them.
320
Figure 13-1. The provinces le. Here are two ways to use this. To sort the le provinces and output all lines in ascending order, type:
$ sort provinces RET Fukien Honan Hunan Kiangsu Kwangtung Shantung Szechwan $
321
To sort the le provinces and output all lines in descending order, type:
$ sort -r provinces RET Szechwan Shantung Kwangtung Kiangsu Hunan Honan Fukien $
To write the output to a le, give the le name as an argument to the -o option. To sort the le provinces and write all lines in descending order to the le provinces.sorted, type:
$ sort -r -o provinces.sorted provinces RET
Use the -i option to ignore all spaces and all non-printing characters. To sort the text in le orders, ignoring any preceding blank spaces and non-printing characters, type:
$ sort -i orders RET
322
To specify a dierent delimiter, give it as an argument to the -d option. To paste the contents of the les bases and reactants together in columns, separated by a plus sign (+), type:
$ paste -d "+" bases reactants RET
323
By default, the rst eld is used in both les. To specify the eld for the rst le, use the -1 option and give the number of the eld to use as an argument; to specify the eld for the second le, use -2. To output the contents of the sorted les march.stats and april.stats, joining by the third column in the rst le and the second column in the second le, type:
$ join -1 3 -2 2 march.stats april.stats RET
Columns are lled before rows. That is, the input lines run down the rst column, and then down the next, and so on. To have the input lines ll across the rows instead, use the -x option.2
Some versions have documentation stating the opposite of this eect, but the program works this way in practice.
324
To write the contents of the le years.list to a le called years, written in columns of lines not longer than 80 characters and lling each row before advancing to the next, type:
$ column -x years.list > years RET
To specify the number of characters to put in each line, give it as an argument to the -c option. To columnate the text in the le YearEnd.Financials with a line length of 120 characters, and output it to the printer named finance, type:
$ column -c120 < YearEnd.Financials | lpr -Pfinance RET
To output the second and fourth elds from the le bank-statement, type:
$ cut -f2,4 bank-statement RET
To output the rst and the third through fth elds from the le bank-statement, type:
$ cut -f1,3-5 bank-statement RET
Fields are output from lowest to highest, no matter which order you specify them. If you specify a eld out of range for the input text, cut outputs a blank line for each line of input, and if cut can nd no eld at all in an input line, it outputs the entire line. Use -s to suppress the printing of lines that do not contain the selected eld. By default, cut counts elds as delimited by a tab character. To specify some other delimiter, give it as an argument to the -d option.
325
To output only the second eld from the le bank-statement, where elds are delimited by a space character, and suppress output of lines not containing this eld, type:
$ cut -d " " -f2 bank-statement RET
Fields are output with the same delimiter used in the input. To specify a dierent delimiter for the output, give it as an argument to the long-style option --output-delimiter. To take the third through fth elds from the le bank-statement, where elds are delimited by a space character, and output them delimited by tab characters, type:
$ cut -d " " -f3-5 --output-delimiter CTRL - V bank-statement RET
TAB
To specify bytes or characters in place of elds, use the -b and -c options, respectively. To output the rst, third, fth, and seventh characters from each line in the le bank-statement, type:
$ cut -c1,3,5,7 bank-statement RET
METHOD #2 Use colrm to remove columns in text by their character positions. Given a number as an argument, colrm will remove all text on each line, beginning at that character position. To output only the rst two characters on each line of the le percentages, type:
$ colrm 3 < percentages RET
If you give an ending column as a second argument, colrm removes all columns from the rst to the second arguments, inclusive. The columns to the right of the ending column are brought over to join the column preceding the rst argument. To output the contents of the le amounts, removing the tenth through sixtieth characters on each line of text, and writing to a le called markdown, type:
$ colrm 10 60 < amounts > markdown RET
326
You can set the numbering style with the -b option followed by an argument. The following table lists the possible arguments and describes the numbering style they select. a t n pregexp Number all lines. Number only non-blank lines. (This is the default.) Do not number lines. Only number lines that contain the regular expression regexp (see Recipe 14.3 [Matching Patterns of Text], page 335).
The default is for line numbers to start with 1 and increment by 1. Set the initial line number by giving an argument to the -v option, and set the increment by giving an argument to the -i option. Here are two ways to use this. To output the le review with each line of the le preceded by line numbers, starting with the number 2 and counting by 4, type:
$ nl -v 2 -i 4 review RET
To number only the lines of the le cantos that begin with a period (.), starting numbering at 0 and using a numbering increment of 5, and writing the output to cantos.numbered, type:
$ nl -i 5 -v 0 -b p'^\.' cantos > cantos.numbered RET
327
METHOD #2 The other way to number lines is to use cat with one of the following two options: The -n option numbers each line of its input text, while the -b option only numbers non-blank lines. Here are two ways to use this. To peruse the text le citations with each line of the le numbered, type:
$ cat -n citations | less RET
To peruse the text le citations with each non-blank line of the le numbered, type:
$ cat -b citations | less RET
In the preceding examples, output from cat is piped to less for perusal; the original le is not altered. To take an input le, number its lines, and then write the line-numbered version to a new le, send the standard output of the cat command to the new le to write. To write a line-numbered version of le report to le report.lines, type:
$ cat -n report > report.lines RET
A method for printing les with this markup is described in Recipe 25.3.5 [Preparing Text for Printing], page 522. Another variation, though much less popular, is to use forward-slash characters, like /this/.
328
The following recipes are for placing, converting, or removing these dierent types of underlines in text.
To write the word stress with overstrike-style underlines when you are in input mode in Vi, type (all on one line):
E CTRL - V CTRL - H _N CTRL - V CTRL - H _D CTRL - V CTRL - H _
NOTES: For more information on inserting control characters in Emacs and Vi, see Recipe 10.1.4 [Inserting Special Characters in Emacs], page 239 and Recipe 10.2.4 [Inserting Special Characters in Vi], page 251, respectively.
329
You can convert one form to the other by using the Emacs replaceregular-expression function and specifying the text to be replaced as a regexp (see Recipe 14.3 [Regular ExpressionsMatching Text Patterns], page 335). Here are some ways to use this. To replace plaintext-style italics with TEX \it commands, type:
ALT - X replace-regular-expression RET _\([^_]+\)_ RET \{\\it \1} RET
Both of these examples use the special regexp symbol \1, which matches the same text matched by the rst \( ... \) construct in the previous regexp. NOTES: For more information on regexp syntax in Emacs, consult its Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
METHOD #2 To remove any text that is marked with underlines and not remove the underlines themselves, send the text to col with the -b option. This removes all of the characters to be underlined, and the backspace character (Control-H) that follows each one. The underline characters (_) are kept.
330
To output the le zim.bibliography with all underlined characters removed but all underlines kept, type:
$ col -b < zim.bibliography RET
NOTES: This is also good for removing overstrikes from text, where a character such as X is used in place of an underline.
Specify a dierent separator with the -s option. This is often useful when specifying non-printing characters, such as formfeeds. To specify such a character, use the ansi-c method of quoting (see Recipe 3.1.3 [Quoting Reserved Characters], page 56). To output prizes in page-for-page reverse order, type:
$ tac -s $'\f' prizes RET
The preceding example uses the formfeed, or page break, character as the delimiter, so it outputs the le prizes in page-for-page reverse order, with the last page output rst. Use the -r option to use a regular expression for the separator string (see Recipe 14.3 [Regular ExpressionsMatching Patterns of Text], page 335). You can build regular expressions to output text in word-for-word and character-for-character reverse order: Here are two ways to use this. To output prizes in word-for-word reverse order, type:
$ tac -r -s '[^a-zA-z0-9\-]' prizes RET
331
332
333
Use the -i option to ignore the case when looking for matches. To output lines in the le catalog containing cd, regardless of case, type:
$ grep -i cd catalog RET
This search matches any lines in catalog where the pattern cd is found, regardless of case. So it will match lines containing CD and cd, as well as any other variation in case, like Cd. However, this search also matches lines containing, say, the word anecdote, as well as words like CDROM or CDR, because grep matches patterns wherever they occur on a line. To specify that only whole words should count as matches, use grep with the -w option. This ignores matches that occur in the middle of a word. Only entire words will count as a pattern match, which means the patterns location must match two criteria: One, it must be either at the beginning of the line, or be directly preceded by non-letters and non-digits; and two, it must either be directly followed by non-letters or non-digits, or be at the end of the line. To output lines in the le catalog containing the word CD, type:
$ grep -w CD catalog RET
1
The origin of its name is explained in Recipe 14.3 [Regular ExpressionsMatching Patterns of Text], page 335, where its advanced usage is discussed.
334
In this example, only lines containing the word CD are printed; lines with words such as CDROM or anecdote are not printed unless they contain the word CD.2
The preceding example outputs all lines in the le catalog that contain the exact string Compact Disc; it will not match, however, lines containing compact disc or any other variation on the case of letters in the search pattern. Use the -i option to specify that matches are to be made regardless of case. To output lines in the le catalog containing the string compact disc regardless of the case of the letters, type:
$ grep -i 'compact disc' catalog RET
This command outputs lines in the le catalog containing any variation on the pattern compact disc, including Compact Disc, COMPACT DISC, and comPact dIsC. One thing to keep in mind is that grep only matches patterns that appear on a single line, so in the preceding example, if one line in catalog ends with the word compact and the next begins with disc, this command will not match either line. There is a way around this with grep (see Recipe 14.4.3 [Finding Phrases Regardless of Spacing], page 343), and there is a way to do it in Emacs (see Recipe 14.9.2 [Searching for a Phrase in Emacs], page 353). A search string may contain tab characters as well as space characters. To type a tab character in a quoted string, rst type CTRL - V and then type TAB (see Recipe 3.1.2 [Typing a Control Character], page 55). To output lines in screenplay containing the text In the beginning, only when directly preceded by a tab character, type:
$ grep ' CTRL - V
TAB In the beginning' screenplay RET
Some special characters have reserved meanings, and to search for them you must specify them in special ways, as described in the next recipe. The
2
However, the word CD-ROM would count as a match; grep considers the hyphen character to be a word separator, and thus sees CD-ROM as two words.
335
period character (.) is one such character. When searching for just strings, though, you can use the -F option to specify that the pattern you give is a xed string, with no special characters in it at all. fgrep is equivalent to grep with the -F option. It is one of two variations of grep assigned to perform a special purpose (the other is discussed below). Here are two ways to use this. To search the le screenplay for the phrase the end., regardless of case, type:
$ grep -F 'the end.' screenplay RET
To search the le screenplay for the phrase the end., regardless of case, type:
$ fgrep 'the end.' screenplay RET
The results of the two preceding examples are identical. To search for a string containing double quote characters, use single quotes to quote it, and vice versa. When the text you search for contains both kinds of quote characters, dont quote the string at all, but precede every quote and space character in the string with a backslash character (\). Here are some ways to use this. To output all lines in the le screenplay that contain the string "Frankly, Scarlett," he said, type:
$ grep '"Frankly, Scarlett," he said' screenplay RET
To output all lines in the le screenplay that contain the string I dont give, type:
$ grep "I dont give" screenplay RET
To output all lines in the le screenplay that contains the string Don't say "Goodbye", type:
$ grep Don\'t\ say\ \"Goodbye\" screenplay RET
336
In a regular expression, most charactersincluding letters and numbers only represent themselves. For example, the regexp pattern 1 matches the string 1 and nothing else; the pattern bee matches the string bee and nothing else. The pattern lacks any characters at all and is called the empty set; it matches nothing.3 Each of these are regexps that specify a set of one precise pattern to match. There are, however, a number of reserved characters, called metacharacters, that dont represent themselves in a regular expression. Instead, they have special meanings that are used to build complex patterns. These metacharacters are:
. * [ ] ^ $ \
To avoid trouble with shell expansion, you should quote regexps that contain any of these metacharacters. To specify one of these literal characters in a regular expression, precede the character with a \.4 Here are some ways to use this. To output lines in the le catalog that contain a literal $ character, type:
$ grep '\$' catalog RET
To output lines in the le catalog that contain the string $1.99, type:
$ grep '\$1\.99' catalog RET
The following table describes the special meanings of the metacharacters and gives examples of their use. . Matches any one character, with the exception of the newline character. For example, . matches a, 1, ?, . (a literal period character), and so forth.
3 4
Since nothing can be found in the space between any two characters, the empty set matches every line of its input, which can be useful in some scenarios. You could also use fgrep to search, as described in See Recipe 14.2 [Searching Text for a Phrase], page 334, but then your regexps would have to contain no metacharacters at all.
337
Matches the preceding regexp at least zero but as many times as possible. For example, -* matches at least (the empty set), but preferably -, -, ---, ----, -----, and so forth, continuing the match as much as possible. Encloses a character set, and matches any member of the setfor example, [abc] matches either a, b, or c. In addition, the hyphen (-) and caret (^) characters have special meanings when used inside brackets: The hyphen species a range of characters, ordered according to their ascii values (see Recipe 9.3.7 [Viewing a Character Set], page 228). For example, [0-9] is synonymous with [0123456789]; [A-Za-z] matches one uppercase or lowercase letter. To include a literal - in a list, specify it as the last character in a list: so [0-9-] matches either a single digit character or a -. As the rst character of a list, the caret means that any character except those in the list should be matched. For example, [^a] matches any character except a, and [^0-9] matches any character except a numeric digit. Matches the beginning of the line. So ^a matches a only when it is the rst character on a line. Matches the end of the line. So a$ matches a only when it is the last character on a line. Use \ before a metacharacter when you want to specify that literal character. So \$ matches a dollar sign character ($), and \\ matches a single backslash character (\). In addition, use \ to build new extended metacharacters, by using it before a number of other characters:
[]
^ $ \
338
\|
Called the alternation operator, it matches either regexp it is betweenuse it to join two separate regexps to match either of them. For example, a\|b matches either a or b. Matches the preceding regexp as many times as possible, but at least once. So a\+ matches one or more adjacent a characters, such as aaa, aa, and a. Matches the regexp preceding it either zero or one times. So a\? matches either a, or the empty setwhich matches every line. Matches the previous regexp (one specied to the left of this construction) that number of timesso a\{4\} matches aaaa. Use \{number,\} to match the preceding regexp number or more times, \{,number\} to match the preceding regexp zero to number times, and \{number1,number2\} to match the preceding regexp from number1 to number2 times. Group regexp together for an alternative, which is useful for combination regexps. For example, while moo\? matches only mo or moo, \(moo\)\? matches only moo or the empty set.
\+
\?
\{number\}
\(regexp\)
NOTES: The name grep derives from a command in the now-obsolete unix ed line editor tool. The ed command for searching globally through a le for a regular expression, and then printing on the screen those lines that contained a match, was g/re/p, where re was the regular expression youd use. Eventually, the grep command was written to do this search on a le when not using ed.5 The grep variant egrep, extended grep, recognizes all of the extended metacharacters without the preceding \. You can get the same eect in plain grep by using the -E option. The following sections describe some regexp recipes for commonly searchedfor patterns.
5
The ed command is still available on virtually all unices, Linux included, and the old g/re/p still works. Perhaps an oft-used function, available only in one application today, might become one of the new tools of tomorrow.
339
For longer lines, where you dont want to have to be counting periods, it is more useful to use a dierent construct: ^.\{number\}$, where number is the number of lines to match. Use , to specify a range of numbers. Here are two ways to use this. To output all lines in /usr/dict/words that are exactly 17 characters wide, type:
$ grep '^.\{17\}$' /usr/dict/words RET
To output all lines in /usr/dict/words that are 25 or more characters wide, type:
$ grep '^.\{25,\}$' /usr/dict/words RET
This command outputs any lines in playlist that match the pattern the sea or cake, including lines matching both patterns.
340
To output all lines in playlist that contain both patterns the sea and cake, regardless of case, type:
$ grep -i 'the sea' playlist | grep -i cake RET
NOTES: To match lines containing some regexps in a particular order, see Recipe 14.3.6 [Using Popular Regexps for Common Situations], below.
To output all lines in access_log that do not contain the string http, type:
$ grep -v http access_log RET
The -i option matches characters regardless of case; so, in this example, all vowel characters are matched regardless of case.
341
To Match . . . Any number Lines not containing any number At least three uppercase letters together Nine zeroes in a row, anywhere in a line Lines exactly four characters long Lines exactly 70 characters long Lines beginning with an asterisk character Lines beginning with tow and ending with ing Either .txt or .text on a line cat then gory in the same word cat then gory cat except when followed by an e A q not followed by a u N, T, and K, with zero or more characters between each Any ftp://, gopher://, or http:// urls A year from 1991 through 1995 A year from 1957 through 1969 A date in any one of these formats: MONTH, DAY YEAR MON. DAY, YEAR MON. DAY, YY (Quote in double quotes)
Use This Regexp [0-9] ^[^0-9]*$ [A-Z][A-Z][A-Z] 0\{9\} ^....$ or ^.\{4\}$ ^.\{70\}$ ^\* ^tow.*ing$ \.te\?xt cat\.\+gory cat\.\+\?gory cat[^e] q[^u] N.*T.*K \(ftp\|gopher\|http\|\)://.*\..* 199[1-5] \(195[7-9]\)\|\(196[09]\) [A-Za-z]\{3,10\}\.\? [0-9]\{1,2\}, \([09]\{4\}\|'[0-9]\{2\}\)
342
The following table shows how some of the preceding searches are simplied with egrep. To Match . . . Any ftp://, gopher://, or http:// urls A year from 1957 through 1969 A date in any one of these formats: MONTH, DAY YEAR MON. DAY, YEAR MON. DAY, YY (Quote in double quotes) An ip address Use This Regexp (ftp|gopher|http|)://\.*.\.* (195[7-9])|(196[0-9]) [A-Za-z]{3,10}\.? [0-9]{1,2}, ([09]{4}|'[0-9]{2})
343
To output all lines in the le book that begin with the text in the beginning, regardless of case, type:
$ grep -i '^in the beginning' book RET
NOTES: These regexps were quoted with single-quote characters; this is because some shells otherwise treat the ^ character as a special metacharacter (see Recipe 3.1.3 [Quoting Reserved Characters], page 56).
NOTES: To use $ in a regexp to nd words that rhyme with a given word, see Recipe 11.2.1 [Listing Words That Match a Pattern], page 283.
344
NOTES: The Emacs editor has its own special search for doing thissee Recipe 14.9.2 [Searching for a Phrase in Emacs], page 353.
You can also reverse the order and use the -v option to output all lines containing a given pattern that are not in a given context. To list lines from the le email-archive that contain the word narrative, but not when it is quoted, type:
$ grep narrative email-archive | grep -v '^>' RET
345
To search /usr/dict/words for lines matching tsch and output six lines of context before and after each line of output, type:
$ grep -6 tsch /usr/dict/words RET
To output matches and the two lines before them, use -B; to output matches and the two lines after them, use -A. Give a numeric value with either of these options to specify that number of context lines instead of the default. Here are some ways to use this. To search /usr/dict/words for lines matching tsch and output two lines of context before each line of output, type:
$ grep -B tsch /usr/dict/words RET
To search /usr/dict/words for lines matching tsch and output six lines of context after each line of output, type:
$ grep -A6 tsch /usr/dict/words RET
To search /usr/dict/words for lines matching tsch and output ten lines of context before and three lines of context after each line of output, type:
$ grep -B10 -A3 tsch /usr/dict/words RET
346
METHOD #1 When you search for a regexp in less, all matches are highlighted by default. This is useful for perusing a le containing lines you are searching for, such as a mail archive or Web log le. To highlight the subject lines of all mail messages in the le you are perusing in less, type:
/^Subject:.*$ RET
NOTES: To highlight seareches in vim, type :set hls when in command mode. METHOD #2 You can use sed to output lines that match a regexp (see Recipe 10.5 [Editing Streams of Text], page 255). seds search and replace functions make it possible to search for a regexp and surround it with the ansi escape sequences necessary to display text in colors. This method works on color terminals. To search the le itinerary for the pattern Paris, and output the contents of the le with that pattern in red, type (all on one line):
$ sed 's/Paris/ CTRL - V ESC [31m& CTRL - V ESC [37m/g' < itinerary RET
The color for the highlighted text is specied by the number in the rst escape sequence. In the preceding example, that number is 31 (the second number resets the text color to white, using number 37, for the text following the match). The following table lists available numbers and the colors they set. 30 31 32 33 34 35 36 37 Black Red Green Yellow Blue Purple Cyan White
NOTES: If you want to pipe the output to a pager for perusal, you should use either less with the -R option or use more, because control characters by default are not escaped in less (see Recipe 9.1.4 [Perusing Raw Text], page 214).
347
NOTES: This option is new for grep, beginning in gnu grep version 2.5. METHOD #2 You can also use sed to output only the matched patterns you search for, and not the lines they are contained in. To do this, run sed with the -n option and the expression s/.*\(PATTERN \).*/\1/p, where PATTERN is the pattern to search for. Finally, give the name of the le to search as an argument. To output the contents of all double quotations (including the quotation marks themselves), contained in the le dialogue, type:
$ sed -n 's/.*\(".*"\).*/\1/p' dialogue RET
348
To output all lines in /usr/dict/words that do not contain any of the words listed in forbidden-words, regardless of case, type:
$ grep -v -i -f forbidden-words /usr/dict/words RET
To search all les in the current directory with either produce or inventory anywhere in part of their names, type:
$ grep peaches *produce,inventory* RET
When you search multiple les, each match that grep outputs is preceded by the name of the le its in; suppress this with the -h option.
349
Here are two ways to use this. To output lines in all of the les in the current directory containing the word CD, type:
$ grep CD * RET
To output lines in all of the .txt les in the ~/doc directory containing the word CD, suppressing the listing of le names in the output, type:
$ grep -h CD ~/doc/*.txt RET
Use the -r option to search a given directory recursively, searching all subdirectories it contains. To output lines containing the word CD in all of the .txt les in the ~/doc directory and in all of its subdirectories, type:
$ grep -r CD ~/doc/*.txt RET
To search through all les in the current directory, either compressed or uncompressed, for the text Linux, type:
$ zgrep Linux * RET
To recursively search through all les in the current directory tree, either compressed or uncompressed, for the text Linux, type:
$ zgrep -r Linux * RET
350
METHOD #2 Wget DEB: wget RPM: wget WWW: http://www.gnu.org/software/wget/wget.html To grep the actual html source of the Web page, use wget and give - as an argument to the -O option, piping the output to grep. To search the html sources of the url http://example.com/bingo for ve sequential digits, type (all on one line):
$ wget -O- http://example.com/bingo | grep '[0-9]\{5\}' RET
351
In this command, oldstring is the string to search for, newstring is the string to replace it with, and lespec is the name of the le or les to work on. You can use this for more than one le. To replace the string helpless with the string helpful in all les in the current directory that end with a three-character le extension, type:
$ perl -pi -e "s/helpless/helpful/g;" *.??? RET
METHOD #2 You can use sed to search for and replace text, as described in Recipe 10.5 [Editing Streams of Text], page 255. To output the contents of the le marketing, replacing the text television, capitalized or not, with Internet, type:
$ sed 's/[Tt]elevision/Internet/g' marketing RET
You can also specify that replacement is to occur only when lines contain some other text by using the expression /othertext/s/searchtext/replacetext/g. To output the contents of the le marketing replacing the text television, capitalized or not, with Internet, but only on lines that contain a digit character, type:
$ sed '/[0-9]/s/[Tt]elevision/Internet/g' marketing RET
Finally, to specify that replacement is to occur only when lines do not contain some other text, use sed with the expression /othertext/!s/searchtext/replacetext/g.
352
To output the contents of the le marketing replacing the text television, capitalized or not, with Internet, but not on lines that contain the text radio, type:
$ sed '/radio/!s/[Tt]elevision/Internet/g' marketing RET
At that point, Emacs searches forward through the buer from point to the rst s character and highlights it. Then, as you type u, it searches forward to the rst su in the buer and highlights that (if a u appears immediately after the s it rst stopped at, it stays there and highlights the s and the u). It continues to do this as long as you type and as long as there is a match in the current buer. As soon as what you type does not appear in the buer, Emacs beeps and a message appears in the minibuer stating that the search has failed. To search for the next instance of the last string you gave, type CTRL - S again; if you keep CTRL held down, then every time you press the S key Emacs will advance to the next match in the buer. This is generally the fastest and most common type of search you will use in Emacs. You can also do an incremental search through the buer in reversethat is, from point to the beginning of the buerwith the isearch-backward function, CTRL - R .
353
To search for the text moon in the current buer from point in reverse to the beginning of the buer, type:
CTRL - R
moon
NOTES: The word-search-backward function does the same as wordsearch-forward, except it searches backward through the buer, from point to the beginning of the buer.
The keyboard accelerator for this command is ALT - CTRL - S . To repeat the last regexp search you made, type ALT - CTRL - S CTRL - S ; then, as long as you have CTRL held down, you can keep typing s to advance to the next match, just as you would with an incremental search. NOTES: There is a search-backward-regexp function that is identical but searches backward, from point to the top of the buer.
354
expression to replace it with. Regexps are matched from point to the end of the buer; to search and replace all occurrences in a buer, run this function when point is at the beginning of the buer. To replace the text day with the text night in the current buer, type:
replace-regexp RET Replace regexp: day RET Replace regexp day with: night RET Replaced 7 occurrences
ALT - X
In the preceding example, the regexp day was found (and replaced by the regexp night) seven times from point to the end of the buer. This function is especially useful for replacing control characters with text, or for replacing text with control characters, which you can specify with CTRL - Q , the quoted-insert function (see Recipe 10.1.4 [Inserting Special Characters in Emacs], page 239). To replace all the Control-M characters in the current buer with regular linefeeds, type:
replace-regexp RET Replace regexp: CTRL - Q CTRL - M RET Replace regexp ^M with: CTRL - Q 012 RET Replaced 101 occurrences
ALT - X
RET
In this example, 101 Control-M characters were found (and replaced) from point to the end of the buer.
355
through the text, type / followed by a regexp to search for; to search backward through the text, use ?. When you do a search, the word or other regexp you search for appears highlighted throughout the text. Typing a / or ? with no search string will search either forward or backward for the previous string or regexp. Here are some ways to use this. To search forward through the text you are perusing for the word cat, type:
/cat RET
To search backward through the text you are perusing for the regexp [ch]at, type:
?[ch]at RET
NOTES: In Vi, whose search facility works identically to less, the matches are not highlighted by default.
356
357
This is the term now popularly used for les whose content happens to be a book, whether in plain text or some other, often proprietary, format.
358
le formats they generate, are anathema to the generalized, tools-based, and plain-text philosophy of unix and Linux (see Recipe 1.7.7 [unix and the Tools Philosophy], page 22). Word processing itself may be an obsolete idea of the 1980s personal computing environment, and it may no longer be a necessity in the age of the Interneta medium in which plain text data is uid and natural, being a native format and accessible on all machines. If you do need to design a special layout for hardcopy printing, you can typeset the text. One could write a book on the subject of Linux typesetting; unfortunately, no such book has yet been written. However, this chapter contains recipes to get you started producing typeset output. These recipes were selected as being the easiest to prepare or most eective for their purpose. For a list of other popular tools avilable for Linux, including traditional word processors, see Recipe 15.7 [Using Other Word Processors and Typesetting Systems], page 391, and for more information on this subject, I recommend Christopher B. Brownes overview, Linux Word Processing [http://www.cbbrowne.com/info/wp.html].
359
documents, and the third suggests the typesetting system(s) to use. These systems are described in the remaining sections of this chapter. Output Format Printed, typeset output and electronic html or text le Printed, typeset output and text le Printed, typeset output Examples Internet faq, white paper, dissertation man page, command reference card Letter or other correspondence, report, book manuscript Brochure or newsletter with multiple columns and images Envelope, mailing label, or other specialized document Chart or table Grocery list, saved email message, to-do list Poster, sign Birthday party banner System to Use a Enscript, L TEX, Texinfo, LinuxdocTools groff a L TEX, LyX, TEX
LyX, TEX
TEX
Printed, typeset output or text le Printed text output in a font Printed, typeset output Large printed text output suitable for display
360
as unformatted text, but the text of the printed output is formatted in basic ways, such as being set in a font. You can also use PostScript previewers such as gv or ghostview to view it on the screen. Additionally, you can convert the PostScript to pdf or other image formats, like a jpeg image le. In fact, once you make a PostScript le from text input, you can use any of the tools to format this new PostScript le, including rearranging and resizing its pages (see Chapter 20 [PostScript], page 451). There are several methods for converting text to PostScript output, but the best is to use enscript. This is a quick, eective way to make presentable output from plain text. It converts the text le that is specied as an argument into PostScript, making any number of formatting changes in between. Its great for quickly making nice output from a plain text leyou can use it to do things such as output text in a font of your choosing, or paginate text with graphical headers at the top of each page. By default, enscript paginates its input, outputs it in a 10-point Courier font, and puts a simple header at the top of each page containing the le name, date and time, and page number in bold. Use the -B option to omit this header. If you have a PostScript printer connected to your system, enscript can be set up to spool its output right to the printer. You can check whether your system is set up this way by looking at the enscript conguration le, /etc/enscript.cfg. The line
DefaultOutputMethod: printer
species that output is spooled directly to the printer. Changing printer to stdout sends the output to the standard output instead. Even if your default printer does not natively understand PostScript, it may be able to take enscript output, anyway. Most Linux installations these days have print lters set up so that PostScript spooled for printing is automatically converted to a format the printer understands. If your system doesnt have this setup for some reason, convert the PostScript to a format recognized by your printer with the gs tool, and then print thatsee Recipe 20.3 [Converting PostScript], page 459. To convert the text le saved-mail to PostScript, with default formatting, and spool the output right to the printer, type:
$ enscript saved-mail RET
To select a specic printer to send to, follow the -d option with its name.
361
To convert the text le memo to PostScript, and send it to the printer named salesroom, type:
$ enscript -dsalesroom memo RET
To write the output to a le instead of spooling it, give the name of the le you want to output as an argument to the -p option. This is useful when you dont have a PostScript printer and you need to convert the output rst, or for when you just want to make a PostScript image le from some text, or for previewing the output before you print it. In the latter case, you can view it on the display screen with a PostScript viewer application such as ghostview (see Recipe 17.4.2 [Previewing a PostScript File], page 414). To write the text le saved-mail to a PostScript le, saved-mail.ps, and then preview it in X, type:
$ enscript -p report.ps saved-mail RET $ ghostview saved-mail.ps RET
To send it to the standard output, specify - as the le; this is good for passing the PostScript along on a pipeline to some other commands, without writing it to a le at all. To preview the text le saved-mail as a PostScript le in the gv viewer, type:
$ enscript -p - saved-mail | gv - RET
The following recipes show how to use enscript to output text with different eects and properties. You can combine these options, and some of the recipes will demonstrate that.
362
Here are two ways to use this. To print the contents of the text le saved-mail on a PostScript printer, with text set in the Helvetica font at 12 points, type:
$ enscript -B -f "Helvetica12" saved-mail RET
To make a PostScript le called saved-mail.ps containing the contents of the text le saved-mail, with text set in the Helvetica font at 12 points, type (all on one line):
$ enscript -B -f "Helvetica12" -p saved-mail.ps saved-mail RET
The -B option was used in the preceding examples to omit the output of a header on each page. When headers are used, theyre normally output in 10-point Courier Bold; to specify a dierent font for the text in the header, give its name as an argument to the -F option. Here are two ways to use this. To print the contents of the text le saved-mail to a PostScript printer, with text set in 10-point Times Roman and header text set in 18-point Times Bold, type (all on one line):
$ enscript -f "Times-Roman10" -F "Times-Bold18" saved-mail RET
To make a PostScript le called saved-mail.ps containing the contents of the text le saved-mail, with text and headers both set in 16-point Palatino Roman, type (all on one line):
$ enscript -f "Palatino-Roman16" -F "Palatino-Roman16" -p saved-mail.ps saved-mail RET
NOTES: A list of available Adobe Type 1 fonts, and the names used to specify them, can be found at /usr/share/enscript/afm/font.map. If you want to output a visual image of a text le, showing the way the text looks as a whole but set at a font too small to read, use a small font size, such as from 1 to 5.
By default, enscript wraps long lines over to the next, which does not always look nice. Give the -c option to truncate long lines, or output the
363
text in vertical slices (see Recipe 15.2.8 [Outputting Text in Vertical Slices], page 369). To write the le program.output to the default printer, with long lines truncated, type:
$ enscript -c program.output RET
Specify the margins with --margins=LEFT:RIGHT:TOP:BOTTOM , where LEFT, RIGHT, TOP, and BOTTOM are the values for the stated margins. These values are given in PostScript points, which are 1/72 of an inch. You can omit any of them. To print the le sci.article to the default printer, with a custom bottom margin of 50 PostScript points, type:
$ enscript --margins=:::50 sci.article RET
You can even print several pages on one page. To specify the number of logical pages to print on every output page, give the number as an argument to the -U option. To print the le tipsheet to the default printer, with text set in 24-point Times Roman and writing four logical pages to each printed page, type:
$ enscript -U4 -f "Times-Roman24" tipsheet RET
364
CAUTION RET
RET RET
Use the -j option to draw a border around the page. To print a sign in 72-point Helvetica Bold type to a PostScript printer, type:
$ enscript -B -j -f "Helvetica-Bold72" RET
RET RET
CAUTION RET
RET RET
The text in this example was preceded by a few space characters, to set it o from the border. Because 72-point type is very large, you may want to use the --wordwrap option with longer lines of text to wrap lines at word boundaries. You might need this option because at these larger font sizes, you run the risk of making lines that are longer than could t on the page. You can also use the -r option to print the text in landscape orientation, as described in Recipe 15.2.7 [Outputting Text in Landscape Orientation], page 369.
365
To print a sign in 63-point Helvetica Bold across the long side of the page, type:
$ enscript -B -r --word-wrap -f "Helvetica-Bold63" RET
RET RET
NOTES: To make a snazzier or more detailed message or sign, create a le in a text editor and justify the words on each line in the le as you want them to print, with blank lines where necessary. If youre getting that ambitious, it would also be wise to use the -p option once to output to a le, and preview the le before printing it (see Recipe 17.4.2 [Previewing a PostScript File], page 414).
Ada95 programming language Assembler listings awk programming language Bash shell programming language C programming language ChangeLog les C++ programming language Csh script language
366
delphi diff diffu elisp fortran haskell html idl java javascript ksh (continued) Name m4 mail makefile nroff objc pascal perl postscript python scheme sh skill sql Filter
Delphi programming language Normal dierence reports made from diff Unied dierence reports made from diff Emacs Lisp programming language fortran 77 programming language Haskell programming language HyperText Markup Language (html) idl (corba Interface Denition Language) Java programming language Javascript programming language Ksh programming language Format or Language m4 macro processor programming language Electronic mail and Usenet news articles Rule les for make Manual pages formatted with nroff Objective-C programming language Pascal programming language perl programming language PostScript programming language Python programming language Scheme programming language Bourne shell programming language Cadence Design Systems Lisp-like language Sybase 11 sql
367
Denition les for states Synopsys dc shell scripting language tcl programming language Tcsh shell script language Microsofts Visual Basic for Applications language Verilog hardware description language vhsic Hardware Description Language (vhdl) Virtual Reality Modeling Language (vrml97) Zsh programming language
To pretty-print a le, give the name of the lter to use as an argument to the -E option, without any whitespace between the option and argument. Here are some ways to use this. To pretty-print the html le index.html, type:
$ enscript -Ehtml index.html RET
To pretty-print an email message saved to the le important-mail, and output it with no headers to a le named important-mail.ps, type:
$ enscript -B -Email -p important-mail.ps important-mail RET
To pretty-print an email message saved to the le important-mail, and print it on the default printer with fancy headers, type:
$ enscript -G -Email important-mail RET
Use the special --help-pretty-print option to list the languages supported by the copy of enscript you have. To peruse a list of currently supported languages, type:
$ enscript --help-pretty-print | less RET
368
To print the le intelligence.report with the default enscript formatting and an underlay of TOP SECRET, type:
$ enscript -u"TOP SECRET" intelligence.report RET
There are a number of options used to specify the properties of the underlay, as described in the following table. --ul-angle=angle Species angle, in degrees, of the underlay (default is the arc tangent of two variables: the negative page height and its width). Species font and point size of the underlay (default is Times Roman at 200 points). Species the value of gray to use in coloring the underlay as a value between 0 and 1 (default is 0.8). Species starting position of underlay, in PostScript coordinates. The x position is given, preceded by either a + or -, followed by the y position, which is given in the same way (for example, the upper left-hand corner is +0-0). Species style of text, either outline where only the character outline is printed (the default) or filled, where characters are lled with gray.
--ul-style=style
To make a PostScript le called saved-mail.ps containing the contents of the text le saved-mail, with fancy headers, type:
$ enscript -G -p saved-mail.ps saved-mail RET
Without the -G option, enscript outputs text with a plain header in bold text, printing the le name and the time it was last modied. The -B option, as described earlier, omits all headers.
369
You can customize the header text by quoting the text you want to use as an argument to the -b option. Use the special symbol $% to specify the current page number in the header text. To print the contents of the text le saved-mail with a custom header label containing the current page number, type (all on one line):
$ enscript -b "Page $% of the saved email archive" saved-mail RET
NOTES: There is currently no option to place headers on all but the rst page, so if you need to format text in this common way, rst use enscript to output to a le without headers, then use enscript to output another le with headers, and use psselect to combine the rst page of the former with the remaining pages of the latter (see Recipe 20.1.2 [Extracting Pages from a PostScript File], page 452). You can create your own custom fancy headers, toothis is described in the CUSTOMIZATION section of the enscript man page.
The -r option is useful for making horizontal banners by passing output of the figlet tool to enscript (see Recipe 16.4.1 [Horizontal Text Fonts], page 401). To output the text Quite a long banner in a figlet font and write it to the default printer with text set at 18-point Courier and in landscape orientation, type:
$ figlet "Quite a long banner" | enscript -B -r -f "Courier18" RET
370
followed by a number to specify that slice; slices are numbered beginning with 1. To print the second slice from the le annual-report.txt, type:
$ enscript --slice=2 annual-report.txt RET
If the number of columns is either one or two, you can also give the number itself as an option. Use the -j option to place borders around each column. To send the le payroll-data to the default printer with the default enscript processing, setting the text in two columns per page, each with a border drawn around it, type:
$ enscript -j -2 payroll-data RET
371
NOTES: You can also place text in paginated columns with pr, and then send it to enscript (see Recipe 13.3.4 [Placing Text in Paginated Columns], page 314).
To print just the odd or even pages, use the special odd and even arguments. This is good for printing double-sided pages: First print the oddnumbered pages, and then feed the output pages back into the printer and print the even-numbered pages. Here are two ways to use this. To print the odd-numbered pages of the le saved-mail with the default headers, type:
$ enscript -a odd saved-mail RET
To print the even-numbered pages of the le saved-mail with the default headers, type:
$ enscript -a even saved-mail RET
372
This is the year that Knuths denitive book on the subject, The TEXbook, was published, but the system was technically operational before this timeversion 1.0 was released on December 3, 1983, the initial design for the system occurred in 1977, and the rst books typeset with early TEX were published by 1979. See http://www-cs-faculty.stanford.edu/~knuth/taocp.html.
373
a documents. (L TEX probably gets more day-to-day use than the plain TEX format, but in my experience, each is useful for dierent situations.) a TEX isnt pronounced like the name of a cowboy, nor L TEX like a kind of paint: the letters T, E, and X represent the Greek characters tau, epsilon, and chi (from the Greek techne, meaning art and science). So the a last sound in TEX is like the last sound in Bach, and L TEX, depending on local dialect, is pronounced either lay-teck or lah-teck. Those who become highly adept at using the system Knuth calls TEXnicians. The collective family of TEX and related programs (including Metafont; see Recipe 16.5 [Using Other Font Tools], page 403) are sometimes called TEX and friends, and they are always kept in a directory named texmf. For example, the supplementary les included with the bare TEX system are kept in the /usr/lib/texmf directory tree. The following recipes describe how to begin writing input for TEX and how to process these les for viewing and printing. While not everyone wants or a even needs to write documents with TEX and L TEX, these formats are widely usedespecially on Linux systemsso every Linux user has the potential to encounter one of these les, and ought to know how to process them.
374
In this example, grep returned a match, so its safe to assume that a smith.tex is a L TEX le (of the letter document class) and not a TEX le. NOTES: For more on regular expressions and searching with grep, see Recipe 14.3 [Regular ExpressionsMatching Text Patterns], page 335.
Once you have produced a dvi output le with this method, you can do any of the following with it: Preview it on the screen with xdvi; see Recipe 17.4.1 [Previewing a dvi File], page 413. Print it with dvips or lpr; see Recipe 25.2.5 [Printing a dvi File], page 515. Convert it to PostScript with dvips; see Recipe 25.3.2 [Preparing a dvi File for Printing], page 520; then, you can also convert the PostScript output to pdf or plain text.
This command writes a dvi output le called lshort.dvi. a You may need to run latex on a le several times consecutively. L TEX documents sometimes have indices and cross references, which, because of a the way that L TEX works, take two (and, in rare cases, three or more) runs through latex to be fully processed. Should you need to run a le through latex more than once in order to generate the proper references, youll see a message in the latex processing output instructing you to process it again.
375
To ensure that all of the cross references in lshort.tex have been generated properly, run the input le through latex once more:
$ latex lshort.tex RET
The lshort.dvi le will be rewritten with an updated version containing the proper page numbers in the cross reference and index entries. You can then view, print, or convert this dvi le as described in the previous recipe for processing TEX les.
Figure 15-1. A TEX Hello, world. If you processed the input le shown in Figure 15-1 with tex, it would output a dvi le that displayed the text Hello, world in the default TEX font, on a default page size, and with default margins. a Figure 15-2 contains the same Hello, world, but for L TEX.
\documentclass{article} \begin{document} Hello, world \end{document}
a Figure 15-2. A L TEX Hello, world. Even though the TEX example in Figure 15-1 is much simpler than the a a L TEX example, L TEX is generally easier to use fresh out of the box for
376
writing certain kinds of structured documentssuch as correspondence and articlesbecause it comes with predened document classes, which control the markup for the structural elements the document contains.4 Plain TEX, on the other hand, is better suited for less casual publishing projects, including custom layouts and specialized documents. a The TEX and L TEX markup languages are worth a book each, and providing an introduction to their use is well out of the scope of this text. To learn how to write input for them, I suggest two beginning tutorials: Michael Doobs A Gentle Introduction to TEX, and Tobias Oetikers The Not So Short a Introduction to L TEX. Both are available on the Web at the urls listed in Appendix D [References for Further Interest], page 731. These tutorials are each in the format they describe; in order to read them, you must process them rst, as described in the two previous recipes. a Good L TEX documentation in html format can be found installed on many Linux systems in the /usr/share/texmf/doc/latex/latex2e-html/ directory; browse these les at your leisure (see Recipe 5.10 [Browsing Files and Directories], page 157). Some other typesetting systems, such as LyX, Linuxdoc-Tools, and Texinfo a (all described elsewhere in this chapter), write TEX or L TEX output, tooso you can use those systems to produce said output without actually learning a the TEX and L TEX input formats. (This book was written in Emacs in Texinfo format, and the typeset output was later generated by TEX.) a NOTES: The Oetiker text consists of several separate L TEX les in the lshort directory; download and save all of these les.
a LyX, being in essence a graphical front-end to L TEX, uses these same document classes. aTEX style for printing many dierent kinds of shipping In addition, a more advanced L and package labels is normally installed at /usr/share/texmf/tex/latex/labels/.
377
To write a document with a template, insert the contents of the template le into a new le that has a .tex or .ltx extension, and write your document by making changes to that le. (Use your favorite text editor to do this.) To make sure that you dont accidentally overwrite the actual template les, you can write-protect them (see Recipe 6.3.3 [Write-Protecting a File], page 169):
$ chmod a-w template-le-names
RET
In the templates themselves, the bracketed, uppercase text explains what kind of text belongs there; ll in these lines with your own text and delete the lines you dont need. Then, process your new le with either latex or tex as appropriate, and youve got a great-looking document! The following table lists the le names of the TEX templates, and describes their use. Use tex to process les you make with these templates (see the preceding recipe). fax.tex envelope.tex label.tex A cover sheet for sending fax messages. A No. 10 mailing envelope. A single mailing label for printing on standard 15-up sheets.
a The following table lists the le names of the L TEX templates, and describes their use.6 Use latex to process les you make with these templates a (see Recipe 15.3.3 [Processing a L TEX File], page 374). letter.ltx article.ltx manuscript.ltx A letter or other correspondence. An article or a research or term paper. A book manuscript.
There are more complex template packages available on the net that you might want to look at: a The largest listing of L TEX and TeX templates and style les (and other related software and documentation) on the Internet is the searchable TEX Catalogue Online [http://www.ctan.org/tex-archive/help/Catalogue/hier.html].
6
The manuscript template requires that your system has the le called manuscript.sty; most TEX distributions have this /usr/share/texmf/tex/latex/misc/manuscript.sty.
378
a Rob Rutten has assembled a very nice collection of L TEX templates [http://www.astro.uu.nl/~rutten/rrtex/templates/]. A collection of plain TEX macros for printing booklets, bulk letters, and outlines worth exploring is the Midnight Macros [http://www.ctan.org/tex-archive/macros/generic/midnight/] A set of TEX templates for various kinds of documents, mostly academic and instructional, are available courtesy of the Duke Mathematics Department [http://www.math.duke.edu/computing/tex/templates.html].
379
a documents in LyX that are much harder to do in L TEX, such as multi-column newsletter layouts with illustrations. a You can also import your L TEX les (and plain text) into LyX for further layout or manipulation. The following recipes show how to get started using LyX, and where to go to learn more about it. When editing in LyX, youll see that it has all of the commands youd expect from a word processorfor example, some of the commands found on the Edit menu include Cut, Copy, Paste, Find and Replace, and Spell Check. Here are some of its major features: Automatic generation of table of contents, nested lists, and numbering of section headings. Easy insertion of PostScript gures and illustrations, which can be rotated, scaled, and captioned. wysiwyg construction of tables. Ability to undo and redo any operation or sequence of operations. All LyX functions available from both keyboard commands and pull-down menus. All keypresses used for commands are congurable.
380
Format suitable for papers submitted to Astronomy and Astrophysics. Format for letters typeset according to German conventions. Format for documents written in the sgml DocBook dtd. Format for movie scripts as they are formatted in the U.S. lm industry. Format for letters typeset according to Italian conventions. Format suitable for article submissions to ieee conferences. Basic format for letters and correspondence.
linuxdoctemplate.lyx Format for documents written in the sgml LinuxDoc dtd, as formerly used by the Linux Documentation Project. revtex.lyx Article format suitable for submission to publications of the American Physical Society (aps), American Institute of Physics (aip), and Optical Society of America (osa). Format for producing slides and transparencies.
slides.lyx
To view how the document will look when you print it, choose View DVI from the File menu. This command starts the xdvi tool, which previews the output on the screen. (For more on using xdvi, see Recipe 17.4.1 [Previewing a DVI File], page 413). To print the document, choose Print from the File menu. You can also a export it to L TEX, PostScript, dvi, or plain text formats; to do this, choose Export from the File menu and then select the format to export to. NOTES: If you plan on editing the document again in LyX, be sure to save the actual .lyx document le.
381
See http://www.lyx.org/about/lgt-1.0/lgt.html.
382
a L TEX Configuration
a An inventory of your L TEX conguration, including a the version of L TEX in use, available fonts, available document classes, and other related packages that may be installed on your system. This document is automatically generated by LyX when it is installed on your system.
Finally, LyX includes some example documents in the /usr/X11R6/share/lyx/examples directory. Heres a partial listing of these les with a description of what each contains:
Foils.lyx ItemizeBullets.lyx Literate.lyx MathLabeling.lyx Math_macros.lyx Minipage.lyx TableExamples.lyx aa_head.lyx aa_paper.lyx aas_sample.lyx amsart-test.lyx amsbook-test.lyx docbook_example.lyx multicol.lyx scriptone.lyx
Description of how to make foilsslides or overhead transparencieswith the FoilTEX package. Examples of the various bullet styles for itemized lists. An example of using LyX as a composition environment for literate programming. Techniques for numbering and labeling equations. Explanation of how to make macros in Math mode. Explanation of how to write two-column bilingual documents. Examples of using tables in LyX. Files discussing and showing the use of LyX in the eld of astronomy. Examples of documents written in the format used by the American Mathematical Society. Example of a DocBook document. Example of a multi-column format. Example of a Hollywood script.
383
There are several output formats groff can write to. To specify a format, give it as an argument to the -T option. The following table lists the arguments and describes the formats they specify. ps dvi X75 PostScript dvi (DeVice Independent) format dvi preview in X at 75 dpi (no output le necessary)
384
dvi preview in X at 100 dpi (no output le necessary) Plain text Plain text in the iso Latin-1 character set (extended ascii) pcl5 printer format, for hp LaserJet 4 printers and compatibles html
By default, groff writes to the standard output; to save it to a le, redirect the output. Here are some ways to use this. To preview the contents of the groff le doc.ms in a new X window at 100 dpi, type:
$ groff -T X100 doc.ms RET
To process the groff le doc.ms and send the output to an hp LaserJet 4 printer named frontoffice, type:
$ groff -T lj4 doc.ms | lpr -Pfrontoffice RET
To display the rst 20 lines of the document contained in the groff le doc.ms, ignoring any error messages, type:
$ groff -T ascii doc.ms 2> /dev/null | head -20 RET
To mail the contents of the groff le doc.ms as plain text to the email address [email protected], type:
$ groff -T ascii doc.ms | mail [email protected] RET
385
To see which options should be used with groff on the le meintro.me, type:
$ grog meintro.me RET
In this example, the uncompressed content of the le was sent to the standard output via zcat (see Recipe 10.6 [Concatenating Text], page 256). You can use xdvi to preview the resultant dvi output, or dvips to print it. The command options used for this le were determined by grog (as described in the previous recipe). NOTES: Two additional groff documentation les included in the same directory are a complete reference manual, meref.me.gz, and a guide to making box-and-arrow diagrams with the pic extension, pic.ms.gz. More recommended resources for learning groff can be found in See Appendix D [References for Further Interest], page 731.
386
.TS allbox; c s s c c c n n l. Plant Hardiness Zones Zone Min. Temp. Example Cities 1 Below -50 F Fairbanks, Alaska; Resolute, Northwest Territories (Canada) 2a -50 to -45 F Prudhoe Bay, Alaska; Flin Flon, Manitoba (Canada) 2b -45 to -40 F Unalakleet, Alaska; Pinecreek, Minnesota 3a -40 to -35 F International Falls, Minnesota; St. Michael, Alaska 3b -35 to -30 F Tomahawk, Wisconsin; Sidney, Montana 4a -30 to -25 F Minneapolis/St.Paul, Minnesota; Lewistown, Montana 4b -25 to -20 F Northwood, Iowa; Nebraska 5a -20 to -15 F Des Moines, Iowa; Illinois 5b -15 to -10 F Columbia, Missouri; Mansfield, Pennsylvania 6a -10 to -5 F St. Louis, Missouri; Lebanon, Pennsylvania 6b -5 to 0 F McMinnville, Tennessee; Branson, Missouri 7a 0 to 5 F Oklahoma City, Oklahoma; South Boston, Virginia 7b 5 to 10 F Little Rock, Arkansas; Griffin, Georgia 8a 10 to 15 F Tifton, Georgia; Dallas, Texas 8b 15 to 20 F Austin, Texas; Gainesville, Florida 9a 20 to 25 F Houston, Texas; St. Augustine, Florida 9b 25 to 30 F Brownsville, Texas; Fort Pierce, Florida 10a 30 to 35 F Naples, Florida; Victorville, California 10b 35 to 40 F Miami, Florida; Coral Gables, Florida 11 above 40 F Honolulu, Hawaii; Mazatlan, Mexico .TE
Figure 15-3. The zones le. To make a table from such a groff input le, use tbl and give the name of the le as an argument. This command outputs the raw input text that groff uses to typeset the table; to view it or save it to a le, pipe the output to groff with the right argument to the -T option for the output format you want, as described in Recipe 15.5.1 [Processing a groff File], page 383. Here are two ways to use this. To preview the typeset table made from the le zones in a new X window at 100 dpi, type:
$ tbl zones | groff -TX100 RET
To output the typeset table made from the le zones in a PostScript le called zones.ps, type:
$ tbl zones | groff -Tps > zones.ps RET
387
The previous example text will produce a table that looks like Figure 15-4.
Figure 15-4. Table made from the zones le. Using the ascii option with groff will output a nice ascii character table, and the html option will output a png-format image le plus an html le that has an image tag for that le. NOTES: For more information on using tbl, see Appendix D [References for Further Interest], page 731. a You can make nice tables with L TEX, too. For a good tutorial, consult a Chapter 5 of The L TEX Environment (see Appendix D [References for Further Interest], page 731).
388
If you cant locate a copy, you can always install the sources from the Debian package (see Recipe 1.1 [Format of Recipes], page 3).
389
if you want to print or convert them, you have to uncompress them rst (see Recipe 8.4 [Using File Compression], page 196). Here are two ways to use this. To peruse the compressed text version of the Linuxdoc-Tools guide, type:
$ zless /usr/share/doc/linuxdoc-tools/guide.txt.gz RET
To print a copy of the PostScript version of the Linuxdoc-Tools guide to the default printer, type:
$ zcat /usr/share/doc/linuxdoc-tools/guide.ps.gz | lpr RET
The following recipes use the Linuxdoc-Tools package and demonstrate its use with documents written in the LinuxDoc dtd.
Figure 15-5. A LinuxDoc Hello, world. NOTES: The Linuxdoc-Tools package also comes with a simple example le, example.sgml.gz, which is installed in the /usr/share/doc/linuxdoctools/example directory.
390
rtf txt
To make a plain text le from myfile.sgml, type: This command writes a plain text le called myfile.txt. a To make a PostScript or pdf le from an sgml le, rst generate a L TEX input le, run it through latex to make a dvi output le, and then process that with dvips to make the nal output.
391
a In this example, linuxdoc writes a L TEX input le from the sgml source a le, and then the latex tool processes the L TEX le to make dvi output, which is processed with dvips to get the nal output: a PostScript le called myfile.ps with a paper size of U.S. letter (8.5 inx11 in). To make a pdf le from the PostScript le, you need to take one more step and use ps2pdf, part of the gs (Ghostscript) package; this converts the PostScript to pdf. To make a pdf le from the PostScript le myfile.ps, type:
$ ps2pdf myfile.ps myfile.pdf RET
AbiWord
A graphical, wysiwyg-style word processor for Linux systems. It can read Microsoft Word les and is reportedly similar to that famous word processor in some ways. DEB: abiword-common RPM: abiword WWW: http://www.abisource.com/ Full-featured, wysiwyg layout and desktop publishing system. DEB: impress RPM: impress WWW: http://www.ntlug.org/~ccox/impress/index.html
ImPress
392
LilyPond
A system for typesetting sheet music. DEB: lilypond RPM: lilypond WWW: http://lilypond.org/web/ A graphical word processor for use in X. WWW: http://sourceforge.net/projects/maxwellwp A graphical, window-based oce suite that includes a word processor called WRITER (along with spreadsheet, presentation, diagram, and database applications). DEB: openoffice RPM: openoffice WWW: http://www.openoffice.org/ The PostScript language itself. PostScript is generally considered to be a format generated by software, but some people write straight PostScript! Recipe 15.2 [Outputting Text to PostScript], page 359, has recipes on creating PostScript output from text, including outputting text in a particular font. People have also written PostScript template les for creating all kinds of documentsfrom desktop calendars to mandalas for meditation. The Debian cdlabelgen and cdcircleprint packages contain tools for writing labels for compact discs. Also of interest are the following templates for printing label inserts for video and audio tapes; edit the les in a text editor and then view or print them as you would any PostScript le. WWW: http://www.jwz.org/hacks/audio-tape.ps WWW: http://www.jwz.org/hacks/video-tape.ps A simple layout and desktop publishing system that uses Type 1 fonts. DEB: scribus RPM: scribus WWW: http://web2.altmuehlnet.de/fschmid/
Maxwell OpenOce.org
PostScript
Scribus
393
Texinfo
Texinfo is the gnu Projects documentation system, and it is excellent for writing certain kinds of technical manuals. While not extensible enough out-of-the-box for production of serious non-technical publications, it does allow for the inclusion of in-line eps images and can produce TEX-based, html, and Info output. Use it if this matches your needs. DEB: tetex-base RPM: texinfo WWW: http://www.gnu.org/software/texinfo/ a A script that converts plain text to L TEX. WWW: http://www.tex.ac.uk/CTAN/support/txt2tex/
Txt2tex
394
395
The preceding line was split because of its length, but X font names are always given on one line. The following table describes the meaning of each eld. fndry fmly wght The type foundry that digitized and supplied the font data. The name of the typographic style (for example, courier). The weight of the font, or its nominal blackness, the degree of boldness or thickness of its characters. Values include heavy, bold, medium, light, and thin.
396
slant
The posture of the font, usually r (for roman, or upright),i (italic, slanted upward to the right and diering in shape from the roman counterpart), or o (oblique, slanted but with the shape of the roman counterpart). The proportionate width of the characters in the font, or its nominal width, such as normal, condensed, extended, narrow, and wide. Any additional style descriptions the particular font takes, such as serif (fonts that have small strokes drawn on the ends of each line in the character) or sans serif (fonts that omit serifs). The height, in pixels, of the type. Also called body size. The height, in points, of the type. The horizontal screen resolution the font was designed for, in dpi (dots per inch). The vertical screen resolution the font was designed for, in dpi. The kind of spacing used by the font (its escapement class); either p (a proportional font containing characters with varied spacing), m (a monospaced font containing characters with constant spacing), or c (a character cell font containing characters with constant spacing and constant height). The average width of the characters used in the font, in 1/10th pixel units. The international standards body, or registry, that owns the encoding. The registered name of this character set, or its encoding.
swdth
adstyl
NOTES: For more information on using fonts in X, see the XFree86 Font Deuglication howto (see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50).
397
Figure 16-1. Starting xfontsel. The row of buttons are pull-down menus containing options available on your system for each eld in the X font name. Use the mouse to select items from each menu, and the X font you have selected is shown in the main window. Above it is written its X font name. To make the X font name the X selection, click the mouse on the button labeled select. This example makes the X font name the X selection, which permits you to paste the X font name on a command line or into another window (see Recipe 10.3.2 [Pasting Text], page 254).
398
To list all the X fonts on the system whose names contain the text rea, type:
$ xlsfonts '*rea*' RET
NOTES: This is not a way to display the characters in a font; for that, use xfd, described next. Furthermore, to browse through available X fonts, you want to use xfontsel, as in the previous recipe.
399
with TEX, and the precise fonts installed will dier from system to system. TEX fonts are typically stored in the /usr/share/texmf/fonts/ and /usr/local/share/texmf/fonts/ directory trees. To get a list of TEX fonts on your system, use locate to list les with a .tfm extension. These are TEX font metric les. Not all of the TEX fonts have a .tfm le, and not all of the .tfm les are usable fonts, but you can get a good idea of the TEX fonts installed on your system with this method. To list the available .tfm fonts on your system, type:
$ locate .tfm RET
NOTES: You may want to redirect the output to a le, or peruse it with less in a terminal window of its own, while you use this output to display samples of the fonts as described in the next recipe.
400
Some font les contain more than one height (or size) of the font. If a font contains more than one encoding for dierent heights, give the height to use as an argument to the -H option. (If you try to specify such a font without the height option, consolechars will output a list of available sizes.) Common console font heights include 8 (for 8x8 fonts), 14 (for 8x14 fonts), and 16 (for 8x16 fonts). To set the console font to the 8x8 size sc font, type:
$ consolechars -H 8 -f sc RET
401
The making of fonts (and even pictures) from the arrangement of ascii characters is known as ascii art. The following recipes describe methods of outputting text in these kinds of fonts.
This command outputs the text in an ascii text font, as in Figure 16-2.
_ _ _ __ _____ _____ __ _| | ___ _ __| |_ | _ \ / _ \ \ /\ / / __| / _ | |/ _ \ __| __| | | | | __/\ V V /\__ \ | (_| | | __/ | | |_ |_| |_|\___| \_/\_/ |___/ \__,_|_|\___|_| \__|
Figure 16-2. Output from figlet. Fonts for figlet are kept in the /usr/lib/figlet directory; use the f option followed by the base name of the font le (without the path or extension) to use that font. To output the contents of a text le with a figlet font, use cat to output the contents of a le and pipe the output to figlet. To output the text of the le poster in the glet bubble font, type:
$ cat poster | figlet -f bubble RET
402
To print a banner saying Happy Birthday Susan to the default printer, type:
$ banner 'Happy Birthday Susan' | lpr RET
Unfortunately, the breadth of characters that banner understands is a bit limitedthe following characters cant be used in a banner message:
< > [ ] \ ^ _ { } | ~
To make a banner of the contents of a text le, send its contents to banner by redirecting standard input (see Recipe 3.2.1 [Redirecting Input to a File], page 67). To make a banner of the contents of the le /etc/hostname, type:
$ banner < /etc/hostname RET
The default width of a banner is 132 text columns; you can specify a dierent width by specifying the width to use as an argument to the -w option. If you give the -w option without a number, banner outputs at 80 text columns. Here are two ways to use this. To make a banner containing the text Happy Birthday Susan at a width of 23 text columns, type:
$ banner -w 23 'Happy Birthday Susan' RET
403
To make a banner containing the text Happy Birthday Susan at a width of 80 text columns, type:
$ banner -w 'Happy Birthday Susan' RET
NOTES: A method of making a horizontal text banner with figlet is described in Recipe 15.2.7 [Outputting Text in Landscape Orientation], page 369.
The Linux Console Font Editor (cse), an older console font tool for editing font characters on-screen. DEB: cfe RPM: cfe WWW: http://lrn.ru/~osgene/ A tool for conguring fonts on a Debian system. DEB: defoma defoma-doc psfontmgr A console font editor. DEB: fonter WWW: ftp://metalab.unc.edu/pub/Linux/apps/misc/ A font editor that recognizes many formats, including PostScript, TrueType, and OpenType. DEB: fontforge RPM: fontforge WWW: http://fontforge.sourceforge.net/ A tool for viewing Adobe Type 1 and TrueType fonts. DEB: gfontview RPM: gfontview WWW: http://gfontview.sourceforge.net/
Fonter
FontForge
Font Viewer
404
Gozer
A tool that renders text given as an argument into an anti-aliased TrueType font. DEB: gozer WWW: http://www.linuxbrit.co.uk/gozer/ Donald E. Knuths language for designing fonts and logos (distributed with TEX). DEB: tetex-base tetex-bin tetex-doc tetex-extra RPM: tetex WWW: http://www.tug.org/teTeX/ A tool that converts fonts made with Metafont into Type 1 fonts. DEB: pktrace RPM: mftrace
Metafont
PkTrace
IV. IMAGES
405
IV. IMAGES
406
407
To view an image in X, use display, which is part of the ImageMagick suite of tools. It can recognize many image formats, including FlashPix, gif/gif87, Group 3 faxes, jpeg, pbm/pnm/ppm, PhotoCD, tga, tiff, TransFig, and xbm. It can also view images compressed with gzip or bzip2 without you having to uncompress them, and it also oers rudimentary editing facilities. The display tool takes as an argument the le name of the image to be viewed, and it displays the image in a new window of its own. To view the le sailboat.jpeg, type:
$ display sailboat.jpeg RET
408
The mouse buttons have special meaning in display. Left-click on the image window to open the display command menu in a new window. The display command menu looks like Figure 17-2.
Figure 17-2. The display command menu. The menu items let you change how the image is displayed (but they dont change the actual image le unless you save your changes to it). You can change the image size, apply eects, and otherwise change or transform the image display. Choose Overview from the Help menu for an explanation of the various commands that are available.
Figure 17-3. Image magnication in display. Middle-click on the image to open a new window with a magnied view of the image centered where you click. For example, middle-clicking on the previous sailboat image will open a new window that looks like Figure 17-3.
409
Finally, right-click on the image window for a pop-up menu containing a few of the most frequently-used commands; to choose one of these commands, drag the mouse pointer over the command and release the right button. Commands in the pop-up menu include Quit, which exits display, and Image Info, which displays information about the image le itself, including the number of colors, image depth, and resolution. The following table describes some of the keyboard commands that can be used when displaying an image in display.
SPACEBAR BKSP
Display next image specied on the command line. Display previous image specied on the command line.
CTRL CTRL
Q S
Quit displaying image and exit display. Write image to a le. Halve image size. Double image size. Return image to its original size. Rotate image 90 degrees clockwise. Rotate image 90 degrees counter-clockwise. Open a new window with image information, including resolution, color depth, format, and comments, if any. Toggle a horizontal mirror image. Toggle a vertical mirror image.
< > / \ ?
h v
The following recipes describe some special uses of display. It can also be used to view images on the Websee Recipe 33.4 [Viewing an Image from the Web], page 651.
410
them in quotes. display makes thumbnails of the specied images, and displays them in a new window, which it calls a visual image directory. Here are two ways to use this. To browse through the image les that have a .gif extension and are in the /usr/doc/imagemagick/examples directory, type:
$ display 'vid:/usr/doc/imagemagick/examples/*.gif' RET
In the preceding example, only those les with image formats supported by display are read and displayed. NOTES: If the title bar indicates that there is more than one page to the visual image directory, press SPACEBAR to advance to the next one (pressing SPACEBAR on the last page wraps back to the beginning). To open an image at its normal size, right-click the image and choose Load; the thumbnail will be replaced by its full-size image. To return to the thumbnail directory, press SPACEBAR .
411
When you run zgv with no options, it displays image icons of any images in the current directory, showing any subdirectories as folder icons. You can also give the name of a directory as an argument in order to browse the images in that directory. Here are two ways to use this. To browse the images in the current directory, type:
$ zgv RET
Use the arrow keys to navigate through the le display; the red border around an image or directory icon indicates which image or subdirectory is selected. Type RET to view the selected image or to change to the selected directory. You can manipulate the images you view in a number of wayszoom the image magnication in and out, change the brightness and color, and even make automatic slide shows of images. The following table describes some of zgvs command line options. -c Toggle image centering. Images are centered on the screen by default; specifying this option turns o centering. Ignore errors due to corrupted les, and display whatever portion of the le is displayable. Start zgv in slide-show mode, where it loops through all images specied as arguments, continuously, until you interrupt it. Toggle mouse support. Mouse support is o by default; this option turns it on. Reread and redisplay every image after every integer seconds. Useful for viewing webcam images or other image les that are continuously changing.
-i -l
-M -r integer
412
To view the le /usr/share/doc/texmf/pdftex/base/pic.png in Mozilla, type the following in its Location eld:
/usr/share/doc/texmf/pdftex/base/pic.png RET
1
The display tool is usually the default application set up for viewing images.
413
NOTES: The file: url given to Mozilla only has one preceding slash (pointing to the root directory) and not two, as in any http:// url.
To magnify the view of the document, left-click any of the buttons labeled with a percentage, such as 17%; they magnify the view by that percentage. To magnify the view by 33%, left-click the button marked 33%.
414
The following table lists the most important keystoke commands to use while previewing with xdvi.
Q N P
Advance forward to the next page. Move backward to the previous page. Same as Same as
Q Q
CTRL CTRL
. .
SPACEBAR
Scroll forward down the page, or advance forward to the next page if already near the bottom of the page. Redisplay the current page. Re-read the dvi le.
CTRL R
Press SPACEBAR to scroll down the page (and then advance to the next one, if there is one), O to open a new le, and Q to exit.
415
NOTES: The keys just described work for either ghostview or gv, but today many people prefer to use the newer gv, which was based on ghostview, but has a better interface and can preview pdf les, too.
To exit xpdf, press Q ; use the two magnifying-glass buttons to zoom the view closer in (+) or further out (-), and click on the left and right arrow buttons to move to the previous and next pages, if any. You can also select text with the mouse by clicking the rst mouse button and dragging over the block of text to select; this becomes plain ascii text in the X selection, which you may paste into another window (like a text editor, for instance, or in an xterm shell where you are using cat to redirect standard input to a le). NOTES: You can also use gv to preview pdf les (see preceding recipe).
416
The xpcd tool is an X client for viewing and browsing collections of Kodak PhotoCD images. To browse the images on a Kodak PhotoCD, mount the cd-rom (see Recipe 24.4.1 [Mounting a Data cd], page 506), and then give the mount point as an argument to xpcd. To browse the images on the PhotoCD disc mounted on /cdrom, type:
$ xpcd /cdrom RET
The preceding example will open two new windowsa small xpcd command bar window, and a larger window containing thumbnails of all PhotoCD images on the disc. To open a copy of an image in a new window, left-click its thumbnail image. When you do, xpcd will open the image at the second-smallest PhotoCD resolution, 256x384; to view it at another size, right-click the image and choose the size to view. Once the new window is drawn, you can right-click on this new image to save it as a jpeg, ppm, or tiff format image. To view an individual .pcd le with xpcd, give the name of the le as an argument. To view the PhotoCD le hawaii-001.pcd, type:
$ xpcd hawaii-001.pcd RET
NOTES: While development has been halted on xpcd, it is still a useful viewer, and comes packaged with pcdtoppm, a PhotoCD conversion tool. See Recipe 19.3 [Extracting PhotoCD images], page 445 for another recipe for extracting PhotoCD images. METHOD #2 To browse a PhotoCD archive, use display to view the overview.pcd le associated with that archive, which is kept in the top directory of the archive (for how to use display, see Recipe 17.1 [Viewing an Image in X], page 407). To browse the images on the PhotoCD disc mounted on /cdrom, type:
$ display /cdrom/overview.pcd RET
To view a particular image in a PhotoCD archive, give the le name associated with that image as an argument to display. To view the twelfth image on the PhotoCD disc mounted on /cdrom, type:
$ display /cdrom/images/img0012.pcd RET
417
To make a slide show of several images, give the number of hundredths of a second to display each image (the default is 6/100th of a second) as an argument to the -delay option, and give the names of all the image les as arguments. Here are two ways to use this. To display a slide show of all les in the ~/photos/vacation2003/roll1/640 directory, displaying each image for ten seconds before moving to the next, type:
$ animate -delay 1000 ~/photos/vacation2003/roll1/640 RET
To display an animation of four les named sample.jpg, 120.tif, sampleb.jpg, and 122.tif, displaying each image for 1/5th of a second, type:
$ animate -delay 20 sample.jpg 120.tif sampleb.jpg 122.tif RET
When animate is through displaying all of the given images, it loops back to the beginning. To set the amount of time to pause before starting over, give a second argument to -delay, specied as xnumber, where number is the number of seconds to pause before looping again. To display a slide show of all the .jpeg les in the current directory, displaying each image for the default 6/100ths of a second, and pausing for one second before repeating, type:
$ animate -delay x1 *.jpeg RET
418
To display a full-screen backdrop slide show of all the les in the ourhawaii-vacation directory, displaying each image for thirty seconds, and pausing for one minute before repeating all over again, type:
$ animate -backdrop -delay 30000x60 our-hawaii-vacation/* RET
NOTES: As with all ImageMagick tools, CTRL - Q exits. To make your own animated image les, use convert, which is also part of ImageMagick (see Recipe 18.2 [Converting Image Files], page 432).
Aview
Displays graphics as ascii art. This tool can read any image format supported by the pbmplus utility suite, and has uid zoom in/out, along with all the rendering options youd expect from a world-class viewer. DEB: aview RPM: aview WWW: http://aa-project.sourceforge.net/aview/ Displays television tuner output in any text terminal as ascii characters. DEB: aatv WWW: http://n00n.free.fr/aatv/ Changes the X background image. Allows for slide shows and other eects. DEB: chbg RPM: chbg WWW: http://chbg.sourceforge.net/ Displays images on Linux framebuer consoles. DEB: fbi RPM: fbi WWW: http://bytesex.org/fbi/
Aatv
ChBg
Fbi
419
Fbtv
Displays tv tuner images on Linux framebuer consoles. DEB: fbtv RPM: xawtv WWW: http://bytesex.org/xawtv/ Fast image viewer with many features, including the ability to show changing webcam images. DEB: feh WWW: http://www.linuxbrit.co.uk/feh/ Image viewer, browser, and simple editor, noted for its speed and small size. DEB: ida WWW: http://bytesex.org/ida/ Displays dvds. Includes dvd menu support. DEB: ogle RPM: ogle WWW: http://www.dtek.chalmers.se/groups/dvd/ Displays images in X; specializes in fast load times. DEB: qiv RPM: qiv WWW: http://www.klografx.net/qiv/ Displays images in X with a full-screen mode and many options. DEB: showimg RPM: showimg Displays images in email attachments; requires xloadimage and only works in X. DEB: metamail RPM: metamail WWW: http://tinyurl.com/323w7 Plays mpeg, mpeg2, and dvd video from a network source. DEB: vlc RPM: vlc WWW: http://www.videolan.org/
Feh
Ida
Ogle
Showpicture
VideoLAN
420
Xli
Displays images in X. DEB: xli RPM: xli WWW: http://pantransit.reptiles.org/prog/ Displays images in X; can place images in the root window. DEB: xloadimage RPM: xloadimage WWW: http://world.std.com/~jimf/xloadimage.html Displays les in the special X Window Dump le format, as created by xwd. DEB: xbase-clients RPM: XFree86-progs WWW: http://www.xfree86.org/
Xloadimage
Xwud
421
422
Ill use the image phoenix.jpeg, shown in Figure 18-1, in the examples that follow to give you an understanding of how to use mogrify. NOTES: You can also perform many of the image transformations described in the following sections interactively with the gimp (see Recipe 18.3 [Editing Images with the Gimp], page 434); another very useful package for both transforming images and converting between image formats is the netpbm suite of utilities (see Recipe 19.2 [Scanning Images], page 443).
423
To view an image at a particular scale without modifying the le, use display; when you resize its window, you resize the image on the screen only, unless you choose to save it (see Recipe 4.3.2 [Resizing an X Window], page 106).
Figure 18-3. The phoenix.jpeg image scaled to exactly 640x480 pixels. METHOD #1 To resize an image but maintain its aspect ratio, so that the ratio between the width and height stays the same, use mogrify with the -geometry option, and give the ideal width and height values, in pixels, as an argument. To resize phoenix.jpeg to 480x320 pixels, type:
$ mogrify -geometry 480x320 phoenix.jpeg RET
424
This command transforms the original phoenix.jpeg le to an image sized as close to 480x320 pixels as possible while retaining its original aspect ratio, as in Figure 18-2. METHOD #2 To resize an image to a particular image size without necessarily preserving its aspect ratio, use mogrify with the -geometry option, and append the geometry values you give as an argument with a trailing exclamation point (!). To resize phoenix.jpeg to exactly 640x480 pixels, regardless of aspect ratio, type:
$ mogrify -geometry 640x480! phoenix.jpeg RET
This command transforms the original phoenix.jpeg to an image sized at exactly 640x480 pixels, without attempting to preserve the aspect ratio of the original, as in Figure 18-3.
Figure 18-4. The phoenix.jpeg image scaled by percentage. METHOD #3 You can also scale an image by specifying the width or height by percentage with mogrify. To decrease by a percentage, give the value followed by a percent sign (%). To increase by a percentage, give the value plus 100 followed by a percent sign. For example, to increase by 25 percent, give 125%.
425
To increase the height of phoenix.jpeg by 25 percent and decrease its width by 50 percent, type:
$ mogrify -geometry 125%x50% phoenix.jpeg RET
This command transforms the original phoenix.jpeg to an image whose height was increased by 25 percent and width increased by 50 percent, as in Figure 18-4.
This command transforms the original phoenix.jpeg so that it is rotated by 90 degrees, as in Figure 18-5.
Figure 18-5. The phoenix.jpeg image rotated. NOTES: After this command, the width of phoenix.jpeg now exceeds its height, so to rotate it again use > instead of <.
426
This command transforms the original phoenix.jpeg to a black and white image, as in Figure 18-6.
Figure 18-7. The phoenix.jpeg image in dithered black and white. Use the -dither option to reduce the colors with Floyd-Steinberg error diusion, a popular algorithm for improving image quality during color reduction. To reduce the colors in phoenix.jpeg to four and apply Floyd-Steinberg error diusion, type:
$ mogrify -colors 4 -dither phoenix.jpeg RET
This command transforms the original phoenix.jpeg to a dithered black and white image, as in Figure 18-7.
427
Use the -map option with a second le name as an argument to read the color map (the set of colors) from the second image and use them in the rst image. To change the colors in the le rainbow.jpeg to those used in the le prism.jpeg, type:
$ mogrify -map prism.jpeg rainbow.jpeg RET
Use the -monochrome option to make a color image black and white. To make the color image rainbow.jpeg black and white, type:
$ mogrify -monochrome rainbow.jpeg RET
If you have a ppm le, use ppmquant to quantize, or reduce to a specied quantity, the colors in the imagesee the ppmquant man page for details (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46). Because of dierences in display hardware, the brightness of an image may vary from one computer system to another. For example, images created on a Macintosh usually appear darker on other systems. When you adjust the brightness of an image, it is called gamma correction. To adjust the brightness of an image, give the numeric level of correction to apply as an argument to the -gamma option. Most pc displays have a gamma value of 2.5, while Macintosh displays have a lower gamma value of 1.4. To set the gamma correction of the image rainbow.jpeg to .8, type:
$ mogrify -gamma .8 rainbow.jpeg RET
428
METHOD #1 Use wrjpgcom to write a comment in a jpeg le. Quote the comment as an argument to the -comment option, and give the name of the input le as an argument. The default is to write a new jpeg le to the standard output. To annotate an image in the le map.jpeg with the text Map not drawn to full scale and write it to a le warnmap.jpeg, type (all on one line):
$ wrjpgcom -comment "Map not drawn to full scale" map.jpeg > warnmap.jpeg RET
Use a Bash for loop to make the same annotation in a group of les (see the Bash Info documentation for more information on this built-in). To annotate all of the .jpg les in the current directory with the comment Image courtesy Rick Blaine, writing to a new le with the same base name but a .jpeg extension, type:
$ for i in *.jpg RET > { RET > wrjpgcom -comment "Image courtesy Rick Blaine" $i `basename $i jpg`jpeg RET > } RET $
The previous example could also have been written on a single input line, omitting the for loop, as follows:
for i in *.jpg; { wrjpgcom -comment "Image courtesy Rick Blaine" $i `basename $i jpg`jpeg; } RET
METHOD #2 Use mogrify with the -comment option to annotate image les with a comment. Give the comment in quotes as an argument to the option. To annotate the image le phoenix.jpeg, type (all on one line):
$ mogrify -comment "If you can read this, you're too close!" phoenix.jpeg RET
429
METHOD #3 To read annotations in jpeg les, use the rdjpgcom toolit outputs any comments in the jpeg le whose le name is given as an argument. To read any comments made in the image le phoenix.jpeg, type:
$ rdjpgcom phoenix.jpeg RET If you can read this, you're too close! $
This command transforms the original phoenix.jpeg to an image with a 2x4 pixel border, as in Figure 18-8.
Figure 18-8. The phoenix.jpeg image with a border. The -frame option works like -border, but it adds a more decorative border to an image. To add a decorative frame eight pixels wide and eight pixels high to phoenix.jpeg, type:
$ mogrify -frame 8x8 phoenix.jpeg RET
430
This command transforms the original phoenix.jpeg to an image with an 8x8 decorative frame, as in Figure 18-9.
Figure 18-9. The phoenix.jpeg image with adecorative frame. NOTES: The border or frame is added to the outside of the existing image; the image is not cropped or reduced in size to add the border.
NOTES: In this example, three jpegs were read and output to a png le; to specify the format to use in the output, give the appropriate le extension in the output le name.
431
the two images on top of the larger, starting in the top left corner; if both images are the same size, only the second image is visible. To combine two images, ashes.jpeg and phoenix.jpeg, into a new le picture.jpeg, type:
$ composite ashes.jpeg phoenix.jpeg picture.jpeg RET
You can specify the percentage by which to blend the two images with the -dissolve option. Give the percentage to dissolve the rst image into the second as an argument to the option. To combine the image les ashes.jpeg and phoenix.jpeg so that the new image contains 70 percent of the rst image dissolved into the second, type:
$ composite -dissolve 70 ashes.jpeg phoenix.jpeg picture.jpeg RET
This command combines the two images and writes a new image le, picture.jpeg, whose contents contain 70 percent of the rst image. NOTES: Use -dissolve 50 to blend the two source les equally.
432
This command writes ve new png-format les: morph.png.0, which is identical to ashes.jpeg; morph.png.4, which is identical to phoenix.jpeg; and morph.png.1, morph.png.2, and morph.png.3, which contain transformations between the rst and the last images. To morph the les ashes.jpeg and phoenix.jpeg, making a new le called morph.miff containing an animated sequence of 25 transformative steps, with each frame in the sequence being displayed for a fth of a second, type:
$ convert -morph 25 -delay 20 ashes.jpeg phoenix.jpeg morph.miff RET
This command makes a new le, morph.miff, which contains an animated sequence of 27 images. Each image in the sequence is displayed for a fth of a second. When the sequence is nished, it repeats. Use a tool like animate to view it (see Recipe 17.6 [Viewing an Animation or Slide Show], page 417). NOTES: Another tool, xmorph, is a special X application for morphing images; see Recipe 18.4 [Using Other Image Editors], page 435.
This command converts the jpeg image phoenix.jpeg to png format and writes it to a new le, phoenix.png. When converting a le to jpeg format, be sure to use the -interlace NONE option to make sure the resultant jpeg image is non-interlacedunless, of course, you want an interlaced image. An interlaced image is drawn in multiple passes, and is often used on the Web where a reader may view the
433
low-resolution image consisting of early passes before the entire image is downloaded. A non-interlaced image is drawn in one single pass. To convert the pnm le pike.pnm to non-interlaced jpeg, while sharpening the image by 50 percent and adding both a 2x2 border and a copyright comment, type (all on one line):
$ convert -interlace NONE -sharpen 50 -border 2x2 -comment 'Copyright 2008 Toby Smith' pike.pnm pike.jpeg RET
This command writes its output to the le pike.jpeg. Notice that the options -border and -comment were previously described for the mogrify tool. Some ImageMagick tools share common options, which is useful if you are making multiple changes to an image le at once; only one tool is needed for the job. You can convert to and from any of the image formats recognized by ImageMagick, including animations. To make an animation, give as arguments the names of the les for the individual frames, in the sequence you want them to appear, and give the name of the new le as the nal argument. Formats that support animations include miff and gif. Use the -delay option to specify the delay, in hundredths of a second, between frames. To make an animated miff le, driving.miff, out of all the les drive1.jpg, drive2.jpg, drive3.jpg, drive4.jpg, and drive5.jpg, with a delay of a fth of a second between frames, type (all on one line):
$ convert -delay 20 drive1.jpg drive2.jpg drive3.jpg drive4.jpg drive5.jpg driving.miff RET
NOTES: Some image formats are lossy, which means some image information is lost when you convert to it. For example, the jpeg format is a lossy format that is usually used for photographic images. If you convert a le from its source pnm format to jpeg and then back to pnm, the resultant pnm will not be identical to the original source pnm. To convert image les interactively, open the image in the gimp, and then choose Save as from the File menu, and select the le type to use; see the following recipe for more information.
434
435
The gimp runs under X and is started by running gimp or choosing it from your window managers menu. Give the names of any image les to open as arguments. To start the gimp in the background from a shell prompt, type:
$ gimp & RET
When started, any image les you give as arguments are opened in their own windows. The main gimp panel will open in a window of its own, as in Figure 18-10.
Figure 18-10. The main gimp panel. NOTES: To learn the basics of using the gimp, consult The GIMP Users Manual and the other documentation and resources available from the gimp Web site [http://www.gimp.org/]. You can also install the manual on your system; on Debian systems, it comes separately in the gimp-manual package.
436
Aa3d
Generates ascii art stereograms. DEB: aa3d RPM: aa3d WWW: http://aa-project.sourceforge.net/aa3d/ Converts bitmap images to vector graphics format. DEB: autotrace RPM: autotrace WWW: http://autotrace.sourceforge.net/ Makes barcode images; recognizes all of the commercial standards. DEB: barcode RPM: barcode WWW: http://tinyurl.com/36s28 Editor for bitmap les, which are used for icons and tile patterns in the X Window System (see Recipe 4.7.3 [Changing the Root Window Parameters], page 118). DEB: xbase-clients RPM: XFree86-progs WWW: http://www.xfree86.org/ Hugely popular 3d modeling, rendering, animation and game design software. DEB: blender RPM: blender WWW: http://www.blender.org/ Draws ascii art. DEB: cadubi WWW: http://langworth.com/CadubiProject Two related tools for drawing interactive geometric gures. DEB: drgenius RPM: drgenius WWW: http://ofset.sourceforge.net/drgenius/ WWW: http://ofset.sourceforge.net/drgeo/
AutoTrace
Barcode
Bitmap
Blender
CADUBI
Drgenius Drgeo
437
Dia
Drawing tool for simple charts and diagrams. Exports les to eps (see Chapter 20 [PostScript], page 451). DEB: dia dia-common RPM: dia WWW: http://www.gnome.org/projects/dia/ Processes tv input through various special eects. DEB: effectv cad system for designing images of electric circuits, schematics, and the like. DEB: electric RPM: electric WWW: http://tinyurl.com/3yzbf Vector graphics editor, intended to be easier to pick up than the classic Xg (listed below), yet remaining compatible with Xgs le format. DEB: figurine RPM: figurine WWW: http://figurine.sourceforge.net/ Performs a visual di on two image les; given a set of les, it nds similar or duplicate images. DEB: findimagedupes WWW: http://www.kudla.org/raindog/perl/ Robust, non-interactive function-plotting tool. Generates charts and graphs from a data le and a formula (see Recipe 29.8 [Plotting Data], page 575). DEB: gnuplot RPM: gnuplot WWW: http://www.gnuplot.info/ 3d modeling program. DEB: innovation3d innovation3d-plugins WWW: http://innovation3d.sourceforge.net/
Eectv Electric
Figurine
Findimagedupes
Gnuplot
Innovation3d
438
Ivtools
Suite of drawing editors, including idraw, a vector graphics editor. DEB: ivtools-bin RPM: ivtools WWW: http://www.ivtools.org/ivtools/ Tool for drawing patterns and tilings, including frieze patterns and innite or recursive tiles in the spirit of M.C. Escher. DEB: kali Digital video editor that also has facilities to import from digital movie cameras. DEB: kino RPM: kino WWW: http://kino.schirmacher.de/ 3d cad system for designing furniture. WWW: http://tinyurl.com/ysl5o Formerly the Moonlight Creator, this tool is an X client for modeling, illuminating, and rendering 3d scenes. WWW: http://moonlight3d.net/ Professional 2d cad system that saves its les in the industry dxf format. DEB: qcad RPM: qcad WWW: http://www.ribbonsoft.com/qcad.html Tool DEB: RPM: WWW: for creating 3d scenes. sced sced http://tinyurl.com/2g4oy
Kali
Kino
LignumCAD Moonlight3d
QCad
Sced
Skencil
Full-featued vector drawing program (formerly Sketch) that supports Bzier curves, gradients, blending, and all the e other features you would expect from such an application. DEB: sketch RPM: sketch WWW: http://sketch.sourceforge.net/
439
Sodipodi
Powerful vector drawing program that uses svg format. DEB: sodipodi RPM: sodipodi WWW: http://sodipodi.sourceforge.net/ Interactive 2d drawing tool for X. DEB: tgif RPM: tgif WWW: http://bourbon.usc.edu:8001/tgif/ Tool for drawing gures like those used in graphs, diagrams, and presentations. DEB: tkpaint RPM: Tkpaint WWW: http://mars.netanya.ac.il/~samy/tkpaint.html Venerable application used for drawing gurescomplex graphs, oor plans, maps, ow charts, and so forth. It saves les in its own format (giving them a .fig extension by default); the usual thing to do is export to eps format. DEB: xfig RPM: xfig WWW: http://xfig.org/ Morphs two images together (sometimes referred to as warping), making a new image in the process. The input images must be in TrueVision Targa le format, and have the same size, shape, and number of pixels in each le. (For a quick and easy way to morph two images using the ImageMagick suite, see Recipe 18.1.8 [Morphing Two Images Together], page 431.) DEB: xmorph WWW: http://xmorph.sourceforge.net/ Simple color paint tool that predates the gimp. It contains all of the basic features that you would expect from an archetypal computer paint program. If you dont need the gimps advanced capabilities, consider running the smaller xpaint instead. DEB: xpaint RPM: xpaint WWW: http://sf-xpaint.sourceforge.net/
Tgif
TKpaint
Xg
Xmorph
Xpaint
440
441
442
To capture a particular window, including its window manager frame, and write it to a png-format le, do the following: 1. Run import:
$ import -frame session-1.png RET
2. Left-click on the window you want to capture. In this example, the screen shot is saved to a le called session-1.png. If the window or area you would like to capture is in another X desktop, or is otherwise removed somewhat from the terminal window where you are running the import command, you can use sleep rst to delay the command for a few seconds while you position the mouse pointer. To run import to make an eps screen capture in ve seconds to a le called historic_moment.eps, type:
$ sleep 5; import historic_moment.eps RET
This command will run import ve seconds after you type RET , which should give you time to get the mouse pointer where you want it. NOTES: The system bell rings once when the screen capture starts, and twice when the captures nishes.
NOTES: You must have superuser privileges to access these les (see Appendix A [Administrative Issues], page 699). Take the screen shot from a virtual console other than the one you want to take a shot of; if you try to take it from the same console you want to capture, the command line you give will be included in the shot! (Kind of like having your thumb in front of the lens while taking a photograph.)
443
Screenshots taken of virtual consoles, as shown in this recipe, are saved as text les; you cant take screen shots of virtual consoles when graphics are displayed.
444
In this example, theres one scanning device on this system, a umax brand scanner that can be specied to scanimage by giving its device name, umax:/dev/sgb, as an argument to the -d option. To list the available resolutions and options supported by a particular device, use the --help option along with the -d option followed by the device name. To list available options supported by the device listed in the previous example, type:
$ scanimage --help -d 'umax:/dev/sgb' RET
NOTES: For all scanimage commands, specify the scanner device you want to use by including the -d option with the device name.
Use scanimage to scan an image. Most scanners let you specify the x and y values, in pixels, for the image size to scan, starting from the top-left corner of the scanner bed. Give these coordinates as arguments to the -x and -y options. Also, use the --resolution option to specify the scan resolution, with the argument given in dpi (dots per inch). Common resolution values include 72, 120, 204, 300, and 600 dpi; 72 dpi is the most popular resolution for use on the Web or for viewing on screen, and 204 dpi is often used for images that you want to send on a fax machine. Scanned output is sent to standard output, so to scan an image to a le, redirect the standard output. scanimage outputs images in the pnm (portable anymap) formats, so make sure that you have the netpbm package (installed on most Linux systems
445
by default); its a useful collection of tools for converting and manipulating these common formats. The three pnm formats output by scanimage are as follows: PPM PBM PGM Color images Black and white images Grayscale images
Use the codemode option to specify the format of the output, followed by one of the following arguments: color for color ppm, gray for pgm grayscale, or lineart for black and white pbm. Each scanner has a default mode; for most color scanners, the default mode will be color. Here are two ways to use this. To make a 72 dpi scan of a color image 200 pixels wide and 100 pixels tall, using the umax scanner from previous examples, and writing to a le called scan.ppm, type (all on one line):
$ scanimage -d umax:/dev/sgb --resolution 72 -x 200 -y 100 > scan.ppm RET
To make a 300 dpi scan of a black and white image 180 pixels wide and 225 pixels tall, using the umax scanner from previous examples, and writing to a le called scan.pbm, type (all on one line):
$ scanimage -d umax:/dev/sgb --resolution 300 --mode lineart -x 180 -y 225 > scan.pbm RET
NOTES: The command lines in this recipe are split across two lines because theyre too long to t on one, but type these commands on one long line. Once the image has been scanned and written to a le, you can edit it just as you would any image.
446
le1 (also known as pcd). If you are browsing the PhotoCD les with the xpcd tool, then choose an image, extract a copy at the desired resolution, and save it to a le as described in Recipe 17.5 [Browsing PhotoCD Archives], page 415. You can also use pcdtoppm on a pcd le directly to extract an image at a given resolution and save it to a le in ppm format.2 Use the -r option to specify the resolution to extract, given as a numeric argument from 1 (lowest resolution) to 5 (highest); if this option is omitted, a value of 3 is assumed. Also give as arguments the name of the pcd le to read from and the name of the ppm le to write to. To extract the highest resolution image from the le sharp.pcd and save it to a pnm le named sharp.ppm, type:
$ pcdtoppm -r5 sharp.pcd sharp.ppm RET
This is a proprietary scanned-image format from Kodak, and it is currently a standard for scanning lm images to digital format. On some systems, the command is hpcdtoppm, not pcdtoppm.
447
Extracted PhotoCD images are sometimes known to have a kind of green haze over them; to remove it, open the image in the gimp and adjust the color levels with the Auto Levels function. This technique works well for improving any scanned or imported image. To remove the green haze from a PhotoCD image, do the following: 1. Open the extracted image in the gimp (see Recipe 18.3 [Using the gimp], page 434). 2. Click through the Image menu to the Colors submenu and then to the Levels submenu, and choose Auto Levels. 3. Click OK in the Levels window to accept the changes.
448
You can use echo to send the text to enscript, and pipe the output right to convert. Use 0x0 as an argument to the -crop option to automatically trim this image around the text. To make a png image of the text Amateur Radio History Page in the Times Roman Bold font at 42 points, type (all on one line):
$ echo "Amateur Radio History Page" | enscript -o - -B -f "Times-Bold42" | convert -crop 0x0 - arhp.png RET
Figure 19-1. An image made from text. Use the -border and -bordercolor options to draw a border (given as an argument to the rst option of widthxheight) in any color (given as an argument to the second option). To make a png image of the text Amateur Radio History Page, in the Times Roman Bold font at 42 points and with a blue border ve pixels wide and ve pixels high, type (all on one line):
$ echo "Amateur Radio History Page" | enscript -o - -B -f "Times-Bold42" | convert -crop 0x0 -border 5x5 -bordercolor blue - newarhp.png RET
This command makes a png image le, newarhp.png, as in Figure 19-2. (While the printed illustration is in black and white, the actual image created from this command has a blue colored border.)
Figure 19-2. A bordered image made from text. NOTES: This method is also good for turning groff table output into images. METHOD #2 If the text is displayed on the screen in X, use import to capture it as an image, as described in Recipe 19.1.1 [Taking a Screen Shot in X], page 441. METHOD #3 To make a bitmap image from some text, use the pbmtext lter. It takes any text sent to it as input, and it outputs an image le in pbm format.
449
To make a pbm image out of the text Recommended Reading, writing the new le to header.pbm, type:
$ pbmtext Recommended Reading > header.pbm RET
This is useful for making image les of large texts, for purposes such as including that text as an illustration. To send a compressed le to pbmtext, use zcat (otherwise, the < redirection operator works ne). To make a jpeg image containing the contents of the compressed le /usr/share/state/us-constitution.gz, writing to a le named constitution.jpeg, type (all on one line):
$ zcat /usr/share/state/us-constitution.gz | pbmtext | convert - constitution.jpeg RET
Camediaplay Downloads images from any digital cameras with Sanyo rmware, including the Olympus Camedia series. DEB: camediaplay RPM: camediaplay Cqcam Captures images from Color QuickCams. DEB: cqcam RPM: cqcam WWW: http://www.cs.duke.edu/~reynolds/cqcam/ Captures audio and video from those digital camcorders that use a ieee1394 link (also known as FireWire), writing the output as an avi le. DEB: dvgrab RPM: dvgrab WWW: http://kino.schirmacher.de Imports images from (and otherwise manipulates) Fuji digital cameras. DEB: fujiplay
Dvgrab
Fuji
450
GOCR
Command line ocr tool that outputs plain text from scanned images. DEB: gocr RPM: gocr WWW: http://jocr.sourceforge.net/ Imports images from digital cameras. DEB: gphoto RPM: gphoto WWW: http://www.gphoto.org/ Merges partial scans together to form larger images. DEB: grunch WWW: http://www.radagast.org/~dplatt/ Imports black-and-white images from pressure-sensitive input devices, such as drawing tablets. DEB: gsumi Imports images from digital cameras that use the stv0680b001 chip. DEB: pencam WWW: http://stv0680-usb.sourceforge.net/ Captures images from video4linux devices. DEB: streamer RPM: xawtv-streamer WWW: http://bytesex.org/xawtv/
gPhoto
Grunch
Gsumi
Pencam
Streamer
451
20. PostScript
The PostScript programming language, designed and implemented in the early 1980s by John Warnock of Adobe Systems, is used to describe the way a page should look. Pages are usually a physical sheet of paper (PostScript is commonly used for sending documents to printer hardware), but they can be any kind of output display.1 PostScript les are text les containing the PostScript language commands for drawing images to be printed on pages. Like plain text les, PostScript les are commonly found on the Internet (and are used by commercial printers) because, as with plain text, they can be shared across platforms and hardware without diculty. The same PostScript le can be output on a high-end display or printed on a low-end printer, to the best of that hardwares capability. PostScript is a compact and elegant format. While its possible to write directly in the PostScript language (and some people have become adept at programming PostScript), so many tools and applications convert les to and from PostScript that you dont have to write it yourself. See Recipe 15.2 [Outputting Text to PostScript], page 359, for a way to convert plain text into PostScript. gnu Ghostscript is a free interpreter of the PostScript language.2 It comes with gs, a tool that is used to convert les from PostScript or pdf to other formats. Its usually used for printing to a non-PostScript printer (see Recipe 25.3.1 [Preparing a PostScript File for Printing], page 518). The ghostview tool is used to preview PostScript les on the screen (see Recipe 17.4.2 [Previewing a PostScript File], page 414). eps, or Encapsulated PostScript, is a le format that describes the contents of a box within a page. eps les can be embedded in the page of a PostScript le, and they are therefore commonly used when inserting an illustration into a document (for example, all of the illustrations printed in the Cookbook are eps format les). You can view and print eps les just as you would PostScript les. This chapter includes recipes for formatting and manipulating PostScript les. Recipes are separated according to whether they work on the individual, logical pages in a PostScript le (the numbered pages in the le that are not necessarily the physical pages of output), and those that work on the entire le as a whole.
1 2
PostScript was originally designed for the Apple LaserWriter printer; news was an old unix windowing system by Sun Microsystems that used PostScript to draw the display. It is also an interpreter of Adobes Portable Document Format (pdf) language.
452
Many of the tools used in this chapter come as part of Angus Duggans psutils (PostScript Utilities) package. These tools can be used for other purposes than those described in this chapter; see their respective man pages for more details.
By default, dvips will output to the printer; to save the PostScript output to a le, specify the le name to be used for output as an argument to the -o option. To output as PostScript the pages 137 to 146 of the le abstract.dvi, and write them to the le abstract.ps, type:
$ dvips -pp137-146 -o abstract.ps abstract.dvi RET
453
Give the pages to select as arguments to the -p option; you can list single pages and ranges of pages separated by commas. Give ranges as two numbers separated by a hyphen; thus, 4-6 species pages four through six, inclusive. If you omit the rst number in a pair, the rst page is assumed, and if you omit the last number, the last page is assumed. Pages are written to the new le in the order they are specied. Here are some ways to use this. To select page 47 from the PostScript le newsletter.ps and output it to the le selection.ps, type:
$ psselect -p47 newsletter.ps selection.ps RET
To select the rst ten pages, page 104, pages 23 through 28, and page 2 from the le newsletter.ps and write them to the le selection.ps, type:
$ psselect -p1-10,104,23-28,2 newsletter.ps selection.ps RET
To select page 47 from the PostScript le newsletter.ps and output it to the le selection.ps, type:
$ psselect -p47 newsletter.ps selection.ps RET
(In the second example above, page 2 is selected twicerst in the selection of pages 1-10, and then later on its own.) You can specify reverse ranges, with the higher page listed rst in the range, to output pages running backwards from that page toward the lower page. You can also specify pages by their position relative to the last page in the document. Do this by prexing a number with an underscore (_), which indicates that the given page number is counting backwards toward the rst page. Here are some ways to use this. To select pages 30 to 25 from the PostScript le newsletter.ps and output them to the le selection.ps, type:
$ psselect -p30-25 newsletter.ps selection.ps RET
To select the last page from the PostScript le newsletter.ps and output it to the le end-notes.ps, type:
$ psselect -p_1 newsletter.ps end-notes.ps RET
To select the second-to-last through the tenth-to-last pages from the PostScript le newsletter.ps and output them to the le selection.ps, type:
$ psselect -p_2-_10 newsletter.ps selection.ps RET
454
To select the second-to-last through the tenth pages from the PostScript le newsletter.ps and output them to the le selection.ps, type:
$ psselect -p_2-10 newsletter.ps selection.ps RET
If the le newsletter.ps in the last example contained only 12 pages, the example is equivalent to running psselect with -p12-10. Use the -e option to select all even-numbered pages, and use the -o option to select all odd-numbered pages. Here are two ways to use this. To select all of the even pages in the le newsletter.ps and write them to a new le, even.ps, type:
$ psselect -e newsletter.ps even.ps RET
To select all of the odd pages in the le newsletter.ps and write them to a new le, odd.ps, type:
$ psselect -o newsletter.ps odd.ps RET
Use an underscore (_) alone to insert a blank page, and use -r to output pages in reverse order. Here are two ways to use this. To select the last ten pages of le newsletter.ps, followed by a blank page, followed by the rst ten pages, and output them to a new le, selection.ps, type:
$ psselect -p_1-_10,_,1-10 newsletter.ps selection.ps RET
To select the pages 59, 79, and 99 in the le newsletter.ps, and output them in reverse order (with the 99th page rst) to a new le, selection.ps, type:
$ psselect -p59,79,99 -r newsletter.ps selection.ps RET
The same result as the last example could have been gotten by omitting the -r option and just listing the three pages in the reverse order, like so:
$ psselect -p99,79,59 newsletter.ps selection.ps RET
455
Use psnup to print multiple PostScript pages on a single sheet of paper; give as an option the number of pages to be combined (or put up) on each sheet. To make a new PostScript le, double.ps, putting two pages from the le single.ps on each page, type:
$ psnup -2 single.ps double.ps RET
To specify the paper size, give the name of a standard paper size as an argument to the -p option: a3, a4, a5, b5, letter, legal, tabloid, statement, executive, folio, quarto, or 10x14. You can also specify any height and width with the -h and -w options; units can be specied in centimeters (followed by cm) or inches (followed by in). If no size is specied, psnup assumes a paper size of a4. Use the -l option when pages are in landscape orientation (rotated 90 degrees counterclockwise from portrait orientation), and -r when pages are in seascape orientation (rotated 90 degrees clockwise from portrait orientation). Pages are placed in row-major layout in the output le, where logical pages are placed in rows across the page. Use the -c option to specify a column-major layout, where logical pages are placed in columns down the page. Scale the size of the pages by giving a percentage to multiply the page size by as an argument to the -s option; for example, -s .5 scales pages to 50 percent of their original size. To draw a border around each page, specify the borders width in points as an argument to the -d option (if no width is specied, a value of 1 is assumed).
456
psbook reads the contents of the rst, rearranges the pages, and then writes the PostScript output to the second le. To rearrange the pages of le newsletter.ps into a signature and write it to the le newsletter.bound.ps, type:
$ psbook newsletter.ps newsletter.bound.ps RET
By default, psbook uses one signature for the entire le. If the le doesnt contain a multiple of four pages, it adds blank pages to the end. To specify the size of the signature to usein other words, the number of pages that will appear on a single piece of papergive the number as an argument to the -s option. Signature size is always a multiple of four. To rearrange the pages of le newsletter.ps into an eight-sided signature and write it to newsletter.bound.ps, type:
$ psbook -s8 newsletter.ps newsletter.bound.ps RET
457
NOTES: If you plan on doing a lot of this, you can simplify things by putting the following in a shell script (see Recipe 3.7 [Using Shell Scripts], page 84), that you might call pscat:
#!/bin/sh gs -q -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=$*
Then, call the script with the name of the le to write to as the rst argument, and following that, give the names of the les to combine in the order you wish them to be combined.
458
Use psmerge to combine PostScript les into one. Give the names of the les to be merged as arguments, and psmerge outputs them to the standard output in the order given. You can also specify an output le name with the -o option (dont put any spaces between the le name and the option). To merge the les slide1.ps, slide2.ps, and slide3.ps into a new PostScript le, slideshow.ps, type:
$ psmerge -oslideshow.ps slide1.ps slide2.ps slide3.ps RET
NOTES: The gs method is really preferable; psmerge only works with PostScript les that were made with the same application. For example, psmerge would allow you to merge multiple les made with TEX, or multiple les made with Xg, but not a combination of the two.
459
2. Put the pages two to a page in landscape orientation, at 70 percent of their original size (typed all on one line):
$ psnup -l -pletter -2 -s.7 newsletter.signature.ps > newsletter.2up.ps RET
Then, to print the booklet, send odd.ps to the printer, reload the printed pages in the manual feed tray, and then send even.ps to the printer. This prints the odd and even pages on opposite sides of the sheets. To make a double-sized booklet on letter-sized paper in landscape orientation from a le using letter-sized portrait orientation, type:
$ psbook input.ps > temp1.ps RET ...processing messages... $ psnup -l -pletter -2 -s.7 temp1.ps > temp2.ps RET ...processing messages... $ pstops "2:0(1in,0in)" temp2.ps > odd.ps RET ...processing messages... $ pstops "2:-1(1in,0in)" temp2.ps > even.ps RET ...processing messages... $
NOTES: If you will be doing a lot of this, you may want to have a look at the ps2book utility, which is a script that aids in making booklets with psutils [http://www.kis.uni-freiburg.de/~dobler/utils/ps2book.html].
460
This command writes a new le in pdf format called sutra.pdf. The original le, sutra.ps, is not altered. NOTES: To make proper pdf conversions, make sure that you have Ghostscript version 6.01 or higher installed; use the -v option with gs to output the installed version.
V. SOUND
461
V. SOUND
462
463
464
The following table describes some of the important sound groups that amixer lists. Master PCM CD Synth Line MIC Master volume settings. Digital audio for playing sound les; the rst channel is group PCM,0 and the second is PCM,1. Audio compact disc player (a cable must be connected from the cd drive to the sound card). Synthesizer device for midi. Sound input device (the jack on the back of the sound card is usually labeled line in). Microphone device (the jack on the back of the sound card is usually labeled mic).
To list the settings for only one group, use the get option followed by the name of the group you want to list. Group names are case sensitiveso giving MIC species the microphone group, while Mic and mic are not valid groups at all. Here are two ways to use this. To output the microphone settings, type:
$ amixer get MIC RET
465
466
NOTES: You can have only one group selected for capture at a time, and when you select a group as an input source for recording, you are simply turning the microphone or other input on; recording does not occur until you use a recording tool.
NOTES: Before you begin playing sound, make sure youve set the master and pcm volume levels with the mixer (see Recipe 21.1 [Adjusting the Audio Controls], page 463). The most common reason for no sound being produced when you try to play sound is not having the volume turned up! alsa comes with aplay, a tool for playing sound les that is similar to play but does not recognize as many formats.
467
By default, ogg123 sends to the standard sound device. You can specify a sound deviceuseful on systems that have more than one device installed by using the -d option, followed by a special argument as described in the following table.
Null driver, used for testing purposes. Open Sound System (oss/free) driver. Advanced Linux Sound Architecture (alsa) driver. Enlightened Sound Daemon driver. wav format audio output.
$ ogg123 -d oss archive.ogg RET
To play the le archive.ogg using the oss driver, type: Use the -k option to skip part of the beginning of the recording. Give the number of seconds to skip as an argument to the option. To play the le archive.ogg, beginning exactly one minute into the recording and using the alsa driver, type:
$ ogg123 -k 60 -d alsa archive.ogg RET
To play les in random order, give the -z option. This is useful for when you want to shue the tracks of an audio archive. To play all of the .ogg audio les in the ~/audio/incoming directory, shuing the order of the tracks, type:
$ ogg123 -z ~/audio/incoming/*.ogg RET
468
METHOD #1 Playmidi DEB: playmidi RPM: playmidi WWW: http://sourceforge.net/projects/playmidi/ If your sound card has a midi sequencer, use playmidi to play midi les; give the name of the midi le to play as an argument. To play the midi le copacabana.mid, type:
$ playmidi copacabana.mid RET
METHOD #2 Playmidi DEB: playmidi RPM: playmidi WWW: http://sourceforge.net/projects/playmidi/ or TiMidity++ DEB: timidity RPM: timidity WWW: http://www.onicos.com/staff/iz/timidity/ If you have a non-midi sound card, you can still play midi les by using timidity, which converts the midi format into wav format, and then plays it. To play the midi le copacabana.mid on a non-midi sound card by converting it to wav format, type:
$ timidity copa-cabana.mid RET
On some systems with non-midi sound cards, you can also use playmidi with the -f option. This species that midi output is to be sent to the fm synthesizer on the sound card, which in turn plays it using fm patches that come with the playmidi distribution. To play the midi le copacabana.mid on a non-midi sound card using fm patches, type:
$ playmidi -f copacabana.mid RET
469
F1
to
To buer the audio, useful for when the system is running many processes or otherwise has a lot of activity, give a buer size, in kilobytes, as an argument to the -b option. The default is 0 (no buer); if you need this option, use a size of at least 1024 kb (which is 1 mb), or about six seconds of mp3 audio. NOTES: The mpg321 tool is a free software replacement of mpg123, another command line mp3 player that is not free software. The use of the mp3 format is waning now with the rise of Ogg Vorbis, a format that has better audio quality, smaller les, and most importantly
470
of all is not patented, as the mp3 format is. Even outside the Linux world, where mp3 still enjoys popularity, support for Ogg Vorbis is growing among hardware vendors, radio stations, and audiophiles.
METHOD #2 Splay DEB: RPM: WWW: Wget DEB: RPM: WWW: splay splay http://splay.sourceforge.net/ wget wget http://www.gnu.org/software/wget/wget.html
To play streaming mpeg audio with an mp3 player that doesnt take urls as an option, rst get the stream with wget using -O- to send it to the standard output, and pipe this output to an mp3 player. Make sure the mp3 player is
471
set to read mpeg audio from standard inputwith splay, this means giving the special -M option to read from standard input and not a le. To play the streaming mpeg audio that is broadcast at http://vox.wclv.com/cgi-bin/swsend/tmp/source3, type (all on one line):
$ wget -O- http://vox.wclv.com/cgi-bin/swsend/tmp/source3 | splay -M RET
To save a copy of the audio to a le and listen to it while its being downloaded, just branch the pipeline with tee (see Recipe 3.2.5 [Redirecting Output to More than One Place], page 69). To to play the streaming mpeg audio that is broadcast at http://voc.wclv.com/cgi-bin/swsend/tmp/source3, and save a copy of the audio in a le named wclv.20051220.mp3, type (all on one line):
$ wget -O- http://voc.wclv.com/cgi-bin/swsend/tmp/source3 | tee wclv.20051220.mp3 | splay -M RET
NOTES: Often when streaming mpeg audio is oered by a site, a link to a le with an .m3u extension will be given as the address to use for listening. This is actually not a link to the streaming audio itself, but to a le that contains the url to which the actual streaming audio is being broadcast. To use this link, rst output the contents of this le to the standard output with wget -O- followed by the url, and then select that url with the mouse so you can paste it in the wget command that you pipe to splay, as demonstrated above (see also Recipe 10.3 [Manipulating Selections of Text], page 253).
472
473
Recording occurs from the currently active input, if any, which must be set with the mixer; unmute it and set its volume level before you begin recording. (Be sure to turn the volume on your speakers all the way o, or youll get feedback.) To record audio to a le, use the rec tool. It can write many audio le formats, either to a format you specify with the -t option, or by determining the format to use based on the le name extension you give the output le (see Appendix B [Conventional File Name Extensions], page 723). Type CTRL - C to stop recording. Give the name of the sound le to record as an argument; if a .wav le is specied, it records a simple monaural, low-delity sound sample by default. To record a simple wav sample from the microphone and save it to a le called hello.wav, type:
$ rec hello.wav RET
This command begins an 8,000 Hz, monaural, 8-bit wav recording to the le hello.wav, and it keeps recording until you interrupt it with CTRL - C . While the default is to make a low-delity recording8,000 Hz, monaural, 8-bit samplesyou can specify that a high-delity recording be made. (Keep in mind that high-delity recordings take up much more disk space.) To make a stereo recording, use the -c option to specify the number of channels, giving 2 as the argument. To make a 16-bit recording, give w (wide) as the argument to the -s (sample size) option. Set the recording sample rate by giving the samples per second to use as an argument to the -r option. For cd-quality audio at 44,100 Hz, use -r 44100. Finally, to record a le in a particular format, either give the name of the format as an argument to the -f option, or use the traditional le name extension for that format in the output le name (see Appendix B [Conventional File Name Extensions], page 723). Here are two ways to use this. To make a high-delity recording from the microphone and save it to a wav format le called goodbye.wav, type:
$ rec -s w -c 2 -r 44100 goodbye.wav RET
To make a sound recording in the cd audio format and write the output to a le called goodbye.cdr, type:
$ rec goodbye.cdr RET
NOTES: When youre not recording sound, keep the inputs muted (see Recipe 21.1.3 [Muting an Audio Device], page 465); this way, you can have a
474
microphone plugged in without having feedback when playing sounds. Also, make sure the volume levels are not set too high or too low when recording; getting the right level for your microphone or other input device may take some initial adjustment. Like play, rec is part of the SOund eXchange toolkit. More advanced options exist. Use GramoFile, described in the next recipe, to record high-quality audio with a menu interface.
Aumix
Straightforward audio mixer tool that can be used interactively in a terminal, as well as on the command line and in scriptsuse this if you are too frustrated by amixer. The standard mixer on many systems. DEB: aumix RPM: aumix WWW: http://www.jpj.net/~trevor/aumix.html Transfers sound from vinyl records to cd-quality audio les, and can also record from the microphone and other inputs. Especially useful are its processing lters for improving the audio taken o vinyl, ltering out pops, hisses, and other surface noise. GramoFile can automatically detect and split each track on a record side into its own wav le, a feature that is also good for processing or recording long sessions of spoken word or live music in the same manner. DEB: gramofile RPM: gramofile WWW: http://panic.et.tudelft.nl/~costar/gramofile/ Simple wav le player and recorder for the kde environment. DEB: krecord RPM: krecord WWW: http://bytesex.org/krecord.html
GramoFile
Krecord
475
Splay
Command line mp3 player that can decode and play mpeg1 layer 1,2,3 and mpeg-2 layer 3 recorded audio. Based on the older Maplay. DEB: splay RPM: splay WWW: http://splay.sourceforge.net/ Toolkit that includes tools for interactive recording of cdquality audio in a terminal, dumping the current mixer settings to the standard output, and displaying the structure of riff format les (both avi and wav). DEB: xawtv-tools RPM: xawtv WWW: http://bytesex.org/misc.html http://bytesex.org/xawtv/ Popular, comprehensive audio player for X, featuring dozens of plug-ins, support for many sound formats (including Ogg and mp3), and skins to change its look and feel; it can use FreeAmp themes as wellsee listing for zinf below. Inspired by Winamp. DEB: xmms RPM: xmms WWW: http://www.xmms.org/ Popular audio le player for X that can play Ogg and mp3 formats, and its graphical appearance can be changed with themes. Formerly known as FreeAmp (the Free Audio Music Player). DEB: zinf RPM: zinf WWW: http://www.zinf.org/
Xawtv-Tools
XMMS
Zinf
476
477
To begin with a particular track, give the number of the track as an argument.
1
Any drive that is capable of playing audio compact discsa dvd drive, cd-rom drive, or cdr or cdrw drive.
478
To end with a particular track, give the number of the track as a second argument. Here are two ways to use this. To play an audio cd, beginning with the rst track and ending with the fourth track, type:
$ cdplay 1 4 RET
To play a special order of selections, combine multiple cdplay commands with the Bash semicolon (;) directive (see Recipe 3.1.7 [Running a List of Commands], page 63). Here are two ways to use this. To play tracks 3 through 7, track 1, and track 12 from the audio cd in the cd drive, type:
$ cdplay 3 7; cdplay 1 1; cdplay 12 12 RET
To play track 1 from the audio cd in the cd drive three times, then play the entire cd from the beginning, type:
$ cdplay 1 1; cdplay 1 1; cdplay 1 1; cdplay RET
Use cdplay to start playback at the point where it was paused; to restart the playback from the beginning, use cdplay with x as an argument. Here are two ways to use this. To restart a paused cd, type:
$ cdplay RET
479
In addition, cdinfo recognizes the following options: -a -r -s -t -v Output the absolute disc time. Output the relative track time. Output the play status (the default action). Output the current track. Output all available information: absolute disc time, relative track time, play status, and current track.
METHOD #2 To show the lengths of all tracks on an audio cd in a directory-like format, use cdir. This tool will also show titles and artist names, if known, but for this to work, you must set up an audio cd database (see the cdtool man page for detailsRecipe 2.8.4 [Reading a Page from the System Manual], page 46).
480
In this example, the cd contains eight tracks, with a total of 43 minutes and 14 seconds of play time.
NOTES: This command will also eject a data cd, if the data cd is not currently mounted (see Recipe 24.4 [Using Data cds], page 506).
481
cd are cdda2wav and cdparanoia. Both can sample single tracks or entire disks. cdda2wav is the archetypal cd audio-sampling tool for Linux, and it should be used when speed is more important than sound quality. cdparanoia does various extra checks for the paranoid, and it should be used when an absolutely perfect copy is necessary (at the expense of speed). cdda2wav is perfectly capable of creating a digitally perfect audio sample under normal conditions; cdparanoia is useful when your original cd has scratches (its scratch-detection capability can attempt to hold sync across the scratch), or when you are using a less-than-optimal-quality cd drive. With cdda2wav, you specify the track number to be retrieved as an argument to the -t option; use the -x option to specify a cd-quality retrieval, and give the name of the cd device with the -D optionunless you have multiple cd drives installed, this is almost certainly going to be /dev/cdrom. By default, les are written as wav format les; use the -O option followed by cdr to write the les in cd audio format. cd audio format les are useful for burning an audio cd containing the les as tracks (discussed in the following section), and .wav les are useful for converting to Ogg format (see Recipe 23.3.2 [Encoding an Ogg File], page 495). You can convert either format to the other at a later time with soxsee Recipe 23.3 [Converting Sound Files], page 493. Here are two ways to use this. To copy track seven of an audio cd to a cd-quality wav le in the current directory, type:
$ cdda2wav -t7 -d0 -x -D /dev/cdrom RET
For more reliable sampling, use cdparanoia. Give the range of audio tracks to sample as an argument, from the rst track to sample to the last; if you give no arguments, it samples the entire disc. Use the -w option to specify wav format output. Here are some ways to use this. To sample the rst through third tracks from a scratched audio cd in the default cd drive using paranoid data verication, and write the output as a raw audio-format le in the current directory, type:
$ cdparanoia 1-3 RET
482
To sample only the third track of the audio cd using paranoid data verication, and write the output to a wav format le in the current directory, type:
$ cdparanoia -w 3-3 RET
To sample the entire audio cd using less-than-maximum paranoid data verication, without checking for scratches, and saving each song as a separate raw audio-format le in the current directory, type:
$ cdparanoia -B -Y -X RET
NOTES: Sampling an entire audio cd can use a lot of disk space; most people delete the .cdr or .wav les as soon as they make Oggs or burn an audio cd-r from the data.
where scsibus is the number of the scsi bus (0 for the primary bus), target is the scsi target id (usually a number from 1 to 6), and lun is its lun number (almost always 0). Use the speed argument to set the speed factor for writing data: give speed=2 to specify double speed or speed=4 to specify quad speed. Use the -dummy option to run with the drive laser turned o, so no actual burning takes place; this is useful when you are rst using a cd-r drive and
2
You can also use this tool with a cd-rw drive and write to a cd-rw disc.
483
need to test your conguration to make sure youve got it right. Another useful option is -v, which gives a more verbose message output. Give the names of the audio les to burn, in the order that they should appear on the disc, as arguments to the -audio option. The les are written in cd-da cd audio format, and they should contain 16-bit stereo at 44,100 samples per second (the .cdr or x.cdda les meet this criterion). Here are some ways to use this. To burn the le symphony.cdr to the disc in the cd-r drive whose target id is 2 on the primary scsi bus, type:
$ cdrecord dev=0,2,0 -audio symphony.cdr RET
To burn all the les in the current directory ending with a .cdr extension at double speed to the cd-r drive whose target id is 2 on the primary scsi bus, and give verbose output, type:
$ cdrecord dev=0,2,0 speed=2 -v -audio *.cdr RET
To run a test burn of the le symphony.cdr to the disc in the cd-r drive whose target id is 6 (lun 1) on the primary scsi bus, type:
$ cdrecord dev=0,6,1 -dummy -audio symphony.cdr RET
When you use wildcards for les, as in the second example above, the shell expands the les in alphabetical order. To write a group of tracks in a particular order without specifying all of their names as arguments, rename them so that their names begin with numbers corresponding to the order you want to write them in (see Recipe 5.5 [Moving Files and Directories], page 144). For example, if you have the three les morning-song.cdr, middaysong.cdr, and evening-song.cdr, and you want to write them in that order, rename the les to 01-morning-song.cdr, 02-midday-song.cdr, and 03-evening-song.cdr. Otherwise, if you specify them as *.cdr, the shell will sort their names so that they will be written to cd-r in the order of evening-song.cdr, midday-song.cdr, and morning-song.cdrexactly the opposite of what was intended! To write a disc containing both data and audio tracks, rst specify the le for the data track (it should contain a lesystem image in either iso 9660 or Rock Ridge format), and then follow it with the -audio option and the names of the audio tracks to use. The resulting cd-r will be both mountable as a data cd and playable on audio cd players (the rst track on the disc, the data track, will be skipped when playing the audio).
484
To burn the data track band-info, plus all the audio tracks in the current directory that have a .cdda extension, to the cd-r drive whose target id is 2 on the primary scsi bus, type:
$ cdrecord dev=0,2,0 band-info -audio *.cdda RET
NOTES: When writing an audio cd, you should have as few processes running as possible. If cdrecord has to pause even momentarily to let the system shue other processes, the cd-r could be ruined! For this reason, it is advisable to avoid switching between consolesor between windows, if running Xduring the cd-r burning process.
Cdcd
Plays cds from the command line. DEB: cdcd RPM: cdcd WWW: http://cdcd.undergrid.net/ Displays information about an audio cd. WWW: http://bytesex.org/misc.html Generates labels and front insert cards for compact discs. DEB: cdlabelgen RPM: cdlabelgen WWW: http://tinyurl.com/3bty3 Plays audio cds in a terminal; it includes both command line and full-screen console modes. RPM: cdp WWW: http://cdp.sourceforge.net/ Plays audio cds with a panel of display numbers that are so round and groovy, it instantly appeals to those who think back fondly on 70s popular culture. DEB: groovycd
Cdinfo CDlabelgen
Cdp
Groovy CD Player
485
Player
Console cd player that can read either WorkMan or cddb databases and output PostScript cd audio covers. WWW: http://bytesex.org/misc.html Plays audio cds in a terminal and allows you to skip forward and backward through tracks as they are playing. DEB: workbone WWW: http://tinyurl.com/2ul7j Plays audio cds in X with a graphical interface that mimics the front panel of a physical cd player. DEB: workman RPM: workman WWW: http://tinyurl.com/26eof Graphical front-end to the cdrecord tool, for use in X. DEB: xcdroast RPM: xcdroast WWW: http://www.xcdroast.org/
WorkBone
WorkMan
XCDRoast
486
487
Snd is a sound-le editing environment for X, and it aims to be for sound what Emacs is to text. (It also uses Emacs-style key bindings.) Youll nd a complete manual for it in the /usr/doc/snd directory; this section explains how to use Snd to work with selections from sound les. To open a sound le in Snd, give the name of the le to be opened as an argument to snd. To open the sound le mixdown.wav in Snd, type:
$ snd mixdown.wav RET
Figure 23-1. Snd with a le loaded. This command starts Snd with a wav le called mixdown.wav, as in Figure 23-1.
488
Selecting a section of a sound le in Snd is similar to selecting text in Emacs; you can mark a section of a sound le or recording youve made in Snd by left-clicking and dragging across the area with the mouse. The area you drag across becomes shaded and is called the selection. Once you select a portion of the sound, any eect you choose works on that selection. You can also cut and paste selections of the sound you are editing into other sound buers. The xwave tool (and many others, no doubt) have similar capabilities and functions (see Recipe 23.4 [Using Other Sound Editors], page 496).
489
When applying an eect, the original le is never altered. You must specify an output le, or use a hyphen character (-) to indicate the standard output. Specify the output format as an argument to the -t option. You can only apply one eect with each sox command; thus, to add both echo and reverb to a sound le, you would need to issue two sox commands. The amount and levels applied for each eect will vary with every situation. As such, consider the following recipes as guidelines only for using the options; you will probably end up experimenting a bit to achieve your intended eect for any particular sound le. Almost all of the sound eects are applied by specifying the input and output le arguments, followed by the name of the eect to use and any options the eect takes (with notable exceptions, like the -v option for changing the amplitude of a le). NOTES: For more information on the sound eects sox can apply, see the various les in /usr/doc/sox/, and read the sox man page (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46).
To lower the volume of le old.wav by half and write the output to new.wav, type:
$ sox -v.5 old.wav new.wav RET
Use sox with the stat option and -v to determine the largest possible value that can be used before distortion or clipping occurs (it performs a statistical analysis on the le and outputs a numeric value). This value comes in handy when you want to raise a les volume as high as possible without ruining its delity.
490
To raise the volume of the le quiet.cdr as high as possible without distortion, type:
$ sox quiet.cdr loud.cdr stat -v RET 3.125 $ sox -v 3.125 quiet.cdr loud.cdr RET $
You can use this eect to raise or lower the pitch of a sound le. To do this, specify the desired pitch as the argument to the -r option, and give this option for the input le; then, specify the original sampling rate for the output le as an argument to -r. To slow the pitch of the sound in bell.wav, sampled at 44,100 Hz, and write it to a new le called slowbell.wav, also at 44,100 Hz, type:
$ sox -r 30000 bell.wav -r 44100 slowbell.wav RET
In this example, the sound in bell.wav, sampled at 44,100 Hz, was played at the slower 30,000 Hz. This was then resampled to the output le back to the 44,100 Hz sampling rate, but the pitch now diers from the original.
491
Here are some ways to use this. To add a basic reverb to le old.wav and write the output to le new.wav, type:
$ sox old.wav new.wav reverb .5 1000 100 RET
To add a spacey, echoing reverb to le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav reverb 1 1000 333 333 333 333 RET
NOTES: This last example makes a sound similar to some of the recordings of the band Flying Saucer Attack. (You know who they are, dont you?)
To add a one-second echo to the sound le old.wav and write output to new.wav, type:
$ sox old.wav new.wav echo .5 .5 1000 .5 RET
To add a tin-can echo eect to old.wav and write the output to new.wav, type:
$ sox old.wav new.wav echo 1 .5 5 .5 RET
NOTES: The echos eect works like echo, but adds a sequence of echos to the sound le.
492
Here are two ways to use this. To add an underwater ange to the le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav flanger .5 .5 4 .5 1 -t RET
To add ange that sounds somewhat like a wah-wah eects pedal to the le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav flanger .5 .5 .5 1 2 -t RET
To add a phased breathing eect to the le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav phaser .5 .5 .5 .9 .5 -t RET
To add a deep, alien-sounding chorus to the le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav chorus 1 .5 100 1 5 9 -t RET
493
To add an eect of a maxed-out Vibro-Champ to the le old.wav and write the output to new.wav, type:
$ sox old.wav new.wav vibro 30 1 RET
This command writes a new le, new.cdr, in the audio cd format; the original le, new.wav, is not altered. You may sometimes need to specify additional options, such as with raw audio les where the sampling rate and other properties must be specied.
494
To convert all of the raw audio les in the current directory to audio CD format les, type:
$ for i in *.raw RET { RET sox -s -w -c2 -r 44100 $i -x $i.cdr RET } RET
This command writes all of the .raw les to new les of the same name but with a .cdr extension. You could then use cdrecord to burn an audio cd with the .cdr les (see Recipe 22.3 [Writing an Audio Cd-r], page 482). To convert a le to a particular format without using the standard extension, specify the format to write to with the -t option. To convert the le new.wav to the audio cd format and write output to a le named cd-single, type:
$ sox new.wav -t cdr cd-single RET
NOTES: The process of making an mp3 le from a raw audio or wav format audio le is called encoding (or sometimes ripping) an mp3 le; programs
495
that do this are mp3 encoders. This is not so much a recording process as it is a conversion process: Existing audio is converted to mpeg audio format. Unfortunately, the algorithm for encoding mp3s is patented, and all software that uses it must pay a license fee. This restriction means that it is against the law to write a software program to encode mp3 without licensing it. That is the main reason why mp3 is now losing its popularity in favor of the Ogg Vorbis audio format. As with many computing trends, this one has found its early adopters in the Linux world.
This command writes a new le, output.wav, in the current directory. Specify the le to output by giving it as an argument to the -o option. To convert the Ogg Vorbis le bobhopehour.ogg to wav format, writing to a le named hope1.wav, type:
$ ogg123 -d wav -o hope1.wav bobhopehour.ogg RET
496
NOTES: The wav output can be further converted into other formats using the traditional methods (for examples, see the previous recipe). If you want to listen to the le as its being converted, you may do so by giving an additional -d option for the audio system driver you have.
Audacity
Audio editor with spectrogram display. Known for its speed. DEB: audacity RPM: audacity WWW: http://audacity.sourceforge.net/ Graphical music editor for kde whose features include both score and piano-roll notation. DEB: brahms RPM: brahms WWW: http://brahms.sourceforge.net/ Graphical tool for editing sound les. RPM: dap WWW: http://www.cee.hw.ac.uk/~richardk/ Speech-synthesis system that reads English (British and American), Spanish, and Welsh plain text input, and outputs speech as sound. DEB: festival RPM: festival WWW: http://www.cstr.ed.ac.uk/projects/festival/
Brahms
DAP
Festival
497
Freebirth
Sequencer, bass synthesizer, and sample player. DEB: freebirth RPM: freebirth WWW: http://www.hitsquad.com/smm/programs/Freebirth/ Audio editor described as the gimp of audio. glame is an acronym for gnu/Linux Audio Mechanics. DEB: glame RPM: glame WWW: http://glame.sourceforge.net/ Powerful system for programming real-time audio. DEB: pd WWW: http://www-crca.ucsd.edu/~msp/software.html midi sequencer, music notation (score) editor, and music composition editor. DEB: rosegarden RPM: rosegarden WWW: http://www.rosegardenmusic.com/ Graphical, real-time audio eects processor inspired by old magnetic-tape delay eects. DEB: tapiir WWW: http://www.iua.upf.es/~mdeboer/projects/tapiir/ A simple sound editor that performs the basic functions you would expect in a wav le editor. DEB: xwave WWW: http://www.ibiblio.org/pub/linux/apps/sound/editors/
GLAME
Pure Data
Rosegarden
Tapiir
XWave
498
VI. PRODUCTIVITY
499
VI. PRODUCTIVITY
500
501
502
blocks available; the percent of the device used; and the name of the directory tree the device is mounted on. To see how much free space is left on the systems disks, type:
$ df RET Filesystem /dev/hda1 /dev/hda2 /dev/hdb1 $ 1024-blocks Used Available Capacity Mounted on 195167 43405 141684 23% / 2783807 688916 1950949 26% /usr 2039559 1675652 258472 87% /home/webb
This example shows that three lesystems are mounted on the systemthe lesystem mounted on / is at 23 percent capacity, the lesystem mounted on /usr is at 26 percent capacity, and the lesystem mounted on /home/webb, a home directory, is at 87 percent capacity.
This example shows two subdirectories in the directory tree: projects and tmp. The projects subdirectory contains three additional directories. The
503
amount of disk space used by the individual directories is the total on the last line, 27 kb. By default, output is in 1 kb blocks, but you can specify another unit to use as an option: -k for kilobytes and -m for megabytes. Here are two ways to use this. To output the disk usage, in kilobytes, of the /usr/local directory tree, type:
$ du -k /usr/local RET
Use the -s option (summarize) to output only the last line containing the total for the entire directory tree. This is useful when you are only interested in the total disk usage of a directory tree. Here are two ways to use this. To output only the total disk usage of the /usr/local directory tree, type:
$ du -s /usr/local RET
To output only the total disk usage, in kilobytes, of the /usr/local directory tree, type:
$ du -s -k /usr/local RET
504
les on itLinux may still be using the mounted les when you remove the disk (see Recipe 2.1.2 [Turning O the System], page 27). The following sections show you how to format, mount, and unmount oppies. On many systems, you need superuser privileges to do any of these actions. NOTES: For recipes describing the use of ms-dos (and Microsoft Windows) formatted disks under Linux, see Recipe 26.1 [Using dos and Windows Disks], page 525.
This will erase all the information on the disk. Once a disk is formatted, you need to make a Linux lesystem on the disk.1 Use mke2fs to do this. Give the name of the device le of the oppy drive as an argumentusually the rst removable disk drive, /dev/fd0. The oppy disk must be in the drive when you give this command, and any data already on it will be lost. To make a Linux lesystem on the oppy disk in the rst removable oppy drive, type:
$ mke2fs /dev/fd0 RET
NOTES: You can make 2 mb high-capacity formats with superformat. This formats a oppy disk beyond its normal carrying capacity; it is a lengthy process, but if you need to store extra data on your disk, you might consider it.
Technically, this lesystem is a second extended le system (e2fs), the native lesystem currently used with Linux. This works if your administrator has set up the oppy drive lesystem for user access see Recipe A.6.3 [Letting Users Access Hardware Peripherals], page 718.
505
To mount a oppy disk to a specic directory, use mount and give as arguments the device name of the oppy drive (usually /dev/fd0 for oneoppy systems) and the name of the directory to mount to. To mount the oppy in the rst oppy drive to ~/tmp, type:
$ mount /dev/fd0 ~/tmp RET
Once you have mounted a oppy, its contents appear in the directory you specify, and you can use any le command on them. Here are two ways to use this. To list the contents of the base directory of the oppy mounted on /floppy, type:
$ ls /floppy RET
To list the contents of the entire directory tree on the oppy mounted on /floppy, type:
$ ls -lR /floppy RET
NOTES: You can copy les to and from the directory tree that the oppy is mounted on, make and remove directories, and do anything else you could on any other directory tree. But remember, before you remove it, you must rst unmount it.
NOTES: You cant unmount a disk if your current working directory, the directory you are in, is somewhere in that disks directory tree.3 In this case, trying to unmount the disk will give the error that the /floppy lesystem is in use; change to a dierent directory that isnt in the /floppy directory tree, and then you can unmount the disk. Sometimes when you unmount a oppy, the light on the oppy drive will go on and remain on for a few seconds after it has been unmounted. This
3
This is sometimes called being under the mount point of the disk.
506
is because Linux sometimes keeps changes to les in memory before it writes them to disk; its making sure that the les on the oppy are up-to-date. Simply wait until the light goes o before you remove the oppy from the drive.
This command makes the contents of the data cd available from the /cdrom directory tree. You can use any Linux le command on the les and directories on a data cd, but you can only write to one if it is a cdrw disc. Like the /floppy directory, the use of the /cdrom directory is a standard practice and convenient, but not necessaryyou can mount disks in whatever empty directory you like. (You could even, for example, mount discs from the cd drive to /floppy and mount oppy disks to /cdrom, but why would anyone do that!) To mount a data cd to a specic directory, use mount and give as arguments the name of the device le in /dev corresponding to the cd drive, and the name of the directory to mount to. This directory must already exist on the lesystem, and it must be empty. If it doesnt exist, use mkdir to create it rst (see Recipe 5.1.2 [Making a Directory], page 130). Most Linux systems are set up so that the device le of the rst cd drive is /dev/cdrom, but the name of the device le may be dierent, especially if you have a scsi cd-rom drive.
4
This works if your administrator has set up the cd drive lesystem for user accesssee Recipe A.6.3 [Letting Users Access Hardware Peripherals], page 718.
507
The contents of the disc in the cd drive will then be available in the /usr/local/share/clipart directory tree, and you can then use the les and directories on the data cd as you would any other les. Here are some ways to use this. To peruse a directory tree graph of the data cds contents, type:
$ tree /usr/local/share/clipart | less RET
To list the contents of the root directory on the data cd, type:
$ ls /usr/local/share/clipart RET
NOTES: As with unmounting any kind of lesystem, make sure that none of the les on the disc are in use, or else you wont be able to unmount it. For example, if the current working directory in a shell is somewhere inside the /cdrom directory tree, you wont be able to unmount the data cd until you change to a dierent directory.
508
509
25. Printing
The usual way to print on a Linux system is to send a print job to the printer with lpr, as described in Recipe 25.1.1 [Sending a Print Job to the Printer], page 510. But you wont always send a le straight to the printersometimes you may want to add special things to it before you print, such as headers or graphic trim. Or you might want to split a text le into pages and add a header to the top of each page containing the le name and page number; all of this is described in Chapter 13 [Formatting Text], page 305. Sometimes you may need to convert or otherwise prepare a le so that it can be printed on your particular printer, since not all print hardware can print the same kinds of le formats. Recipes in this chapter show how to do this, such as how to convert PostScript les so that they will print properly on a non-PostScript printer (see Recipe 25.3 [Preparing Files for Printing], page 518). This chapter also shows how to format PostScript les for printing. To convert plain text to PostScript and enhance it for printing, by adding fonts, graphic headers, and the like, see Recipe 15.2 [Outputting Text to PostScript], page 359. This chapter isnt in the les section of the book because you can print things that arent in a lefor example, you can pipe the output of another tool or series of tools to lpr, and it will spool that command output to the printer. This usage is actually very common.
510
If you have more than one printer connected to your system, specify the printer to send to as an argument to the -P option. (Printers have names just as user accounts and hosts do, and it is the administrators privilege to name them; the default printer is usually called lp, for line printer.) To send the le nightly-report to the printer called statomatic, type:
$ lpr -P statomatic nightly-report RET
NOTES: The name of the lpr tool comes from line printer, which was the kind of printer hardware in popular use back when this program was rst developed.
511
In this example, there are three jobs queued for the default printerone by user groucho, for the le cigar.ps, one by user harpo, for the le harp.ps, and one by user chico, who has printed a le called love.ps. The job by user groucho is the active job; this is the job that is currently printing on the printer. The other jobs must wait until this le is nished printing, and then they print in rank order. As with lpr, you can specify the name of a printer as an argument to the -P option. To view the spool queue for the printer called statomatic, type:
$ lpq -P statomatic RET
To only list the jobs for a particular user, give the name of the user as an argument. To list the print jobs for user harpo, type:
$ lpq harpo RET
NOTES: When there are no print jobs, lpq outputs the text no entries.
When lprm cancels a job, it outputs the names of any print les that have been dequeued and removed (a single print job is usually listed in two lines). If you dont have a print job to cancel, lprm will report nothing.
512
You can also cancel a print job by its job number. To do this, give as an argument the number of the print job to remove. To cancel print job 83, type:
$ lprm 83 RET
To cancel all of your print jobs in the spool queue, use a hyphen instead of the number of a print job. This is good for when youve sent several jobs to the printer but you want to cancel them. To cancel all of your print jobs, type:
$ lprm - RET
NOTES: If you try to cancel an active jobone that has already been spooled to the printerdont be alarmed if some pages still print; the printer probably has some of the job in its internal print buer. To stop the printing in a case like this, take the printer oine, reset it, and then put it back online again (the printer will usually have buttons for these commands on its front control panel).
513
To specify the line width, give the new width as an argument. To send a test pattern printing at 120 characters per line to the printer named machine_room, type:
$ lptest 120 | lpr -Pmachine_room RET
You can also specify the number of lines to output; do this by giving the new number as a second argument. This is useful for writing some dummy data to a le, when you need some. To write a ripple pattern ten lines long, with 25 characters per line, to the le testing, type:
$ lptest 25 10 > testing RET
514
psselect and pipe the output to lpr (see Recipe 20.1.2 [Extracting Pages from a PostScript File], page 452). This is useful for when you have a very large le to print and you want to send it to the printer in sections. Here are two ways to use this. To print pages 1 through 100 from the le input.ps, type:
$ psselect -p1-100 input.ps | lpr RET
To print four copies of pages 1 through 100 from the le input.ps, type:
$ psselect -p1-100 input.ps | lpr -#4 RET
515
Here are some ways to use this. To print the url http://chem.example.edu/polymer99.ps, which is a PostScript le, type:
$ lynx -dump http://chem.example.edu/polymer99.ps | lpr RET
To print url http://chem.example.edu/schedule.txt, a text le, in Palatino bold text 20 points wide and ten points high, type (all on one line):
$ lynx -dump http://chem.example.edu/schedule.txt | enscript -B -f Palatino-Bold@20/10 -o - | lpr RET
NOTES: This is also a good method for sending the contents of a Web page through any number of lters or pipelines in general. METHOD #3 When in lynx, press P when on the page you want to print. This will bring up a new page, giving the url of the page you were viewing and telling you the number of lines it contains and the number of physical pages it makes when printed. You will also be given four options: Save to a local file, Mail the file, Print to the screen, and Print out on a printer attached to your vt100 terminal. The last option will send it to the printer. If you save to a local le, a plain text le will be written to the current directory with the name you specify. You can then process and print that le.
516
The following table lists some of dvipss options for controlling print output. -A -B -b copies Print only odd-numbered pages (dvi le must have been generated by TEX for this option). Print only even-numbered pages (dvi le must have been generated by TEX for this option). Specify the number of copies to printuseful for printing multiple copies of yers, posters, signs, and the like. Print crop marks. Specify the last page number to print. Use the manual feed tray. Specify the rst page to begin printing from. Reverse the order of the pages. Specify paper size and format; valid options include letter, legal, a4, and landscape. (You can use this option twice, say to specify both legal and landscape.)
Using the -m option, and specifying landscape as the paper format with the -t option, is very useful for printing on envelopes. To print the le envelope.dvi on an envelope loaded in the manual feed tray of the default printer, type:
$ dvips -m -t landscape envelope.dvi RET
NOTES: You can also print dvi les with lpr using the -d option.
517
the print submenu is Print Region, which just prints the text between point and the mark (see Recipe 10.1.1 [Getting Acquainted with Emacs], page 232). Both commands print the hardcopy output separated into pages, with headers at the top of each page showing the le name and current page number. METHOD #2 To generate and print a PostScript image of the buer, use the ps-printbuffer function, which is also available on the Print submenu. A related function, ps-print-region, prints a PostScript image of the region. These commands are useful for sending the text of a buer to a PostScript printer. To send the current Emacs buer to the default printer as a PostScript le, type:
ALT - X
ps-print-buffer RET
METHOD #3 You can also run any of the aforementioned print functions by specifying them with the ALT - X command. Additionally, the lpr-buffer and lpr-region functions send the buer and region to lpr without paginating the text or inserting headers. Here are some ways to use this. To print the current buer with page numbers and headers, type:
ALT - X
print-buffer RET
To print the current buer with no additional print formatting done to the text, type:
ALT - X
lpr-buffer RET
ps-print-buffer RET
print-node RET
518
519
A typical gs installation can write to more than 100 dierent print devices, including hp LaserJet 4 printers (ljet4), hp Color Deskjets (cdeskjet), and Group 4 fax (tiffg4). Newer versions of gs will have better support for newer printers, so make sure that you have a recent version installed if you have a new model printer. gs takes the le to convert as an argument; give the device to write output for as an argument to the -sDEVICE= option, and give the name of the le to write to as an argument to the -sOutputFile= option. Two additional options are commonly used: -dSAFER, which prevents the accidental deleting or overwriting of les, and -dNOPAUSE, which turns o the pause between pages. When the conversion is complete, you will be at the gs prompt; type quit to exit. To convert the le tiger.ps to a format suitable for printing on an hp Color Deskjet 500 printer, type (all on one line):
$ gs -sDEVICE=cdj500 -sOutputFile=tiger.dj -dSAFER -dNOPAUSE tiger.ps < /dev/null RET
520
This command writes the output to a le, tiger.dj, which you can spool as a print job with lpr to print it.
This command reads the dvi le abstract.dvi and writes a PostScript version of it to the le abstract.ps; the original le is not altered. To write only certain pages of a dvi le to the PostScript output, give the page or pages as arguments to the -pp option. Here are some ways to use this. To output only pages 14 and 36 from le abstract.dvi to a PostScript le, codeabstract.ps, type:
$ dvips -pp14,36 -o abstract.ps abstract.dvi RET
To output pages 2 through 100 from le abstract.dvi to a PostScript le, abstract.ps, type:
$ dvips -pp2-100 -o abstract.ps abstract.dvi RET
To output page 1 and pages 5 through 20 from le abstract.dvi to a PostScript le, abstract.ps, type:
$ dvips -pp1,5-20 -o abstract.ps abstract.dvi RET
To specify an output paper size, give it as an argument to the -t option; if you have a PostScript printer, you can also send the output directly to the printer (see Recipe 25.2.5 [Printing a dvi File], page 515). Here are two ways to use this. To output the le abstract.dvi as a PostScript le, abstract.ps, with a paper size of legal, type:
$ dvips -t legal -o abstract.ps abstract.dvi RET
521
Use the -P option with dvips to specify the printer name to write output touse this option to make output for non-PostScript printers. For exama ple, to convert TEX and L TEX les to pdf, use dvips and give pdf as an argument to the -P option. To generate a pdf le from the dvi le abstract.dvi, type:
$ dvips -Ppdf -o abstract.pdf abstract.dvi RET
This command writes a new le, abstract.pdf, in pdf format. NOTES: This type of conversion is not only useful for print preparation. Once the dvi le is converted to PostScript, you can then convert the PostScript to other formats, such as plain text or pdfsee Recipe 20.3 [Converting PostScript], page 459.
522
The second way is to use pdf2ps, part of the gs package, to convert the pdf le to PostScript (to then print the PostScript output as described for xpdf above). pdf2ps takes two arguments: the name of the pdf le to convert, and the name of the PostScript le to write to. To convert the pdf le pricelist.pdf, type:
$ pdf2ps pricelist.pdf pricelist.ps RET
In the last example, you can then use gs to convert the le to a format your non-PostScript printer understands (see Recipe 25.3.1 [Preparing a PostScript File for Printing], page 518). NOTES: A manual page can actually contain more than one physical page; the output will have as many pages as necessary to print it.
523
There are two methods worth noting for preparing etexts for printing. METHOD #1 Etext lter WWW: http://dsl.org/comp/enscript/ Use the etext lter for enscript to convert an etext to PostScript. This takes a plain text le written with etext conventions, including etext-style italics (see Recipe 13.9 [Underlining Text], page 327), converts the italics, and writes a PostScript le as output. To convert the etext youth.txt to PostScript, type:
$ enscript -Eetext -B -f "Times-Roman12" -o youth.ps youth.txt RET
METHOD #2 Txt2html DEB: txt2html RPM: txt2html WWW: http://txt2html.sourceforge.net/ To convert plain text to PostScript for printingwhether the text is written with etext conventions or notrst use txt2html to convert the text to html, and then print the text from a Web browser, as described in Recipe 25.2.4 [Printing a Web Page], page 514. To prepare the le essays for printing, type:
$ txt2html essays > essays.html RET
This command writes a new le, essays.html, that you can then print with a Web browser. a NOTES: You could also convert the text to L TEX with txt2tex (see Recipe 15.7 [Using Other Word Processors and Typesetting Systems], page 391).
524
525
The mtools package package provides a collection of tools to facilitate the manipulation of ms-dos les. These tools allow you to use and manipulate ms-dos disks (usually oppies, but Jaz and Zip drives are supported, too) without mounting them; they can handle the extensions to the ms-dos format that are used by the dierent Microsoft Windows operating systems, including Windows nt. The following recipes describe how to use some of the tools in this package to get directory listings of ms-dos disks, copy les to and from them, delete les on them, and even format them. Theyre similar in use and syntax to the equivalent ms-dos commands. You can also mount dos and Windows disks (see Recipe 26.3 [Mounting Windows and nt partitions], page 529).
526
To get a directory listing of the dos disk currently in the primary oppy drive, type:
$ mdir a: RET
To copy a le from a dos disk, give the drive letter of the disk to copy from, followed by the le name to copy, and no other arguments; mcopy will copy the specied le to the current directory. To copy the le resume.doc from the dos disk in the secondary oppy drive to the current directory, type:
$ mcopy b:resume.doc RET
To copy all les from a dos disk, just give the drive letter without any le names. To copy all of the les and directories from the dos disk in the primary oppy drive to the current directory, type:
$ mcopy a: RET
527
To format the oppy disk in the primary oppy drive so that it can be used with ms-dos, type:
$ mformat a: RET
NOTES: If you want to use a oppy disk with your Linux system and dont need dos compatibility, dont bother using this ms-dos formatthe native Linux format is much more ecient (see Recipe 24.3.1 [Formatting a Floppy Disk], page 504). If you know how long a dos format takes, youll be amazed at how much faster the Linux formatting isit will be done so fast youll think it didnt even work!
After you run this command, the other tools in the hfsutils package will work on the Macintosh disk in the rst oppy drive.
528
Give the name of a directory as a quoted argument to list just that directory. To get a directory listing of the Desktop Folder directory in the currently specied Macintosh disk, type:
$ hls 'Desktop Folder' RET
To copy a le from a Macintosh disk, give two arguments: the name of the directory and the le to copy as a quoted argument, and the name of the Linux target directory to copy to. Remember that macos uses the colon character (:) as the separator on the path. To copy the le Desktop Folder:Readme from the current Mac disk to the current directory, type:
$ hcopy 'Desktop Folder:Readme' . RET
529
If the disk currently has a partition on it, this command wont work; use the -f option to force the format, thus erasing any existing partition and data the disk contains. Give a label for the drive as a quoted argument to the -l option. The label name cant contain a colon character (:). Here are two ways to use this. To format the disk in the rst oppy drive with a Macintosh hfs lesystem, overwriting any existing Macintosh lesystem, type:
$ hformat -f /dev/fd0 RET
To format the disk in the second oppy drive with a Macintosh hfs lesystem, giving it a volume label of Work Disk, type:
$ hformat -l 'Work Disk' /dev/fd1 RET
When a disk has multiple partitions, give the number of the partition to format as an additional argument. To format the entire medium, give 0 as the partition to use. Here are two ways to use this. To format the second partition of the scsi disk at /dev/sd2 with a Macintosh hfs lesystem, type:
$ hformat /dev/sd2 2 RET
To format the entire scsi disk at /dev/sd2 with a Macintosh hfs lesystem, overwriting any existing Macintosh lesystem and giving it a label of Joe's Work Disk, type:
$ hformat -f -l "Joe's Work Disk" /dev/sd2 0 RET
530
The command in the preceding example makes the Windows partition at /dev/hdd1 available to Linux in the /home/roger/mywin directory. To mount the Windows nt partition at the /dev/hea1 device on /mnt, type:
$ mount -t ntfs /dev/hea1 /mnt RET
The command in the preceding example makes the Windows nt partition at /dev/hea1 available to Linux as a read-only lesystem in the /mnt directory.
531
Here are two ways to use this. To remove the newline characters from the text le autoexec.bat, type:
$ fromdos autoexec.bat RET
To add newline characters to all of the text les with a .tex extension in the current directory, type:
$ todos *.tex RET
NOTES: Both commands write directly to the les you specify. To make a backup of the original le, use the -b option; before the conversion, this writes a copy of each specied le with a .bak le name extension. METHOD #2 Use the col lter to lter out carriage returns from text, as described in Recipe 13.1.9 [Removing Carriage Return Characters], page 310. To lter out the carriage returns from the le README.TXT, writing to a new le called readme.txt, type:
$ col < README.TXT > readme.txt RET
METHOD #3 Another way to convert text from dos is to use the tr lter to delete the carriage returns (see Recipe 13.4 [Transposing Characters in Text], page 316). To lter out the carriage returns from the le dos-version.txt, writing to the new le unix-version.txt, type:
$ tr -d '\r' < dos-version.txt > unix-version.txt RET
NOTES: To do the reverse of thisto convert text from unix to dosI have been told that simply opening the le in the dos text editor program called edit, and then saving the le and exiting, will work. This will automatically add the requisite carriage returns to the end of each line.
532
Use word2x to convert Microsoft Word les to a format you can read. It can a convert les to two dierent formats: L TEX and plain text. a Convert to L TEX when the layout of the original document, including its formatting and font characteristics, is important. When you just need the complete text of the document, convert it to plain text. word2x can send its output to the standard output, so the latter conversion is useful for adding to a pipeline. Word les usually have a .doc or .DOC extension, which you dont have to specify. For example, if the Word le you want to convert is called resume.doc, you can simply give resume as the source le. (But if there exists another le named resume in the same directory, this trick wont work). If you dont specify an output le, word2x writes its output to a le with the same base le name and an appropriate extension for the output format. This is useful for converting a lot of Word les in the same directoryspecifying a wildcard such as *.doc as the input and giving no output name will convert them all. You can also set the maximum line width to be used in the output le; specify the width as an argument to the -w option. The following recipes describe how to use word2x to convert Word les to a L TEX and plain text format. NOTES: While word2x does a pretty good job of conversion, it wont convert any pictures embedded in Word documents. There are other ways to read or convert Word les; see Recipe 26.8 [Using Other Cross-Platform Conversion Tools], page 535, for a list of other tools you can use for this purpose.
a This command writes a new le, resume.ltx, in the L TEX format. You can then view, print, or convert the le to other formatssee Recipe 15.3.3 a [Processing a L TEX File], page 374. The original resume.doc le is unaltered.
533
a To convert all of the .DOC Word les in the current directory to L TEX les with maximum line widths of 40 characters, type:
$ word2x -f latex -w 40 *.DOC RET
To send a conversion to the standard output, give a hyphen character (-) as the output le to use. This is useful for piping the plain text conversion to other tools that work on text, such as grep, a tool for searching text (see Recipe 14.1 [Searching Text for a Word], page 333). To search the text of the Word le resume.doc for the string linux, regardless of case, type:
$ word2x resume.doc - | grep -i linux RET
These commands convert the Word le resume.doc to text and output all lines of that text, if any, that contain the string linux regardless of case. The original resume.doc le is unaltered.
534
zip le compression takes one or more les and compresses them into a single new le with a .zip extension. This is what most people new to Linux or unix in general think of when they think of le archives. But in the unix world, le archives and compression are separate tools, even though they usually go hand in hand. We make compressed tar archives (see Recipe 8.5 [Managing File Archives], page 199). And then we can compress these archives, or any other le, with gzip or bzip2 (see Recipe 8.4 [Using File Compression], page 196). When sending and receiving groups of les with people who use other operating systems, the zip archive format is usually used. The zip and unzip tools make and extract zip archives as done by the popular pkzip tools for other operating systems. The following recipes show how to use these tools.
To add all of the .tiff les in the current directory to an existing zip archive le, zippy.zip, type:
$ zip zippy *.tiff RET
When specifying a directory, if you give just the directory name, only that directory (and not its contents) will be included in the archive. Specifying a wildcard in a directory will include the les it contains and any subdirectory names, but it will not travel into those subdirectories to include any les that may be contained there. Use the -r option to travel recursively into any specied directories, thus including its entire contents. To make a zip archive zippy.zip containing all les in the current directory, type:
$ zip zippy * RET
535
If the current directory contains any directories, those directory names are included in the zip archive, but not any of their contents. To make a zip archive zippy.zip containing all les in the current directory, as well as all les in the addons directory, type:
$ zip zippy * addons/* RET
This command puts all les in the current directory in an archive called zippy.zip, to which it also adds all les in the addons directory, but it does not add the contents of any subdirectories that addons may contain. To make a zip archive zippy.zip containing the entire addons directory tree, type:
$ zip zippy -r addons/* RET
It is sometimes a good idea to take a look inside the zip archive rst, to see what you are getting into by unzippingif a zip archive contains a hundred les and you are not expecting them, it could be inconvenient to just unzip it rst. Thats where the -t option comes in handy, and I use it all the time before unzipping an archive for real. This just tests the les contained in the archive to make sure that the archive le has not become corrupt. As unzip runs through the tests, it lists each le in the archive. None of the les are unzipped with this command. To test the zip archive blueprints.zip for errors, thus listing all the les it contains, type:
$ unzip -t blueprints.zip RET
536
AbiWord
wysiwyg-style word processor that can read, display, and convert les from proprietary word processors, including Microsoft Word. DEB: abiword-common RPM: abiword WWW: http://www.abisource.com/ Converts Microsoft Word les into something usable. DEB: antiword RPM: antiword WWW: http://www.winfield.demon.nl/ Outputs text from Microsoft Word les. Includes xls2csv, a tool to output data from Microsoft Excel spreadsheets as comma-delimited text. DEB: catdoc RPM: catdoc WWW: http://www.45.free.net/~vitus/ice/catdoc/ Converts Microsoft PowerPoint les to html. DEB: ppthtml RPM: xlhtml Converts Microsofts Rich Text Format (rtf) to something usable. DEB: unrtf RPM: unrtf WWW: http://www.gnu.org/software/unrtf/unrtf.html Converts WordPerfect les to something usable. DEB: wp2x WWW: http://tinyurl.com/2lzcq Converts and previews Microsoft Word les. DEB: wv RPM: wv WWW: http://sourceforge.net/projects/wvware
Antiword
catdoc
ppthtml
GNU Unrtf
wp2x
wvWare
537
27. Reminders
When you spend a lot of time working on the system, it can be very useful to be reminded when you should be doing something else. You can have the system do this for you, and this chapter tells you how. It describes software tools that provide reminders of various kindsclocks, calendars, address books, and tools for tracking appointments.
The default format of the output is to display the day of the week; the month name; the day of the month; the 24-hour time in hours, minutes, and seconds; the time zone; and the year. Use the -u option to output the current date and time in gmt (Greenwich Mean Time, also known today as Coordinated Universal Time, or utc). To output the current date and time in utc, type:
$ date -u RET Thu, 1 Jul 2004 10:09:57 -0400 $
Use the -R option to output the date in the format described in rfc822 (see Recipe 11.4 [Word Lists and Reference Files], page 289): day of week followed by day of month, month name, year, time, and time zone in numeric format. This is the date format used in email messages. To output the current date and time in rfc822 format, type:
$ date -R RET Fri, 11 May 2001 11:10:29 -0400 $
538
You can also use the -d option to specify the precise elds to output, and the order in which to output them. One useful example is given in the next recipe; for more information, consult the date man page (see Recipe 2.8.4 [Reading a Page from the System Manual], page 46). The date tool has many parameters for formatting the output, all of which are preceded with +. They are sometimes useful for putting into scripts. The following recipes describe a few. NOTES: To ensure that the time on your system clock remains as accurate as possible, your system administrator should install the chrony package; it periodically adjusts the time on the system clock according to measurements obtained from time service servers on the Internet via Network Time Protocol.
To output the number of days a particular date is into the year, use -d with 'DD MMM ' +%j, where DD is the day of the month and MMM is the name of the month. To output the numeric day of the year that 21 June falls on in the current year, type:
$ date -d '21 Jun' +%j RET 172 $
This command outputs the number 172, which indicates that June 21st of the current year is the 172nd day of the current calendar year.
539
NOTES: If youre feeling adventurous, you can record another voicelike your ownand use that voice instead of the default voice; the sound les used are Sun .au les, and they are kept in the /usr/share/saytime directory.
Use the -y option to output a calendar for the current year. Here are two ways to use this. To output a calendar for the current year, type:
$ cal -y RET
To print a calendar for the current year to the default printer, type:
cal -y | lpr RET
To output a calendar for a specic year, give just the year as an option.
540
Su 1 8 15 22 29
Mo 2 9 16 23 30
Fr 6 13 20 27
Sa 7 14 21 28
Fr 3 10 17 24
Sa 4 11 18 25
Fr 2 9 16 23 30
Sa 3 10 17 24 31
Su 1 8 15 22 29
Mo 2 9 16 23 30
Fr 6 13 20 27
Sa 7 14 21 28
Th 3 10 17 24 31
Fr 4 11 18 25
Sa 5 12 19 26
June Su Mo Tu We Th Fr 1 3 4 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 24 25 26 27 28 29
Sa 2 9 16 23 30
Su 1 8 15 22 29
Mo 2 9 16 23 30
July Tu We Th 3 4 5 10 11 12 17 18 19 24 25 26 31 October Tu We Th 2 3 4 9 10 11 16 17 18 23 24 25 30 31
Fr 6 13 20 27
Sa 7 14 21 28
August Su Mo Tu We Th 1 2 5 6 7 8 9 12 13 14 15 16 19 20 21 22 23 26 27 28 29 30 November Su Mo Tu We Th 1 4 5 6 7 8 11 12 13 14 15 18 19 20 21 22 25 26 27 28 29
Fr 3 10 17 24 31
Sa 4 11 18 25
Su Mo 1 7 8 14 15 21 22 28 29 $
Fr 5 12 19 26
Sa 6 13 20 27
Fr 2 9 16 23 30
Sa 3 10 17 24
September Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 December Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
The -j option displays Julian dates, numbered consecutively though the year, from January 1.
541
To output a calendar for the current month with Julian dates, type:
$ cal -j RET
To output a calendar for a specic month, give both the numeric month and year as arguments. To output a calendar for the month of April 1945, type:
$ cal 04 1945 RET April 1945 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $
While in Emacs, to display a three-month calendar for the month of August 2000, type:
CTRL - U ALT - X
calendar RET
BKSP
00 RET
542
NOTES: When you display a calendar for a specic month and year, Emacs lls in the current year in the minibuer. In the previous example, the current year was 2010, and BKSP was typed twice to erase the last two digits, which were replaced with 00 to make it the year 2000.
Figure 27-1. Typical calendar output. The following are recipes for writing your calendar les, including other calendar les in your own calendar le, and for automating the delivery of your reminders. NOTES: The calendar tool was a one-time staple of unix systems, and reportedly rst appeared in Version 7 of at&t unix. It was rewritten early on for the bsd family of unix. Although this bsd derivative is a standard inclusion on Debian systems, calendar isnt yet standard on all Linux distributions, and a source or binary of the tool can be dicult for users of other distributions to locate. I advise those users to download the source les for the Debian bsdmainutils package and to install calendar from there. Emacs has its own equivalent to this tool, which it calls the Diary. For more information on this feature, see the Emacs Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
543
Just about every common date style is recognized. For example, Figure 27-2 shows a listing of valid dates for the fourth of July.
7/4 July 4 4 July Jul. 4 Jul 4 4 Jul. 4 Jul
Figure 27-2. Valid dates for the fourth of July. Entries arent constrained to a single day, either; you can have entries for a day of the week or for a certain monthMon or Monday for every Monday; Jun or June for the rst day of every June. You can use an asterisk as a wildcard: */13 reminds you of something on the 13th of every month. When the date is omitted on a line, the date of the preceding appointment is assumed. For example, suppose you have a le called calendar in your home directory that looks like Figure 27-3.
6/16 6/20 Fri Mon Finish draft of book Party at Jack's Gallery reading Lunch with Kim and Jim, 12:30 Book manuscript due
544
If the current date is 16 June, a Friday, and you run calendar in your home directory, youll get the same output as in Figure 27-1. NOTES: In the preceding example, the entry for the party doesnt have a date on itit used the date of the preceding entry, 6/16.
To have calendar output dates from one of these les along with your usual appointments, put the following line in your calendar le, where le is the name of the particular calendar le you want to include:
#include <le>
545
For example, to output both U.S. holidays and famous births and deaths when you run calendar, your calendar le would include the two lines given in Figure 27-4. NOTES: You can, of course, share your own calendar les with other users; this is useful for making special calendars for a group or organization. If the calendar le is in the current directory or /usr/share/calendar, you can just give the le name; otherwise, give its full path name in the include statement.
To have the system send you the days appointments in email, use crontab to schedule a daily cron job that runs calendar and, if there is any output, mails it to you with mail (see Recipe 28.3 [Scheduling Commands], page 557). To do this, add the following line to your crontab le (if you dont have one, just put this line in a text le called crontab somewhere in your home directory tree):
45 05 * * 1-5 calendar | mail -s 'Your Appointments' [email protected]
The 45 05 * * 1-5 species that these commands be run at 5:45 a.m. on every weekday. The rest of the line is the series of actual commands that are run: The calendar tool is run on your personal calendar le, and if there is any output, its mailed to [email protected] (replace that with your actual email address, or with your username on your local system if you check mail there). Add this new entry to the schedule by running the crontab tool with the name of your crontab le as an argument.
546
To add to the cron schedule any new entries that are in the le crontab, type:
$ crontab crontab RET
NOTES: The name of the command, crontab, is the same as the le it uses, crontab.
547
elds; you can even cut and paste text into it from email, the Web, or other windows (see Recipe 10.3 [Manipulating Selections of Text], page 253).
Mary Smith 14 Elm St Centerville, New York ### Susan Jones - 602 555 1803 (don't call after eight) ### Prof. Jenkins, 25 College St, Uptown, New York 555-2011 [email protected]
Figure 27-5. The rolo le. There are several ways to nd text in such a le. Suppose, for example, you want to contact your friend Susan, and you need her telephone number. To output the line in the le containing the text susan, regardless of case, type:
$ grep -i susan rolo RET Susan Jones - 602 555 1803 $
This works nicely when the information you need is on the same line as the information you search forhere, the name Susan is on the same line as the telephone number; however, the output did not show the warning that appears on the next line in the le. And what about when the term you search for and the information you need are on adjacent lines? Use the -C option with grep to output several lines of context before and after matched lines.
548
To output the several lines around the line matching the text Jenkins, type:
$ grep -C Jenkins rolo RET Prof. Jenkins, 25 College St, Uptown, New York (914) 555-2011 [email protected] $
Another way to search such a le is to open it as a buer in Emacs and use any of the Emacs searches. The Emacs incremental-search function, CTRL - S , is very useful for such leseven for very large ones. If you do such a search on a large le, and the rst result doesnt turn up the right record, just keep typing CTRL - S until the right one appears. If you type the letters to search for in all lowercase, Emacs matches those letters regardless of case. Here are two ways to use this. To search through the current buer in Emacs for the rst entry containing the text New York, regardless of case, type:
CTRL - S
new york
To search for the next entry containing the text New York, regardless of case, type:
CTRL - S
You can repeat this keystroke as many times as you wish to show all entries in the entire buer with the text New York in them. Once you reach the end of the buer, type CTRL - S again to loop around to the beginning of the buer and continue the search from there. (The minibuer will tell you when youve reached the end of the buer, and will remind you to type this if you want to loop the search.) NOTES: Its also useful to peruse and search through these kinds of les with lesssee Recipe 14.11 [Searching the Text Youre Perusing], page 354.
549
The Insidious Big Brother Database is a contact manager tool for use with Emacs. You can use it with Emacs email and news readers; it stores contact information in records and allows you to search for records that match a regular expression, as well as records whose particular elds match a regular expression (see Recipe 14.3 [Matching Patterns of Text], page 335). There are several ways to add a record to the database. Use the bbdbcreate function to manually add a record. (When you run this command, bbdb prompts you to enter the relevant information for each eld.) When in a mail reader inside Emacs, type a colon (:) to display the record for the author of the current message; if there is none, bbdb asks whether or not one should be created. Here are two ways to use this. To create a new bbdb record from scratch, type:
ALT - X
bbdb-create RET
To add a new bbdb record for the author of the current email message, type:
:
Use the bbdb function to search for recordsit takes as an argument the pattern or regexp to search for. To output records containing the text scott anywhere in the record, type:
ALT - X
There are additional functions that let you narrow your search to a particular eld: bbdb-name, bbdb-company, bbdb-net, and bbdb-notes, which respectively search the name, company, email address, and notes elds. To output records matching the regexp *\.edu in the email address, type:
ALT - X
550
When you run leave with no arguments, it prompts you to enter a time; if you just type RET , leave exits without setting the reminder. This method is good for adding leave to scripts or to your .bashrc, so that you can interactively give a time to leave, if desired, when the script runs (see Recipe 3.7.3 [Using Shell Startup Files], page 86). NOTES: leave will output a reminder on the terminal screen ve minutes before the given time, one minute before the time, at the time itself, and then every minute subsequently until the user logs o.
551
For example, if your username on your local system is joe, to send yourself an email reminder, youd type:
$ mail joe RET Subject: Bring files to meeting RET CTRL - D Cc: RET Null message body; hope that's ok $
NOTES: For more about using the mail tool, see Recipe 32.1 [Sending Mail], page 612.
Figure 27-6. The .vacation.msg le. Then, edit another hidden le in your home directory called .forward, and put the following line in it:
\cpeterson, "|/usr/bin/vacation cpeterson"
This will save a copy of all incoming mail in your inbox, and it will use vacation to reply to any mails addressed to the username cpeterson; the reply mail will be the one you wrote in .vacation.msg.
552
Then, when you return from vacation, just move the .forward le to something else. To move your .forward to .forward.not, type
$ mv .forward .forward.not RET
NOTES: You can leave the .vacation.msg le where it is, and edit it as needed next time you are about to go away. If you run vacation, it is a good idea to unsubscribe yourself from any mailing lists before your absence. That way, you will avoid the embarrassment of sending your message out to all the subscribers of a list whenever someone posts a message to it.
To list all the les in your home directory tree, excluding directories, that were modied today, type:
$ find ~ -daystart -mtime -1 \! -type d RET
You can make variations on this recipe to see what you did at other times. Here are two ways to use this. To list all the les in your home directory tree, excluding directories, that were accessed between now and two days ago, type:
$ find ~ -daystart -atime -2 \! -type d RET
To list all the les in your home directory tree, excluding directories, that were modied exactly two days ago, type:
$ find ~ -daystart -mtime 2 \! -type d RET
To measure not by numbers of days ago, but to nd les accessed or changed on a specic date, use touch to touch two temporary les: one with the date you are looking for, and one with the day after. Then use find to nd les newer than the rst, but not newer than the second.
553
This lists all the les that were last modied on September 11, 2001. Use -anewer to list les were last accessed that day, and -cnewer to list les that were last changed that day. Two temporary les are made with special timestamps, /tmp/911 and /tmp/912.
Ccal Evolution
Replacement for cal that outputs calendars in color. DEB: ccal Groupware suite that includes calendar and address facilities. DEB: evolution RPM: evolution WWW: http://ximian.com/products/evolution/ Outputs many types of calendars, including astronomical ones. DEB: gcal RPM: gcal WWW: http://www.gnu.org/software/gcal/gcal.html Appointment manager for kde, with built-in calendar and scheduler; uses vCalendar le format. DEB: korganizer RPM: korganizer WWW: http://www.kde.org/
Gcal
KOrganizer
554
Jpilot
Keeps names and addresses on a Palm desktop, and includes date book, address book, to-do list, and a facility for making memorandums; extensive plug-ins have been developed for it. DEB: jpilot RPM: jpilot WWW: http://jpilot.org/ Analog clock for X that inverses its colors when you have new mail waiting; has built-in appointment facility. DEB: rxvt RPM: rxvt WWW: http://sourceforge.net/projects/rxvt/ Graphical schedule planner. DEB: plan RPM: plan WWW: http://me.in-berlin.de/~bitrot/plan.html Keep track of any sort of thing you can put in a list. DEB: quicklist RPM: quicklist WWW: http://tinyurl.com/2a9d5 Reminder service with www facilities. DEB: remind Prints calendar in the docking bar of window managers, such as Window Maker. DEB: wmdate RPM: wmdate Reminds you to take a break from typing. DEB: xwrits The original graphical calendar for X. Has programmable alarms and an appointment and memo facility. DEB: xcal
ouR CLOCK
Plan
QuickList
Remind Wmdate
Xwrits Xcal
555
28. Scheduling
Sometimes it is useful to specify a command or set of commands so that they run not immediately, but at some other time. This chapter describes techniques for handling this sort of function, as well as techniques for monitoring commands that are currently running.
You can also give the time in minutes, hours, or days. To do this, follow the argument with a unit, as listed in the following table. s m h d Seconds Minutes Hours Days
$ sleep 5m; saytime & RET
1
The shell command separator; see Recipe 3.1.7 [Running a List of Commands], page 63.
556
In this example, the username is chuck and the job number scheduled by at is 5. The at tool understands many time formats, from the month, day, and year to the hour and minute (optionally given in military time, or followed by AM or PM), and the special words midnight, noon, and teatime (the last of which translates to 4 p.m.). You can use the suxes today or tomorrow, and you can use a + after a time followed by a number of minutes, hours, days, or weeksfor example, 8pm + 2 days means to run two days from 8 p.m. tonight. So to run a command at a week from midnight, use midnight + 1 week. To schedule ~/bin/clean and ~/bin/tidy to run at 9 p.m. tomorrow, type:
$ at 9pm tomorrow RET warning: commands will be executed using /bin/sh at> ~/bin/clean RET at> ~/bin/tidy RET at> CTRL - D <EOT> job 6 at 2003-08-09 17:10 $
557
Instead of giving the commands from the standard input, you can specify a list of commands to run from a le. To do this, give the name of the le as an argument to the -f option. To have the system run the commands in the le extra.work at midnight tonight, type:
$ at -f extra.work midnight RET
NOTES: This method is not for running a command in your current shell, or running a command at your terminal; to do either of these, see Recipe 28.1 [Delay Command], page 555. If you want to run a job at some regular interval, use cron instead (see Recipe 28.3 [Scheduling Commands], below).
Hours are given in military time; months and days of week are given either numerically or with their three-letter abbreviations. The time and date elds may contain the value of an asterisk character (*), which means the rst
558
possible value to the last possible value of the eld, inclusive. Time and date elds may also contain ranges of numbers, and individual numbers may be given separated by commas. To write comments in your crontab le, begin a lines with a hash sign (#); the line will be ignored by the system. Blank lines are also ignored. For example, a simple crontab le might look like Figure 28-1.
# This is my sample crontab file. # Runs the 'foo' command at noon every single day. 0 12 * * * foo # Runs the 'bar' command at 1:23 in the morning on every day in June. 23 1 * Jun * bar # Runs the 'foobar' command at half-past four and five p.m. every Monday # through Wednesday whose day of the month is between 1 and 14. 30 16,17 1-14 * Mon-Wed foobar
Figure 28-1. A simple crontab le. The following recipes show how to manage cron jobs.
NOTES: To remove only some of your cron jobs, or to change your cron jobs, just revise your crontab le, deleting or revising the entries you want to, and then add your cron table (as described in the previous recipe).
559
This command will display the contents of the current directory in the terminal you run it in, and it will continually update every two seconds. To change the interval, give it as an argument to the -n option. To watch the detailed contents of the current directory, updating by the second, type:
$ watch -n 1 ls -l RET
Use the -d ag to highlight the dierences in the updates. To watch the detailed contents of the current directory, updating every ten seconds, and highlighting all the dierences, type:
$ watch -d -n 10 ls -l RET
NOTES: Sometimes you might nd it nice to run your watch session in a little xterm of its own. If youre not in X, you might want to devote a console terminal to it.
560
561
29. Mathematics
Tools and techniques for dealing with numbers are the subject of this chapter: listing them in sequence or randomly, calculating arithmetic, cryptography, and converting between units. Larger applications, such as spreadsheets and plotting tools, are also mentioned.
Figure 29-1. The calc script. Once you install this script (see Recipe A.3.4 [Installing a Shell Script], page 708), you can use it at the shell prompt to get the results of any simple arithmetic calculation. To do this, give the expression to evaluate as an argument to calc. Use an asterisk (*) for a multiplication sign and a forward slash (/) for division; to output the remainder, use a percent sign (%) instead of a slash. You can use parentheses to group expressionsbut when you do, be sure to quote them (see Recipe 3.1.3 [Quoting Reserved Characters], page 56).
562
Here are some ways to use this. To output the result of 50 times 10, type:
$ calc 50*10 RET 500 $
To output the result of 100 times the sum of 4 plus 420, type:
$ calc '100*(4+420)' RET 42400 $
NOTES: This is a method for speed. Its useful for quickly computing a simple arithmetic equation at the shell prompt, but it has several drawbacks: It only outputs whole integers; its operators are limited; and complex expressions must be quoted. Still, if youre at a shell prompt and need to know the product of 12,342 and 587, I dont think theres a faster way. But for doing anything more than the very simplest operations, see the next recipe, which describes bc.
563
venerable standbys is bc, a calculation language that supports arbitraryprecision numbers, scripts, variables, functions, and algebraic statements. Use it when you have a lot of calculations to make, or when you must compute numbers with decimals. Type bc to start it; you can then perform arithmetic operations interactively, just as you would with a desktop calculator or adding machine. When you are running bc, you type each statement to be evaluated on a line by itself, typing RET at the end of the statement; the evaluation of what you type is output on the following line. Each line you type will be evaluated by bc as an arithmetic expression. To exit, type quit on a line by itself. To multiply 42 by 17 with bc, type:
$ bc RET bc 1.06 Copyright 1991, 1992, 1993, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 42 * 17 RET 714 quit RET $
In this example, bc output its version number and warranty information when it started; then, the statement 42 * 17 was typed by the user, bc output the result (714), and then the user typed quit to exit bc. By default, digits to the right of the decimal point are truncated from the outputso dividing 10 by 3 would output 3 as a result, and outputting the remainder from this operation by typing 10%3 would output 1. But since bc is an arbitrary-precision calculator, you can give the number of digits to use after the decimal point. Do this by specifying the value of the scale variable; its default value is 0.
564
To use bc to compute the result of 10 divided by 3, using 20 digits after the decimal point, type:
$ bc RET bc 1.06 Copyright 1991, 1992, 1993, 1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. scale=20 RET 10 / 3 RET 3.33333333333333333333 quit RET $
Use the -l option to start bc with a scale of 20, and with a number of math functions loaded, as described in the following table. s (x) c (x) a (x) l (x) e (x) j (n,x) Outputs sine of x (x is given in radians). Outputs cosine of x (x is given in radians). Outputs arctangent of x, in radians. Outputs the logarithm of x. Outputs the exponential function of e to the xth power. Outputs the Bessel function of integer order n of x.
The following table describes the symbols you can use to specify mathematical operations. expression + expression expression - expression expression * expression expression / expression Add: Output the sum of the two expressions. Subtract: Output the dierence of the two expressions. Multiply: Output the product of the two expressions. Divide: Output the quotient of the two expressions.
565
Remainder: Output the remainder resulting from dividing the two expressions. Power: Raise the rst expression to the power of the second expression. Group an expression or expressions together, altering the standard precedence of performing operations. Output the square root of expression.
sqrt(expression)
The -q option is niceit suppresses the copyright and warranty message at start-up. Starting bc with both this and the -l option is a good way to run it, and you might want to make an alias for bc with these two options (see Recipe 3.6 [Using Alias Words], page 82):
alias bc='/usr/bin/bc -ql'
To output a random number in a range starting from zero but under a certain number, use RANDOM with the Bash arithmetic evaluation expression $(( $RANDOM % number )), where number is the integer that the output should be under. To output a random number from 0 to 9, type:
$ echo $(( $RANDOM % 10 )) RET
566
Here are two ways to use this. To output the sequence of numbers from 1 to 7, type:
$ seq 7 RET
To output the sequence from any one number to another, give those numbers as arguments. Here are two ways to use this. To output the sequence of numbers from 9 to 0, type:
$ seq 9 0 RET
To specify an increment other than one, give it as the second argument, between the starting and ending number. To output the sequence of numbers from -1 to 14, incrementing by 3, type:
$ seq -1 3 14 RET
Use the -w option to pad numbers with leading zeros so that theyre all output with the same width. Specify a separator string to be output between numbers as an argument to the -s option; the default is a newline character, which outputs each number in the sequence on its own line. Here are two ways to use this. To output the sequence of numbers from 9 to 999, incrementing by 23, with numbers padded with zeros so that theyre all of equal width, type:
$ seq -w 9 23 999 RET
To output the sequence of numbers from 1 to 23, with a space character between each, type:
$ seq -s ' ' 1 23 RET
To pass a sequence of numbers as arguments to a command, pipe the output of seq using a space character as a separator. To concatenate all the les in the current directory, whose names are numbers from 25 through 75, into a new le called selected-mail, type:
$ cat `seq -s " " 25 75` > selected-mail RET
567
The preceding example substitutes the output of seq as an argument to cat (see Recipe 3.1.11 [Specifying the Output of a Command as an Argument], page 65).
NOTES: If no number is given, factor reads numbers from standard input; numbers should be separated by space, tab, or newline characters.
568
In this example, the output indicates that there are about 1.7636981 ounces in 50 grams, and that conversely, one ounce is about 0.56699046 times 50 grams. The units tool understands a great many dierent kinds of unitsfrom Celsius and Fahrenheit to pounds, hectares, the speed of light, and a bakers dozen. All understood units are kept in a text le database; use the -V option to output the location of this database on your system, and then peruse or search through it to see which units your version supports. To determine the location of the units database, type:
$ units -V RET units version 1.55 with readline, units database in /usr/share/misc/units.dat $
In this example, the units database is located in the le /usr/share/misc/units.dat, which is the le to peruse to list all of the units data. NOTES: With no arguments, units runs interactively, asking you rst what you have, and then second what you want. More units of measurement can be found in A Dictionary of Units of Measurement [http://www.unc.edu/~rowlett/units/].
569
an argument; with no argument, number reads a numeral from the standard input. To output the English text equivalent of 100,000, type:
$ number 100000 RET
This type of cipher, where letters are substituted by rotating the entire alphabet according to some oset, is known today as Julius Caesars cipher, named after its most famous adopter.1 There are two primary methods, both using lters, for encoding and decoding text in and out of rot13. One, the traditional method, is to use tr to transpose the characters, giving a set of the rst and last 13 letters to transpose from, and a set of the last and rst 13 letters to transpose to. The second method automates this process with a tool called rot13, part of the bsd-games package. This package also includes caesar, a tool for decoding Caesar ciphers in general via statistical analysis of input. rot13 is not intended as a method for general encryptionits much too easy to gure outbut its good for when you want to temporarily obscure some text, such as the punch line of a joke or the spoiler portion of a movie review. To encode some text, make it a selection in X and then send it through one of the two lters for encoding it, or just type it as input to either lter. To decode some lines of rot13 in text, do the same thing: make a selection of the encoded text, and then pass it through either of the lters (see Recipe 10.3 [Manipulating Selections of Text], page 253); press CTRL - D to terminate and exit the lter.
1
570
In the last example above, the text This is a secret message. was the current text selection. METHOD #2 Bsd-games DEB: bsdgames RPM: bsd-games WWW: http://www.ibiblio.org/pub/Linux/games/ Use the rot13 lter to encode text in rot13. It works in the same way as tr, described previously.
571
Here are some ways to use this. To encode the text in message in rot13, and output it to a new le called secret_message, type:
$ rot13 < message > secret_message RET
NOTES: To insert the text selection with the mouse, press the middle mouse button instead of SHIFT - INS .
To decode the rot13-encoded text in secret.script, writing the decoded text to a le named script, type:
$ tr [a-mn-zA-MN-Z] [n-za-mN-ZA-M] < secret.script > script RET
572
METHOD #2 Bsd-games DEB: bsdgames RPM: bsd-games WWW: http://www.ibiblio.org/pub/Linux/games/ Use the rot13 lter to decode text encoded in rot13. Here are some ways to use this. To decode the rot13-encoded text in secret_message, sending the decoded text to the standard output, type:
$ rot13 < secret_message RET
To decode the rot13-encoded text in secret_message, writing the decoded text to a le named message, type:
$ rot13 < secret_message > message RET
573
gnu Privacy Guard (gpg) is a public key encryption system. It is a free and open replacement for pgp, Pretty Good Privacy,2 and is mostly compatible with newer pgp versions. Public key encryption works like this. Everyone who uses it rst runs the program in such a way as to get his own set of keys, which are strings of numbers generated by a particular mathematical function built into the public key encryption system. Two keys are made: a public key, which you make public to anyone you want to send your encrypted data to, and a private key, which only you have access to. Both are unique series of data, and they are generated by a passphrase that you type when making the keys. When the public key is processed by the gpg tool, it will output a unique function and encode its input data in such a way that it cannot be decrypted, except when gpg is called with the private key. People who use gpg make their public keys available, so that anyone else who uses gpg can encrypt some data for a particular person by using that persons public key. Once encrypted, nobody but the recipientnot even the sendercan decrypt the data. Only by using the private key corresponding to a particular public key can the text be decrypted. So to begin using gpg, you must rst generate your own set of keys. Do this by running gpg with the special --gen-key option. To generate your own set of keys, type:
$ gpg --gen-key RET
When you run this command, you will be asked to specify some things: the algorithm used (dsa/ElGamal is recommended), the key length (longer keys give more security at the expense of taking longer to compute; many recommend no fewer than 2,048 bits, while an older standard is 1,024 bits), some names and email addresses of individuals you would like to exchange encrypted data with (you can always add more later), and nally a special passphrase. This passphrase is what turns your private key in the encryption lock: You will use it every time you wish to unlock anything encrypted for you with your public key. The passphrase ought to be at least 32 characters long, varied in its characters (using numerals, symbols, and both uppercase and lowercase letters), and it should be something that nobody else will be able to guess.
2
pgp, popularized in the early 1990s Internet rush, uses patented algorithms and thus cannot be free software; gpg carries no such restrictions.
574
The keys will take some time to generate. To make your key available for others, export it to an ascii le with both the -a and --export options. To export your public key to a le named alice.key, type:
$ gpg -a --export > alice.key RET
You can make this data available to anyone youd like to communicate with via gpgyou can send it to someone via email, put it on a Web site, and so on. To begin to communicate securely with someone else via gpg, you will also need to import his public key. Do this by using gpg with the --import option, and giving as an argument a le containing his public key. To import the public key for your friend Bill, which you have put in the le bill.key, type:
$ gpg --import bill.key RET
This command puts your friend Bill on your keyring, which is the list of recipients that gpg knows about and can encrypt for. Use the --list-keys option to list the people on your keyring. To list the keys gpg knows about, type:
$ gpg --list-keys RET
This command writes an encrypted binary le named mission.gpg, which can be decrypted only by Bill. Use the --armor option to make an armored le, or one that only uses 7-bit ascii characters. The le will be longer in length, but it will be easy to transmit in the body of an email message, or via other means not possible for a binary le. To encrypt the contents of mission for your associate Bill, and output an armored text le, type:
$ gpg --armor -e [email protected] < mission RET
575
To decode the data in the le message.gpg and write it to a new le, message.txt, type:
$ gpg -d < message.gpg > message.txt RET
where inputle is the name of the input le, and plotstyle species the drawing style to be used for the plot. Preface the plot command with any number of set commands to change the default settings; these commands may be typed
576
interactively after running gnuplot, or they may be written to a le and called as an argument. For example, suppose you have a le temperature.data containing two columns of text, delimited by tab characters, as in Figure 29-2.
January February March April May June July August September October November December 68.9 68.7 69.0 70.2 72.0 73.4 74.3 75.8 74.6 73.8 71.8 70.1
set title "Mean Monthly Temperatures for Hawaii, 1905-1938" set xlabel "Month" set ylabel "Temperature" set nokey set xdata time set timefmt "%B" set format x "%b" set nomxtics set terminal postscript color set output "temps.ps" plot "temperature.data" using 1:2 with linespoints
Figure 29-3. The temperature.gnuplot le. And suppose you also have a le temperature.gnuplot, as in Figure 29-3, containing a set of gnuplot commands to plot a graph. It contains several lines of settings that aect or change the default behavior, including setting the title of the graph and labels for the x and y axes. The last line in the le contains the command to do the actual plotting. It reads the plot data from the le temperature.data, using the rst column
577
as month data for the graphs x axis, and the second column as the data to plot along the y axis, using the linespoints style. To process the commands in temperature.gnuplot, type:
$ gnuplot temperature.gnuplot RET
This command starts gnuplot and runs the commands in the le temperature.gnuplot. A new PostScript le, temps.ps, is written, which looks like Figure 29-4. (While the printed illustration is in black and white, the actual image created from this command has a red plot.)
where inputle is the name of the input le and, for each plot, plot is the number of the column containing the plot, titlename is the name for its title in the key, and plotstyle is the drawing style to be used. Each using statement may be followed by a comma and the using statement for the next plot until all are specied.
578
Figure 29-5. The temperature2.data le. This le contains four columns of text, delimited by tab characters. The rst line is a commentany lines beginning with a pound-sign character (#), in either input data or gnuplot command les, are considered comments and are ignored by gnuplot. Now suppose you also have a le temperature2.gnuplot, as in Figure 29-6.
set title "Mean Monthly Temperatures for Company Locations" set xlabel "Month" set ylabel "Temperature" set xdata time set timefmt "%B" set format x "%b" set nomxtics set terminal postscript landscape color set output "temps2.ps" plot "temperature2.data" using 1:2 title "Honolulu" with linespoints, "" using 1:3 title "Tampa" with linespoints, "" using 1:4 title "New York" with linespoints
579
This is very similar to the command le in the previous example, except for the following dierences: The title is changed; the command to turn o the key is not printed; the name of the output le diers; and in the long last plot line, columns two through three are each plotted against the rst column (the month names) in the input le, each with the linespoints style as before, but each with its own label for the key. To process the commands in temperature2.gnuplot, type:
$ gnuplot temperature.gnuplot RET
This command starts gnuplot and runs the commands in the le temperature2.gnuplot. A new PostScript le, temps2.ps, is written, which looks like Figure 29-7. (While the printed illustration is in black and white, the actual image created from this command has colored plots.)
580
Calc
Scientic calculator tool for Emacs. DEB: calc RPM: calc WWW: http://www.isthe.com/chongo/tech/comp/calc/ Arbitrary-precision calculator that reads from standard input and writes to standard output. dc is a reverse-polish calculator; that is, numbers are pushed on a last-in rstout (lifo) list called a stack. When you give an arithmetic operation symbol, dc pops numbers o the stack for their operands, and then it pushes the evaluation on the stack. Very useful for getting evaluations in scripts and at the command line. DEB: dc WWW: http://www.cypherspace.org/~adam/rsa/dc.html Calculates the properties of a geodesic domechord factors, spherical vertex coordinates, and so on. Supports Buckyball formations and elliptical geodesics, and generates plain text output as well as formats for spreadsheets, cad, and ray-tracing tools. DEB: dome WWW: http://tinyurl.com/2p5b4 Intuitive personal nance application, used for managing nances (including bank accounts, stocks, income, and expenses); its based on professional accounting principles to ensure accuracy in computation and reporting. DEB: gnucash RPM: gnucash WWW: http://www.gnucash.org/ Powerful spreadsheet application for gnome that is somewhat reminiscent of Excel. DEB: gnumeric RPM: gnumeric WWW: http://www.gnome.org/projects/gnumeric/
Desk Calculator
Dome
GnuCash
Gnumeric
581
Oleo
Small gnu spreadsheet application that can run in both an X window and in terminals, has Emacs-like key bindings, and can generate PostScript output. DEB: oleo RPM: oleo WWW: http://www.gnu.org/software/oleo/ Facilitates making graphical pie charts with the gnu plotting utilities (below). WWW: http://tinyurl.com/jdi6 Package of gnu programs for plotting data, including gnu replacements for the old unix standbys of graph, plot, and spline. DEB: plotutils RPM: plotutils WWW: http://tinyurl.com/3eygd Spreadsheet tool that runs in the console; even smaller than Oleo, it provides formulas and other basic features you would expect from a minimal spreadsheet. DEB: sc Fast C program for computing prime numbers. WWW: http://bytesex.org/misc.html Visual scientic calculator for the X Window Systemit draws a calculator on the screen, and you can use the mouse or keyboard to use it. It is capable of emulating the ti-30 and hp-10c calculators. DEB: xbase-clients RPM: XFree86-tools X client front-end to sc. RPM: xspread
Piechart
Plotutils
Sc
Sieb Xcalc
Xspread
582
583
30. Amusements
Whats productivity without a section on how to manage extra time? The recipes in this chapter describe those classic games and whimsies that were traditionally found on unix systems, and are now available for Linux. It also includes recipes for solving word games with your system and other amusements sure to keep you occupied.
adventure
Text-based simulation game based on an actual cave in Kentucky called Colossal Cave. Written by William Crowther and Don Woods in the 1970s, it predates the pc era zork. More information on the history of this game is online at http://www.rickadams.org/adventure/. Quizzes you on a set of elementary addition and subtraction problems and times your speed of answer. Air Trac Controller simulation. One- or two-player backgammon game, with rules.
584
banner
Outputs text in a long vertical text font, good for printing large banners. (see Recipe 16.4.2 [Outputting Text Banners], page 402. On Debian systems, banner is included in the bsdmainutils package instead.) Text-based adventure game with a fantasy theme. Written by David Riggle in 1979. Filters text into paper punch card output. Popular word game. Decrypts Julius Caesars cipher (see Recipe 29.6 [Using rot13 Encryption], page 569). Variant of solitaire. Displays your caneld scores. Tells you how much mail you have, but in a rather obnoxious manner. The card game of cribbage. The childrens card game of Go Fish. Two-player game of Five in a Row. The classic guess the word game. Multi-player network game whose object is to hunt and kill all other players. Mille Bornes, a two-handed card game. Monopoly, a property management game similar to the famous board game. Filters text into Morse code. Writes the words dit and daw by default; use -s to output dots and dashes instead of words. To decode Morse code into plain text, use the -d option.
battlestar bcd boggle caesar canfield cfscores countmail cribbage fish gomoku hangman hunt mille monop morse
585
number
Converts Arabic numerals to English (see Recipe 29.5.2 [Converting an Arabic Numeral to English], page 568). A role-playing fantasy game. Filters text into Pig Latin. No reverse lter is currently available. Tells you the current phase of the Moon. Filters text into paper tape ribbon output. Outputs prime numbers, beginning at 0 and stopping at 4,294,967,295 or a number given in standard input; you can also give start and stop values as arguments. For example, to output the prime numbers between one and ten, primes 1 10 is the command to run. Quizzes you on facts and trivia from a variety of subjects. Encrypts and decrypts rot13 ciphers (see Recipe 29.6 [Using rot13 Encryption], page 569). Displays an animation of raindrops falling on the screen. Control the delay by giving a value, in milliseconds, as an argument to the -d option. For example, rain -d 160 is a good setting to try. Outputs random lines from its input. Shoot-em-up game where you battle killer robots. Role-playing game of an old-fashioned sea battle. Avoid the snake while collecting money. Displays the high scores of snake. Instructions for the game of backgammon. The famous Russian video game of Tetris. Space adventure game.
586
The game of Global Thermonuclear War, as inspired by the lm WarGames: Shall we play a game? The growing worm game. Displays an animations of worms squirming over the display screen. Explains acronyms used in online communication. It isnt very advanced (for instance, it doesnt even know what faqs are), but it does know what lol is. If it doesnt know the acronym, it looks to see if whatis can give any help (see Recipe 11.4.2 [Translating Common Acronyms], page 292). The adventure game of Hunt the Wumpus, perhaps the most famous of classic computer games.
wump
NOTES: In the deb package, a list of original authors for all of the included programs is at usr/share/doc/bsdgames/AUTHORS.
This command passes the contents of the le /etc/motd to the kraut lter, whose output is then sent to standard output. The contents of /etc/motd are not changed. NOTES: Some of the dialect lters available include nyc, which gives a New Yawker dialect to text, and newspeak, which translates what is really said
587
into the approved, politically correct language of the thought police, as described in George Orwells novel, 1984. War Is Peace! Freedom Is Slavery! Some sample text and the way it appears through the various lters is kept in the le /usr/share/doc/filters/SAMPLES. While all of the given lters are humorous, it is possible to write your own lters to change patterns of text in its input for some serious purpose, such as ltering text for a publications house style.
In this example, 9 was output indicating that the user typed nine words (in a real typing test, you want to type for longer than thatat least a few hundred words to get an accurate count). The dates listed before and after the typing show that it took the user six seconds to type these nine words. Use bc or any other calculator to divide the number of words by the time in minutes (or seconds) it took to type them. NOTES: You can test your typing in Emacs by running the time function before and after your typing; then select the text that was typed and send it to wc to get the number of words.
588
METHOD #1 Fortune DEB: fortune-mod fortune-min RPM: fortune-mod WWW: http://www.ibiblio.org/pub/Linux/games/amusements/fortune/ Use fortune to output a fortune cookie to the standard output. To get a fortune, type:
$ fortune RET
NOTES: This venerable program has been on unix systems for a long time, and several types of specialized fortune databases are available. You can even make your own fortune les, containing quotations of your own choosing these are made with the strfile command. METHOD #2 In Emacs, you can get random quotations from Zippy the Pinhead, the comic strip character. When you run the yow function, a Zippy quote is written to the minibuer. To get a line from Zippy, type:
ALT - X
yow RET
589
Here are two ways to use this. To output all anagrams of the word lake, type:
$ an lake RET
To limit the anagrams that are output to those containing a given string, specify that string with the -c option. To output only anagrams of the phrase lakes and oceans that contain the string seas, type:
$ an -c seas 'lakes and oceans' RET
To print all of the words that can be made with some or all of the letters in a given word or phrase, use the -w option. This outputs words that are not anagrams, because anagrams must contain all of the letters of the other word or phrase. To output all of the words that can be made from the letters of the word seas, type:
$ an -w seas RET
This command outputs all of the words that can be formed from all or some of the characters in seas, including see and as. NOTES: There are other tools for nding anagrams, but this one is the best. Unfortunately, it isnt widely available outside of the Debian distribution; if you cant locate a copy, you can always install the sources from the Debian package (see Recipe 1.1.2 [Preparation of Recipes], page 3).
590
This outputs all lines in le that are palindromes. To check for palindromes in the standard input, specify - as the le name to check. This is useful at the end of a pipeline. To output all of the palindromes in the system dictionary, type:
$ perl -lne 'print if $_ eq reverse' /usr/dict/words RET
METHOD #2 To output all lines in a le that are palindromes, regardless of whitespace, punctuation, and case, use the following one-liner instead of the one given in Method #1:
perl -lne '{ $_ = lc; $_ =~ s/\W//g; $_ = reverse; print if $_ eq reverse }' le
This outputs all lines in le that are palindromes (all whitespace and punctuation will be removed, and all letters will be converted to lowercase). To output all of the lines in the le riddles that are palindromes regardless of whitespace, punctuation, and case, type (all on one line):
$ perl -lne '{ $_ = lc; $_ =~ s/\W//g; $_ = reverse; print if $_ eq reverse }' riddles RET
In the last example, the system dictionary will load and begin at the word cat, and that string will be highlighted in the text.
591
You can also use look to output all words that begin with a given string (see Recipe 11.2.1 [Listing Words That Match a Pattern], page 283). To list all words that begin with anti, type:
$ look anti RET
METHOD #2 Another method you can try for nding crossword puzzle words is grep the dictionary for the pattern you needif you know a word is so many characters long, or has characters in certain positions, you can search for all words that t the pattern. Use the -i option to do a case-insensitive search. Here are some ways to use this. To output all words in the system dictionary that are four characters long, begin with the letter z, and end with an a, regardless of case, type:
$ grep -i ^z..a$ /usr/dict/words RET
To output all words in the system dictionary that are six characters long, have the letter e in the second position, and have either an s or an o in the fourth position, type:
$ grep -i '^.e.[so]..$' /usr/dict/words RET
NOTES: These methods are also good for Scrabble and other word games. On some systems, /usr/share/dict/words is where the the system dictionary is kept.
In The Third Mind, by William S. Burroughs and Brion Gysin (Viking Press, 1978).
592
Figure 30-1. The cutup le. This script takes the name of a le as input and cuts it both horizontally and vertically along the middle, rearranges the four sections to their diagonally opposite corners, and then writes that cut-up to the standard output. The original le is not modied. To make a cut-up from a le called nova, type:
$ cutup nova RET
593
Give as an argument the name of the text le to be used; by default, dadadodo outputs text to standard output until you interrupt it by typing CTRL - C . To output random text based on the text in the le nova, type:
$ dadadodo nova RET
This command will output passages of random text based on the text in the le nova until it is interrupted by the user. You can analyze a text and save the analysis to a le of compiled data; this analysis can then be used to generate random text when the original input text is not present. The following table describes this and other dadadodo options. -c integer -l lename -o lename -p integer Generate integer sentences (default is 0, meaning generate an innite amount until interrupted). Load compiled data in le and use it to generate text. Output compiled data to le for later use. Pause for integer seconds between paragraphs.
dissociated-press RET
Give a positive argument to the dissociated-press function to specify the number of characters to use for overlap; give a negative argument to specify the number of words for overlap. Here are two ways to use this. To generate a Dissociated Press cut-up from the current buer, always overlapping by three characters, type:
CTRL - U
594
To generate a Dissociated Press cut-up from the current buer, always overlapping by one word, type:
CTRL - U
doctor RET
VII. NETWORKING
595
VII. NETWORKING
596
597
31. Communications
You will almost certainly want to go online or otherwise communicate with other computer systems. Most systems today are sold with the necessary hardware to connect to other systems, such as a modem or a network card. You connect this hardware to the outside world via a telephone line or network connection. This chapter includes recipes for connecting your Linux system to the Internet with an isp, using fax services, and making serial connections with a modem. For more information on this subject, see The Linux Network Administrators Guide [http://metalab.unc.edu/mdw/LDP/nag/nag.html].
A computer is sometimes called a box, particularly when one aspect of it is being described; therefore when you hear talk about a Linux box you know its just a computer that is running Linux. This slang is particularly popular among users of unix avors, but people do talk of Windows boxes.
598
Cable Modem Providers HOWTO, by Vladimir Vuksan http://en.tldp.org/HOWTO/Cable-Modem/ The following recipes show how to set up and use a ppp (Point-to-Point Protocol) dial-up connection, long the de facto means of connecting a computer to the Internet over a dial-up line.
Figure 31-1. A sample /etc/chatscripts/provider le. In Figure 31-1, after eight lines of modem initialization strings, the modem is instructed to dial the isp dial-up number, 555-1010. Some systems need one or two commas after the number to signify pauses for the modem; only do this if you cant get a good connection with just the telephone number in this space. Next come the lines which show the prompts your isp is expected to send, and the strings to give in response to them. Traditionally, only partial strings are shown to match the prompts, in part because case for the various prompts diers between systems. This is why the le has ost, ogin, and word,
599
and not host:, login:, and Password:, which are typically the full prompts you might expect. The host: prompt is optional, and is used by some isps whose connection line contains a choice of services from which you must make a selection before entering your username and password (some isps oer slip and shell access along with the standard ppp, for example). Customize this and the following lines as instructed by your isp. If your isp does not have a host prompt, then remove this line. In this example, the username smith is sent as a response to the login: prompt, and then the password of secret is sent for a password. The password appears between two \q strings in this le, whichfor security purposesinstruct ppp to display question mark characters (?) instead of the actual password in system log les or other places where an intruder might see it. Next, edit the le /etc/ppp/peers/provider so that it looks like Figure 31-2.
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider" defaultroute /dev/modem 115200 persist
Figure 31-2. The /etc/ppp/peers/provider le. The last line in this le2 should include the device name of the modem you are using and the maximum connect speed to try; Figure 31-2 uses /dev/modem as the device name of the modem, and 115,200 bps as the maximum connect speed, which is a good value for a typical 56 k modem (a rule of thumb is to use the highest connect speed your modem supports; you can always go lower when a connection is made, but you can never raise the speed above what is given here). Finally, edit the le /etc/resolv.conf so that it looks like Figure 31-3, using the two nameserver ip addresses given to you by your isp.
search . nameserver nameserver nameserver address 1 nameserver address 2
2
600
For the two nameserver address values, use the ip address of the nameserver machines, as given to you by your isp. The second is optionalmost isps have more than one designated nameserver as a backup in the event that the rst system becomes unavailable. Make sure that your user account has membership to the dialout group; otherwise, the superuser account will have to start and stop ppp, which is not recommended (see Recipe A.6.3 [Letting Users Access Hardware Peripherals], page 718). Once youve done these things, you should be able to start and stop ppp connections to the Internet. Complete documentation for setting up ppp is in the /usr/share/doc/ppp directory.
NOTES: To make ppp automatically start when the system rst boots, rename the le /etc/ppp/no_ppp_on_boot to /etc/ppp/ppp_on_boot. (You must be root, the superuser, to do this.)
If you ever accidentally run pon when a ppp connection is already established (it happens), poff will not work as expected because there are multiple ppp connections running. Use the -a option to stop all ppp connections. To stop all ppp connections, type:
$ poff -a RET
601
NOTES: You need to be a member of the adm group in order to view the log le (see Recipe A.6.3 [Letting Users Access Hardware Peripherals], page 718).
31.2 Faxing
Efax DEB: efax RPM: efax WWW: http://www.cce.com/efax/ If you have a Class 1 or 2 fax modem, you can send and receive fax (facsimile) messages with your Linux system. The following recipes show how to do this with the efax package, which is designed for single user systems or relatively simple fax congurations (more complicated tools for faxing exist, but they are beyond the scope of this book). To set up efax for faxing, edit the le /etc/efax.rc (you must be root to do this). The important things to specify in this le are the value for DEV, which is the device name in /dev of the fax or modem device (this should almost always be modem), and the values for FROM and NAMEthe fax number and organization name to appear on outgoing faxes. NOTES: Unless you have membership to the dialout group, you must ask your system administrator for access to the modem hardware before you can use it (see Recipe A.6.3 [Letting Users Access Hardware Peripherals], page 718). More information on faxing is contained in the Fax Server mini-HOWTO (see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50).
602
you must convert them to tiffg3 format rstsee Recipe 31.2.4 [Converting to and from Fax Format], page 604. Use the -d option to specify the full path name of the fax device (usually /dev/modem if you are using the modem connected to your system), and use the -t option followed by a telephone number to specify the number to send the fax to. To specify dtmf tone dialing, precede the phone number with a T; specify pauses in the dialing sequence with a comma character (,) particularly useful for dialing out from a pbx or oce phone system. To fax a copy of the le resume.txt to the number 555-9099, using dtmf tone dialing, type:
$ efax -d /dev/modem -t T555-9099 resume.txt RET
To send more than one le, specify them as arguments in the order they are to be sent. You can also specify them with a wildcard character, but be carefulthey are sent in the order in which the shell expands the le names, which is alphabetical order. If you have a lot of les that should be sent in a particular order, rename them so their le names begin with the number of the page they correspond to. But be sure to number them with the same number of digits for each lefor example, if you have 11 les to fax, dont name them 1.fax, 2.fax, and so on, to 10.fax and 11.fax, because the shell will expand them in the order of 1.fax, 10.fax, 11.fax, 2.fax, 3.fax, and so on up to 9.fax. In this case, you would number them as 01.fax, 02.fax, and so on, so that les 1 through 9 contain the same number of digits in their names as do 10.fax and 11.fax. To fax all of the les with the .fax extension in the current directory to the number 555-9099, using dtmf tone dialing, type:
$ efax -d /dev/modem -t T555-9099 *.fax RET
Another way to do this is to make a text le containing the list of les to fax, one le name per line, in the order you want them sent. If the les you want to send are not in the current directory, be sure to write the le names with path names relative to the current directoryso for example, if you want to send the le header.fax, which is in your home directory, and the current directory is ~/documents/faxes, the le should be specied as ~/header.fax. To fax all of the les listed in the le fax.list to the number 555-9099, dialing a 9 rst to obtain an outside line, and using dtmf tone dialing, type:
$ efax -d /dev/modem -t T9,555-9099 $(cat fax.list) RET
603
This command starts efax and sets up the modem to wait for an incoming fax. After a fax is received, efax exits. You can stop efax before it receives a fax by typing CTRL - C or by killing the efax job (see Recipe 3.3.5 [Stopping a Job], page 73). When a fax is received, it is written to a le in the current directory whose base name consists of the current numeric date and a session number generated by efax; each page is written to a separate le whose three-digit le extension is the page number. The received fax les are in tiff Group 3 fax format; use display to view them (see Recipe 17.1 [Viewing an Image in X], page 407), or convert them to PostScript or another format for printing (see Recipe 31.2.4 [Converting to and from Fax Format], page 604).
604
This command uses all of the default settings for the efax package, which you can congure. Old spool les are deleted and any recieved faxes are mailed to you. If you need to set more switches on efax and dont wish to type this every time you want to set up the fax machine, you can write a shell script to do more and save it in a le called faxon, as in Figure 31-4. Put it in your personal bin directory (see Recipe C.1 [Using a Directory for Personal Binaries], page 727). Each time a fax is received and then saved, efax restarts, waiting for another fax. A session log is written to the le faxlog in your home directory.
#!/bin/sh while : do trap break 2; efax -d /dev/modem -kZ -w -iS0=1 2>&1 >> ~/faxlog; done
Figure 31-4. The faxon le. Should an incoming facsimile message arrive, efax will receive it and write the message in les in the current directory, with a le name convention as described previously; then efax restarts, ready to receive another fax. Type CTRL - C to stop the script and exit efax.
605
There are several ways to do this. METHOD #1 Use efix to convert (or x) les for faxing; it will convert a le you want to fax to the tiffg3 format. You can also use it to convert received fax les to another format that you can view or print. The efix tool writes to the standard output, but you can redirect its output to a le to save it. To convert a le for faxing, type efix followed by the name of the le to convert, and redirect standard output to the le you want to contain your fax image. efix can read plain text, pbm, and tiff les. To convert the le chart.pbm for faxing, type:
$ efix -i pbm chart.pbm > chart.fax RET
This command converts a copy of the le chart.pbm to the tiffg3 fax format, writing it to a le called chart.fax. The original pbm le is not altered. METHOD #2 To convert a received fax le to a PostScript le that you can then preview (see Recipe 17.4.2 [Previewing a PostScript File], page 414) or print (see Recipe 25.1.1 [Sending a Print Job to the Printer], page 510), use efix with the -o ps option. To convert 19990325.001, a received fax le, to a PostScript le, type:
$ efix -o ps 19990325.001 > received.ps RET
This command converts the fax le into PostScript, and writes the output to a le called received.ps. The original fax le is not altered. METHOD #3 Ghostscript DEB: gs-common gs RPM: ghostscript WWW: http://www.cs.wisc.edu/~ghost/ To convert a PostScript le to fax format, use gs and specify tiffg3 as the output device to write to.
606
To convert the PostScript le resume.ps to fax format, type (all on one line):
$ gs -q -sDEVICE=tiffg3 -dSAFER -dNOPAUSE -sOutputFile=resume.fax resume.ps < /dev/null RET
This command writes a copy of the le resume.ps to the le resume.fax in tiffg3 format, which you can then send as a fax. The original PostScript le is not altered. NOTES: For more on using gs, see Recipe 25.3.1 [Preparing a PostScript File for Printing], page 518. METHOD #4 teTeX DEB: tetex-base tetex-bin tetex-doc tetex-extra RPM: tetex WWW: http://www.tug.org/teTeX/ Use dvi2fax to convert a dvi le made from TEX into tiffg3 format for faxing. It takes as options either -hi for high resolution, outputting at 204x196 dpi (the default), or -lo for low resolution, outputting at 204x98 dpi. Give as an argument the name of the dvi le to convert; giving the .dvi extension is optional. To convert the le proposal.let.dvi to low resolution fax-format les, type:
$ dvi2fax -lo proposal.let RET
Each page of input is written to its own le, numbered in order and with a .fax extension.
607
Use Minicom to dial out with the modem and connect with another system, such as when you want to connect to a bbs (Bulletin Board System). Its a serial communications tool for X or the console; it resembles some of the communications tools of the dos world, such as Telix and Procomm. Type minicom to run Minicom. When Minicom starts, you will be given a connection screen, which looks like Figure 31-5.
Figure 31-5. The minicom connection screen. The bottom line contains a status bar showing a message describing how to get help, the current modem settings (in this case, 57,600 bps, 8 data bits, no parity, one stop bit), whether or not cursor keys work (the mysterious NOR message), the version of the program (1.82), the kind of terminal emulation currently set (VT102), and whether or not an online connection is currently established. To get a help menu, type CTRL - A z while in the connection screen; from the help menu, you can press P to set the communications parameters, T to set the terminal settings, O to congure minicom, or D to enter the dialing directory. To dial a number from the connection screen, type ATDT followed by the number to dial.
608
When you type RET , Minicom will begin dialing the number; type any key to interrupt the dialing and hang up the line. Once connected, type CTRL - A h to hang up the line, or type CTRL - A x to hang up the line and exit the program. NOTES: Minicom isnt really a way to connect your system to the Internet; to do that, you normally start a ppp connection, as described earlier in this chapter.3
DTMFdial
Generates dual-tone multi-frequency (Touch Tone), and can be used for automatic dialing from address books. DEB: dtmfdial Popular client-server software suite for sending and receiving faxes as well as sending pages. DEB: hylafax-client DEB: hylafax-server DEB: hylafax-doc RPM: hylafax WWW: http://www.hylafax.org/
HylaFAX
Technically, you can use Minicom to dial a computer that is connected to the Internet, like a local Free-Net system, but your access to the net will be restricted within this Minicom window; with a traditional Internet connection such as ppp, your whole system has direct access to the net, including your Web browsers, email software, and other networking tools.
609
Lrzsz
Oers the Xmodem, Ymodem, and Zmodem protocols for le transfer over serial lines; based on the old rzsz package for unix systems. DEB: lrzsz RPM: lrzsz WWW: http://www.ohse.de/uwe/software/lrzsz.html Old-time telecommunications tool for X, similar to Minicom, with Zmodem protocol support and scripting capabilities. DEB: seyon WWW: ftp://sipb.mit.edu/pub/seyon/
Seyon
610
611
32. Email
The primary means of sending plain-text messages (or binaries in attachment les) between users across computer networks is called electronic mail, or email (and more often than not these days, just mail). Mail is sent and received in a special application called a mail user agent, or mua.1 Most of them operate by the same general principle: When you start it, a list of all your incoming mail is displayed like a kind of stack, in the order in which they were received, with one numbered line representing each message, and on it is the authors name, the subject, and the date. Selecting a number will display its contents on the screen, and oer a means of replying to it with a mail of your own, as well as a facility to write new mail. The number of these email applications available for Linux is large, and you could spend many hours exploring the details of all of them. Instead of beginning with such an exhibit, this chapter does three things: provide a brief introduction to using the default mail agent; show how you can use other tools on the system to manipulate your email, regardless of the mua you use; and give an overview of the most popular and well-supported mail agents, with pointers on where to go for more information. The default mail agent on Linux, as with other unix-based systems, is the mail tool.2 This is the tool we will use in this chapter for showing how to send and receive mail. It comes without many bells and whistles that are standard on most of the newer muas, and any user who sends and receives email more than occasionally will certainly want to learn a more advanced system (see Recipe 32.7 [Using Other Mail User Agents], page 631). However, mail is available on almost all unix-based systems, its capable of a few powerful tricks that you cant do with the other applications, and it always works in a pinchby learning to use it, you can always send and receive email on any Linux- or unix-based system you ever encounter.
1 2
Everyone outside of the unix world probably calls one of these an email app or email program. On many Linux systems, Mail is a synonymous name for this tool. And on some unix systems such as aix, the name of the tool is mailx; Linux provides that name as an additional synonym.
612
The text you type on the Subject: line is displayed as the subject of your email message, and the lines of text you type after that are the body text of the message. Various styles for sending email exist; some mimic paper correspondence, with a salutation, closing, and signature, whole others give just a signature, and still others omit all three. Email isnt always for proper letters; sometimes it isnt elevated beyond the telegram or memo pad, used only for the rapid transmission of brief informal messages. Various commands available when composing email are described in Recipe 32.1.5 [Composing a Mail], page 616. Type CTRL - D on a line alone to end the message. Then, mail prompts for Cc: addressesa carbon copy of the email message is sent to any addresses you give here, if any. Separate multiple addresses with commas, or just type RET if there are none. When you type, mail just reads the standard input like any other command line tool, so theres little direct editing capability in this basic email serviceuse CTRL - U to erase the current line, and CTRL - C CTRL - C (that is, CTRL - C pressed twice) to cancel your input and abort the message altogether. Thats it! No bells, no whistlesbut no time-wasting excess, either.
613
This command sends an email message to the user mrs on the local system. The email message itself is empty, but the subject is a short note asking whether user mrs will be attending a party. NOTES: Besides being good for sending mail to users that you might share your system with, mail is useful for sending yourself mail, as a way to give yourself a reminder at your terminal (see Recipe 27.6.2 [Sending Yourself Email Reminders], page 550).
Technically, you still are giving the email address, since email addresses take the form of username@hostname; when hostname is omitted, the localhost is assumed.
614
METHOD #1 To send a directory of les with a mua, you can put a copy of the directory in an archive (see Recipe 8.5 [Managing File Archives], page 199), gzip the archives, and then mail that compressed archive le as an attachment. This is how its normally done. METHOD #2 GNU Shar Utilities DEB: sharutils RPM: sharutils WWW: http://www.gnu.org/software/sharutils/sharutils.html You can also create a long pipeline to send the directory through the mail: Put a copy of the directory in a compressed archive with tar, and pipe the output of tar to uuencode, which encodes binary les into ascii text that can be transmitted over mail in a plaintext message. Then, pipe that encoded text to mail. To mail a copy of the ~/proj/latest directory tree to [email protected], type (all on one line):
$ tar -czf - ~/proj/latest | uuencode latest.tar.gz | mail -s "Here is the latest" [email protected] RET
This command will mail the directory tree as a uuencoded compressed tar le in the body of the message. When it is received, [email protected] should write the contents of the mail to a le, and run uudecode on it. It takes as an argument a uuencoded le, and it writes the decoded les to the current directory. To decode the contents of latest.uu, type:
$ uudecode latest.uu RET
This command will write a compressed tar le, latest.tar.gz, in the current directory; to uncompress it, you would run tar zxvf latest.tar.gz.
615
METHOD #1 Lynx DEB: lynx RPM: lynx WWW: http://lynx.browser.org/ To send a Web page as an annotated text le, pipe the output of the Lynx Web browser with the -dump option to mail (see Recipe 33.2 [Using Lynx], page 643). Since the output is plain text, you dont have to encode it before you mail it. Here are two ways to use this. To send a mail to the address [email protected] with the contents of http://gutenberg.net/etext98/rmnis10.txt, type (all on one line):
$ lynx -dump http://gutenberg.net/etext98/rmnis10.txt | mail [email protected] RET
To send a mail to the address [email protected] with the contents of http://gutenberg.net/etext98/rmnis10.txt and with a subject of Some Reminiscences, type (all on one line):
$ lynx -dump http://gutenberg.net/etext98/rmnis10.txt | mail -s "Some Reminiscences" [email protected] RET
METHOD #2 Wget DEB: wget RPM: wget WWW: http://www.gnu.org/software/wget/wget.html To send the html source of a Web page, use wget to retrieve the source, using the -q option to suppress messages and sending to the standard output by giving - as an argument to the -O option; pipe this to mail (see Recipe 33.5 [Getting Files from the Web], page 653). Here are two ways to use this. To send a mail to the address [email protected] with the contents of http://gutenberg.net/etext98/, type (all on one line):
$ wget -q -O - http://gutenberg.net/etext98/ | mail [email protected] RET
616
To send a mail to the address [email protected] with the contents of http://gutenberg.net/etext98/ and with a subject of Directory Listing, type (all on one line):
$ wget -q -O - http://gutenberg.net/etext98/ | mail -s "Directory Listing" [email protected] RET
CTRL
Abort the current message and exit mail without sending it. On a blank line, either of these commands will send the message and then exit mail. Erase the current line and move the cursor to the beginning of the line.
RET
or
U
CTRL
CTRL
There are also a few special commands that you may use while composing the body of the message. Theyre known as tilde escapes because you specify them by typing a tilde character (~). The following table lists some of these commands and describes their functions. ~!command ~|lter ~baddress ~d ~e Run command in a shell. Pipe the body of the mail text through lter. Send a blind carbon copy to the usernames or email addresses given, delimited by commas. Copy the le dead.letter from your home directory into the body of the message. Edit the message in the default text editor program. (When you exit the text editor, you are returned to mail.)
617
~fnumber
Insert copies of the specied received messages into the message body. Messages are specied by number or a range (for example, 2-4 inserts messages two through four inclusive); if no number is given, the current received message is inserted. Same as ~f, but reads in the messages with full headers. Insert a copy of the le le into the message. Write a copy of the body text into the le le.
~F ~rle ~wle
These commands should each be typed on a line by itself. To insert a copy of the current received message into the body of the message you are writing, and then open the message in the default text editor, type:
~f RET ~e RET
Usually, the inbox location is in the /var/spool/mail directory, and it has the same name as your usernameso if your username is mrs, your inbox is likely /var/spool/mail/mrs. You shouldnt directly edit this le, because doing so can inadvertently cause you to lose incoming mail. Run mail to read any new mail waiting in your inbox. If your inbox doesnt have any new mail, mail will indicate this and exit; if you do have new mail waiting, mail outputs a list of message headers, one line per message, each containing the status of the message (N for new messages, blank for previously read messages), the message number, the name of the sender, the date and time the message was received, and the number of lines and characters in the message.
618
In this example, the user has three messages waitingone from mrs, one from Ray, and one from [email protected]. The mail prompt is an ampersand character (&); from there, you can read, delete, reply to, and save messages. When you type RET at the & prompt, mail outputs the next unread message to the screen. You can also type a number to output that message. Here are two ways to use this. To read the next unread message in mail, type:
& RET
There are two ways to exit mail: Type q to exit mail and apply the deletion commands you have given, if any, to your inbox; type x to exit mail and revert the state of your inbox to how it was before you ran mail. To exit mail and revert your inbox to its state before you started mail, type:
& x RET
You can always get help by typing ? at the prompt; it gives a list of available mail commands. The following recipes describe some of them. NOTES: By default, only you (and, as always, the superuser) have access to read your inbox. While there are tools available (such as mail, and the other muas) to read this le in special ways, you can also view this le like any other text le (see Chapter 9 [Viewing Text], page 211).
619
You can specify a range of messages or the particular message number to start with; give - or + to display the previous or next 18 messages, respectively. Here are some ways to use this. To list the headers of 18 messages, beginning with the current message, type:
& headers RET
NOTES: This command only works for messages marked for deletion in the current mail session. Once you exit mail, any mail marked for deletion is permanently removed and cannot be undeleted.
620
When you reply to a mail, use the keyboard commands for composing your message as described in Recipe 32.1.5 [Composing Mail], page 616.
621
For sending mail through your isp, you will also need to know the name or ip address of your isps smtp server, which processes and sends all outgoing mail. This too is set up locally, either in your Web browser or via your local mta (Mail Transport Agent), such as Sendmail.
622
623
METHOD #1 You can view your mail folders in less or edit them in a text editor, although the folder will appear as one long scroll containing all of the messages the folder contains. To view the mail folder ~/Mail/rachel in less, type:
$ less ~/Mail/rachel RET
METHOD #2 You can view a mail folder in mail by specifying it as an argument to the -f option; it will appear the way your inbox would appear when running mail with no options. To view the mail folder ~/Mail/rachel in mail, type:
$ mail -f ~/Mail/rachel RET
METHOD #3 Elm RPM: elm WWW: http://www.instinct.org/elm/ You can view a mail folder in elm (see Recipe 32.7 [Using Other Mail User Agents], page 631) by giving its name as an argument to the -f option. As with mail, the folder will appear the usual way your inbox appears in elm. To view the mail folder ~/Mail/rachel in elm, type:
$ elm -f ~/Mail/rachel RET
If you save your mail messages in a lot of separate folders, you can view a sorted list of all messages from all les by using cat in conjunction with elm. Concatenate all the folders into one with cat, and then view that le in elm as you would view any folder. To view the contents of all of the email folders in your ~/Mail directory, type:
$ cat ~/Mail/* > allmessages RET $ elm -f allmessages RET
These commands write a new le, allmessages, in the current directory, containing the contents of all email folders in ~/Mail; then, that le is viewed in elm.
624
NOTES: To view a list showing who all the messages in a folder are from, use frm; see Recipe 32.4.4 [Seeing Who Your Mail Is From], page 626.
Some people put the preceding line in their .bashrc le so that biff is always set on in all of their shells (see Recipe 3.5.6 [Changing the Shell Prompt], page 80). Typing biff alone with no options will tell you whether biff is set to y or n. To see what biff is set to, type:
$ biff RET
A companion tool, xbiff, works only in the X Window System (you can use the regular biff in X, too). When you start xbiff, it draws a window containing a mailbox that looks like Figure 32-1. When mail arrives, xbiff rings the system bell, the window icon reverses color, and the mailbox ag goes up, as in Figure 32-25 NOTES: The original version of biff was named after a dog. In the early 1980s at a uc Berkeley computer lab, a girl would bring her dog, Bi, in with her when she went to use the computers. Bi was known for barking at the mailman whenever he came to deliver the days mail. Bi was also very popular with all of the bsd unix hackers at Berkeley, and when one of them
5
Noah Friedman has an alternate set of Spam images you can use, available from http://www.splode.com/~friedman/software/packages/index.html.
625
wrote a mail notication tool, he thought of Bi and the mailmanhence the name. (Bi, the dog, died in August 1993.)
626
Here are two ways to use this. To see how many email messages you have waiting, type:
$ messages RET
To count the number of email messages in the mail folder ~/email/saved, type:
$ messages ~/email/saved RET
To output a list showing sender names and subjects of the mail in the le ~/email/saved, type:
$ frm ~/email/saved RET
If you have no mail, frm tells you so. METHOD #2 The from tool works in similar fashion to frm, but it does not output subject lines; instead, it outputs the names of senders and the time that messages were received.
627
To output a list of your incoming mail messages, showing sender names and the time and date received, type:
$ from RET
Use the -f option to specify a text le containing email addresses; vrfy attempts to verify all email addresses contained in the le. To verify all of the email addresses contained in the le net-legends-faq, type:
$ vrfy -f net-legends-faq RET
NOTES: vrfy relies on the remote system to get this information; in these days of the heavily corporatized Internet, an increasing number of sites no longer supply this kind of information to the general public. However, its still useful enough to be worth mentioning.
628
To output all lines in ~/Mail/emily containing the text password, regardless of case, type:
$ grep -i password ~/Mail/emily RET
METHOD #2 Use a text viewer or editor to peruse mail archives and search for text, as described in Chapter 9 [Viewing Text], page 211, and Chapter 10 [Editing Text], page 231. A good way to search through mail archives is by subject; the less tool is particularly useful because search terms are highlighted. To highlight all of the subject lines in the current le you are perusing in less, and move the cursor to the next one, type:
/^Subject:.* RET
629
with the le name as an argument. metamail lists each attachment and prompts you to decide whether it should display the attachment, write it to a le, or skip it. To read a mail attachment, type:
$ mail RET Mail version 8.1 6/6/93. Type ? for help. "/var/spool/mail/m": 1 messages 1 new >N 1 Photo Dept. Mon Feb 12 14:37 231/10980 "New Images" & w1 image.mail RET "image.mail" [New file] & x RET $ metamail image.mail RET
In this example, the mail tool was used to open the inbox and write the message to a le called image.mail; then, metamail was run with the le name as an argument. METHOD #2 Nmh DEB: nmh RPM: nmh WWW: http://www.nongnu.org/nmh/ Use mhshow to view the contents of an email message with mime attachments. Give the name of the le containing the message as an argument to the file option. This command shows rst the headers of the mail, and then all remaining parts of the message in turn. For any portion that cannot be displayed on the screen, you will be given an option to write it to a le. To view the contents of the multipart mail message stored in the le ~/Mail/inbox/1, type:
$ mhshow -file ~/Mail/inbox/1 RET
630
To send a le as an email attachment, use metasend. It prompts for the values to use in the To:, Subject:, and CC: header elds, plus the following for each mime attachment: its Content-type:, which describes the kind of data the attachment contains; the le name; and the type of encoding to use, if any (usually one is recommended). To mail the jpeg le dream.jpeg in the current directory to the address [email protected], type:
$ metasend RET To: [email protected] RET Subject: The image you requested RET CC: RET Content-type: image/jpeg RET Name of file containing image/gif data: dream.jpeg RET Do you want to encode this data for sending through the mail? 1 -- No, it is already in 7 bit ASCII 2 -- Yes, encode in base64 (most efficient) 3 -- Yes, encode in quoted-printable (less efficient, more readable) 4 -- Yes, encode it using uuencode (not standard, being phased out) 2 RET Do you want to include another file too (y/n) [n] ? n RET Delivering mail, please wait... Mail delivery apparently succeeded. $
The following table lists values to use in the mime Content-type: eld for various kinds of les. application/gzip application/zip application/postscript image/jpeg image/png audio/basic File compressed with gzip File compressed with zip PostScript le jpeg image le png image le Audio le
631
632
Balsa
Graphical email client that works in X with gnome installed; its interface is inspired somewhat by the proprietary Eudora.
Figure 32-3. Balsa. DEB: balsa RPM: balsa WWW: http://www.balsa.net/ Elm Menu-driven mua that was popular in the early 1990s among experienced usersit has some interesting features, including ways to send mail in batch mode to many addresses at once, and comes with a tool to send memorandums as email messages. Interest in Elm has waned considerably over the years, and most novices are advised to try Mutt instead.
633
Gnus
Emacs newsreader (pre-installed with XEmacs) that can also be used to read and send mail. It has many features and should appeal to Emacs loversbut a warning: Some nd it daunting!
Figure 32-5. Gnus. DEB: gnus RPM: gnus WWW: http://gnus.org/ MEW Emacs mail and news facility developed in Japan, Messaging in the Emacs World has many features for handling mail in complex ways.
634
MH-E
Figure 32-7. mh-e. DEB: emacsen-common RPM: emacs-21 WWW: http://www.emacs.org/ Mozilla Mail Familiar email interface of this popular Web browser. Works in the X Window System and is favored by newbies.
Figure 32-8. Mozilla Mail. DEB: mozilla-browser RPM: mozilla WWW: http://www.mozilla.org/
635
Mutt
mua currently in favor among many Vi users, and is one of the most popular muas for Linux today.
Figure 32-9. Mutt. DEB: mutt RPM: mutt WWW: http://www.mutt.org/ Nmh Rand Mail Handling system, mh; not a single application for mail, but a collection of small tools for manipulating mail folders and messages, installed in /usr/bin/mh. It should appeal to those who excel at building complex commands from combinations of simple tools and operators. nmh is the new Mail Handling system, containing rewrites and improved versions of the mh tools. Most Linux systems will install this over the old mh.
636
VM
Figure 32-11. vm. DEB: vm RPM: vm WWW: http://www.wonderworks.com/vm/ Wanderlust mua for Emacs designed to facilitate reading your mail on multiple computers.
637
Some people pronounce it as earl, while others insist that it can only be yoo-are-ell.
638
Netscapes browsers, from its earliest Navigator release to its later Communicator series, were always referred to internally at the company as Mozilla; this was a slangy pun on the name Mosaic, which had been the rst popular graphical Web browser in the early 1990sNetscapes goal had been to make a Mosaic killer. This term is mine. Mozilla calls it a home page, but this is confusing because that term chiey refers to the main page of a person or organizations published Web site.
639
Here are some ways to use this. To start Mozilla with your default start page, type:
$ mozilla RET
A typical Mozilla window looks like Figure 33-1, in which the home page of the Library of Congress [http://www.loc.gov/] is loaded.
Figure 33-1. Mozilla. The title of the Web page and the name Mozilla is written in the Mozilla windows title bar. The top bar inside the Mozilla window is called the Menu Bar, and contains pull-down menus for accessing all of its major functions. The bar beneath that is called the Navigation Bar, and contains buttons for controlling page navigation. The Location box, in the middle of the Navigation Bar, contains the url of the currently-loaded page. It also has buttons for searching, printing, and the stylized blue M, which takes you to the Mozilla home page [http://www.mozilla.org/]. Beneath that, the largest area of the window is for the Web page itself. At the bottom is the Status Bar, which tells you (among other things), the status of the current Web page or document. In the example, the status is Done, meaning that the entire page has successfully loaded. Like most graphical Web browsers, its use is fairly self-explanatory. Type a url in the Location dialog box to open that url, and left-click on a link to
640
follow it, replacing the main contents of the browser window with the contents of that link. The right mouse button opens a special options menu, whose contents depend on the context of the mouse pointer. If you right-click when the pointer is on a link, you will be presented with several options for handling the link, including opening it in a new window, bookmarking it, and displaying its properties. If you right-click when the pointer is on an image, you will be presented with options for handling the image, including viewing it (the browser display the image as its own page), saving it to a le, and bookmarking it. If you right-click when the pointer is on whitespace, plain text, or somewhere else on the page, you will be presented with options for handling the current page, including bookmarking it, viewing its html source or page information, reloading it, and saving it.
Go back to the last url you visited Go forward to the next url in your history.
CTRL ALT
Open your browser history. Go to your pre-dened Mozilla start (or home) page. L
HOME
SHIFT
CTRL
Open a url. Open your bookmarks le in a new window. Add page with current properties to the bottom of your bookmarks le.
Bookmarks CTRL - B
CTRL
SHIFT
CTRL
Add page to a particular place in your bookmarks le while optionally editing its properties. Open a new Mozilla window (see the following recipe).
641
Close current Mozilla window. Quit and exit Mozilla. Stop loading current page.
Viewing Pages
ESC CTRL CTRL CTRL CTRL CTRL CTRL CTRL
R U I
Reload current page. View html source of current page. View le and server information of current page. Decrease size of text. Increase size of text. Edit current page. Print current page. Select all text on page. Cut text selection. Copy text selection. Paste text selection. Delete text selection.
- -+ E P
X C V
Z Y
Undo last text operation. Redo last text operation. Open a le for viewing. Save current page as a le.
NOTES: These keys may not have the desired eect in some window managers; if they dont work for you, try using the CTRL key instead of the ALT key.
642
One nice feature for Emacs fans is that you can use Emacs-style keystrokes for cursor movement in Mozillas dialog boxes (see Recipe 10.1.3 [Using Basic Emacs Editing Keys], page 237).
643
The following Lynx recipes include tips and hints for using Lynx in various ways.
Like many of my generation, it was through Lynx that I had my rst view of the Web.
644
Navigation Document
within
a Move up (backward) through links in the current document. Move down (forward) through links in the current document.
CTRL CTRL
N P
Move down to the next line in the current document. Move up to the previous line in the current document.
CTRL
PgDn
or or A E
SPACEBAR PgUp
or + -
or or
Scroll down (forward ) to the next screen in the current document. Scroll up (backward ) to the previous screen in the current document. Move to the head (top) of the current document. Move to the bottom (end) of the current document.
CTRL
CTRL CTRL
Navigation Documents g
Between Go to a url; Lynx will prompt you for the url to go to. Type to insert on this line the last url that was visited; once inserted, you can edit it. Go to a url, by editing the current url; Lynx will display the current url and let you edit it.
G or
RET
Follow the hyperlink currently selected by the cursor. Go back to the last document.
DEL
View a history of all documents visited during this session. Stop downloading current page. Display the Lynx help les.
645
Display a complete list of keystroke commands. Display information about the current document to (like all documents displayed in Lynx, type go back to the previous document). Toggle between rendered html and source display of current page. Display history of links visited in current session. Escape temporarily to a shell (
CTRL
\
BKSP
Exiting Lynx ! q Q or
CTRL
returns).
Quit browsing and exit the program; Lynx will ask to verify this action. D
To save the html source of the Web page displayed in Lynx, do the following: 1. Type \ to view the source. 2. Type p to open the print options page. 3. Select Print to local file.
646
Its an old net convention for italicized words to be displayed in an etext inside underscores like _this_; use the -underscore option to output any italicized text in this manner. By default, lynx annotates all the hyperlinks and produces a list of footnoted links at the bottom of the screen.5 If you dont want them, add the -nolist option and just the pure text will be returned. To output the pure text of the previous url, with underscores, and save it to the le winter_dreams, type (all on one line):
$ lynx -dump -nolist -underscore http://sc.edu/fitzgerald/winterd/winter.html > winter_dreams RET
To specify a line width for the dump, in characters, give it with the width= option. The default is 80. You can do other things with the pure text, like pipe it to enscript for setting it in a font for printing.
5
These links are controlled by the -number_links option; you can give this option to turn on annotations and footnotes in normal browsing too.
647
To print the pure text of the previous url in a Times Roman font, with underscores translated into italics and a line width of 40 characters type (all on one line):
$ lynx -dump -width=40 -nolist -underscore http://sc.edu/fitzgerald/winterd/winter.html | enscript -B -Eetext -f "Times-Roman12" RET
NOTES: To peruse the plain text of a url with its html tags removed and no formatting done to the text, see Recipe 33.9.2 [Converting html], page 663. You can also use the -dump option to print a Web page (see Recipe 25.2.4 [Printing a Web Page], page 514), or to pass some le from the Web to another command, such as passing a wav audio le to the sox audio processing tool.
Its common to combine this with the options for saving to a le, so that you can retrieve an annotated text copy of a le from a site that normally requires registration. To save the url http://www.example.com/archive/ as an annotated text le, mynews, type (all on one line):
$ lynx -dump -number_links -auth=guest:guest http://www.example.com/archive/ > mynews RET
NOTES: The username and password argument you give on the command line will be recorded in your shell history log (see Recipe 3.4 [Using Your Command History], page 74), and it will be visible to other users on the system should they look to see what processes youre running (see Recipe 2.7.2 [Listing All of a Users Processes], page 42).
648
If you have friends who send you mail in html format that you cannot conveniently read with your mua, this little-known tip will make you happy. To view a selection of html source code as rendered text, do the following: 1. Select the source code to render by left-clicking and dragging the mouse pointer over it (see Recipe 10.3 [Manipulating Selections of Text], page 253). 2. Start Lynx in a terminal so that it reads from standard input:
$ lynx -stdin RET
3. Paste the text in the terminal that is running Lynx, by clicking the middle mouse button in that terminal. 4. End the input to Lynx by typing
CTRL
in that terminal.
When you do this, Lynx will render and display the html code. NOTES: Lynx will still be running after it displays the code, and you will then have to type Q to quit and exit Lynx. Alternately, include the -dump option to have Lynx display the rendered html to its standard output and then immediately exit. Whenever you have html code coming out of a stream, you can pipe it to lynx -stdin -dump to display the rendered code to the standard output. This technique is also good for testing out arbitrary selections of html code.
649
To browse the les in the /usr/share/doc directory with lynx, using the mouse, type:
$ lynx -use_mouse /usr/share/doc RET
w3 RET
To open a url in a new buer, type CTRL - O and, in the minibuer, give the url to open (leaving this blank opens the w3-mode home page). Middleclick a link to follow it, opening the url in a new buer.
650
Here are two ways to use this. To open the url http://emacs.org/, type:
CTRL - O
http://emacs.org/ RET
The last example opens the w3-mode home page in a buer of its own, as in Figure 33-2. The following table describes some of the special commands for use when in w3-mode.
RET SPACEBAR BKSP ALT
Follow the link at point. Scroll down in the current buer. Scroll up in the current buer.
TAB
Insert the url of the current document into another buer. Save a document to the local disk (you can choose a from HTML Source, Formatted Text, L TEX Source, or Binary).
ALT
CTRL
Open an url. Move backward in the history stack of visited urls. Move forward in the history stack of visited urls. View information about the document in the current buer (the information opens in new buer called Document Information). View information about the link at point in the current buer (the information opens in new buer called Document Information).
B F i
651
Put the url of the document in the current buer in the kill ring, and make it the X selection (useful for copying and pasting the url into another buer or to another application; see Recipe 10.3 [Manipulating Selections of Text], page 253). Put the url of the link at point in the kill ring and make it the X selection (useful for copying and pasting the url into another buer or to another application; see Recipe 10.3 [Manipulating Selections of Text], page 253). Move to the last visited buer. Open a local le. Quit w3-mode, kill the current buer, and go to the last visited buer. Reload the current document. View the html source of the document in the current buer (it opens in a new buer with the url as its name). View the html source of the link at point in the current buer (it opens in a new buer with the url as its name). Show the url of the current document (the url is shown in the minibuer). Show the url of the link at point in the current buer (the url is shown in the minibuer).
l o q r s
v V
652
METHOD #1 Lynx DEB: lynx RPM: lynx WWW: http://lynx.browser.org/ You can view an image on the Web by giving the url of the image as an argument to lynx (see Recipe 33.2 [Using Lynx], page 643). The image will be displayed with whatever helper application is set up to show images via lynx. To view the image at the url ftp://garbo.uwasa.fi/garbogifs/garbo01.gif, type:
$ lynx ftp://garbo.uwasa.fi/garbo-gifs/garbo01.gif RET
NOTES: This method only works in X. You could also give the url for the image as an argument in this way to some other browser, such as Mozilla (see Recipe 33.1 [Using Mozilla], page 638). METHOD #2 ImageMagick DEB: imagemagick RPM: ImageMagick WWW: http://www.imagemagick.org/ Libwww-perl DEB: libwww-perl RPM: perl-libwww WWW: http://ftp.ics.uci.edu/pub/websoft/libwww-perl/ If you just want to view an image le from the Web, you dont have to use a Web browser at allinstead, you can use display, giving the url you want to view as an argument. It uses GET (sometimes get), part of the libwww-perl package, to fetch the url. This method is especially nice for viewing your favorite webcam image, for viewing images on ftp sites, or for putting in scriptsyou dont have to start a browser, log in, or type any other commands at all.
653
The -remote option opens the image in a display window thats already running; you can use this method to view an image that changes oftensuch as a webcam imageand automatically refresh the display with the latest image. To do this, rst run display in the background, and then run watch (see Recipe 28.4 [Watching a Command from Time to Time], page 559). Give the number of seconds between reloads as an argument to the -n option, and give display with the -remote option and the image url as a quoted argument as the command to be watched. To view the image at the url http://waquarium.otted.hawaii.edu/coralcam/ccam.jpg, updating it with the latest image from the webcam every 30 seconds, type:
$ display http://waquarium.otted.hawaii.edu/coralcam/ccam.jpg & RET [3] 29621 $ watch -n 30 'display -remote http://waquarium.otted.hawaii.edu/coralcam/ccam.jpg' RET
In this example, the rst display command was run in the background, as that shells third job, with a process number of 29621. To stop viewing, type CTRL - C in the terminal that contains the watch command, and then kill the rst display job (see Recipe 3.3.5 [Stopping a Job], page 73). NOTES: When viewing the image, you can use all of the image-manipulation commands that display supports, including resizing and changing the magnication of the image. For more information about display, see Recipe 17.1 [Viewing an Image in X], page 407.
654
smaller and faster to use than a browser, and it shows a visual display of the download progress. To retrieve an html le from the Web and save it as rendered text, use Lynx insteadsee Recipe 33.2.4 [Sending Text from the Web to Standard Output], page 646. The following subsections contain recipes for using wget to retrieve information from the Web. For more examples of things you can do with wget, consult its Info documentation (see Recipe 2.8.5 [Reading an Info Manual], page 48).
This command downloads a given url, writing to a le in the current working directory with the same name as the original url, garbo20.gif. If you interrupt a download before its nished, the contents of the le you were retrieving will contain only the portion of the le wget retrieved before it was interrupted. Use wget with the -c option to resume the download from the point it left o. To resume a download of the url from the previous example, type:
$ wget -c ftp://garbo.uwasa.fi/garbo-gifs/garbo20.gif RET
NOTES: In order for the -c option to have the desired eect, you should run wget from the same directory as it was run previously, where that partiallyretrieved le should still exist.
655
of how long it takes. Finally, use the -o option with a le name as an argument to write a progress log to the leexamining it can be useful in the event that something goes wrong during the archiving; once the archival process is complete and youve determined that it was successful, you can delete the log le. To mirror the Web site at http://www.example.org/, giving up to three retries for retrieving les and putting error messages in a log le called mirror.log, type:
$ wget -m -t3 http://www.example.org/ -o mirror.log RET
This command makes an archive of the Web site at http://www.example.org/ in a subdirectory called www.example.org in the current directory. Log messages are written to a le in the current directory called mirror.log. To continue an archive that youve left o, use the -nc (no clobber) option; it doesnt retrieve les that have already been downloaded. For this option to work the way you want it to, be sure that you are in the same directory that you were in when you originally began archiving the site. To continue an interrupted mirror of the Web site at http://www.example.org/ and make sure that existing les are not downloaded, giving up to three retries for retrieval of les, and putting error messages in a log le called mirror.log, type:
$ wget -nc -m -t3 http://www.example.org/ -o mirror.log RET
This command archives all les on the http://example.edu/~jim/ Web site whose directory names begin with /~jim. To only get les in a given directory, use the -r and -l options (the -l option takes as an argument the number of levels to descend from the given level). To only download les in a given directory, combine these options with the --no-parent option, which species not to ascend to the parent directory.
656
Use the -A option to specify the exact le name extensions to accept for example, use -A txt,text,tex to only download les whose names end with .txt, .text, and .tex extensions. The -R option works similarly, but species the le extensions to reject and not download. To download only the les ending in a .gz extension and only in the given directory /~jim/papers/ at example.org, type (all on one line):
$ wget -m -r -l1 --no-parent -A.gz http://www.example.org/~jim/papers/ RET
This command writes the server response headers to standard output and saves the contents of http://google.com/ to a le in the current directory whose name is the same as the original le.
657
You start it in the background, and each time you visit a url in a Web browser (as of this writing, it works with the Netscape, Arena, and Amaya browsers, but not Mozilla), it writes the name and url to its current history log, which you can view at any time. To start browser-history every time you start X, put the following line in your .xsession le:
browser-history &
Past history logs have the year, month, and week appended to their le name, and they are compressed (see Recipe 8.4 [Using File Compression], page 196). If you are viewing them in a browser, you should just be able to give the le name as an argument without uncompressing themmost browsers handle this automagically. NOTES: If you have a start page, youll nd it useful to add a link on it to your current history log le, ~/.browser-history/history-log.html (see Recipe 33.7 [Setting Up a Start Page], on the next page).
This command searches all your logs from the year 2000 for the text Confessions in it, and outputs those lines.
658
NOTES: For more about zgrep, see Recipe 14.7.2 [Matching Lines in Compressed Files], page 349.
4. Left-click the OK button. NOTES: In Mozilla, the start page loads whenever you start it with no arguments, click on the Home button, or type ALT - HOME .
659
METHOD #2 Lynx DEB: lynx RPM: lynx WWW: http://lynx.browser.org/ The Lynx start page is dened as STARTFILE in /etc/lynx.cfg, and it can be any url, including a file:// url pointing to a local le on the system. You need superuser privileges to edit this le. To change the Lynx start page to the url http://localhost/start/, edit /etc/lynx.cfg with a text editor so that it contains the following line:
STARTFILE:http://localhost/start/
NOTES: Linux distributions often predene the Lynx start page to the home page of the distribution. On Debian systems, for example, the start le comes dened as the Debian home page [http://www.debian.org/].
660
METHOD #1 To output a list of urls in text, one per line, use grep with the -o option,6 and give as an argument the regular expression to match urls. To search a text le, give the name of the le as the second argument. Here are some ways to use this. To output a list of all the urls contained in the le /etc/lynx.cfg, type (all on one line):
$ grep -o '\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\|mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\)' /etc/lynx.cfg RET
To output a list of all the urls contained in the text of the url http://news.example.com/, type (all on one line):
$ lynx -dump -nolist http://news.example.com/ | grep -o '\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\|mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\)' RET
To output a list of the urls contained in the html source le of http://news.example.com/, type (all on one line):
$ wget -q -O - http://news.example.com/ | grep -o '\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\|mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\)' RET
METHOD #2 To output a list of urls in text, one per line, use sed with the following command line. To search a text le, give the name of the le as an argument. Here are some ways to use this. To output a list of all the urls contained in the le /etc/lynx.cfg, type (all on one line):
$ sed -n 's/.*\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\| mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\).*/\1/p' /etc/lynx.cfg RET
661
To output a list of all the urls contained in the text of the url http://news.example.com/, type (all on one line):
$ lynx -dump -nolist http://news.example.com/ | sed -n 's/.*\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\| mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\).*/\1/p' RET
To output a list of the urls contained in the html source le of http://news.example.com/, type (all on one line):
$ wget -q -O - http://news.example.com/ | sed -n 's/.*\(\(\(http\(s\)\?\|ftp\|gopher\|telnet\|news\):\/\/\| mailto:\).[^ SPACEBAR ,; CTRL - V TAB <">]*[^ SPACEBAR .,; CTRL - V TAB <">]\).*/\1/p' RET
NOTES: The regexp used in these methods, although complex, is not exhaustiveit wont nd every possible url, but it will do a perfect job in most instances. The perl regexp that can match all possible urls is described in Regex for urls [http://www.foad.org/~abigail/Perl/url2.html], and it can be seen here: http://www.foad.org/~abigail/Perl/url.regexp.
662
To start Mozilla Composer, do the following: 1. Start Mozilla (see Recipe 33.1.1 [Getting Acquainted with Mozilla], page 638):
$ mozilla RET
2. Press
CTRL
. METHOD #2
Bluesh DEB: bluefish RPM: bluefish WWW: http://bluefish.openoffice.nl/ Many people swear by Bluesh, a full-featured, user-friendly html editor for X. It has syntax highlighting and can have over 500 documents open at a time. To start Bluesh, type:
$ bluefish RET
METHOD #3 GNU Emacs DEB: emacsen-common emacs21 RPM: emacs WWW: http://www.emacs.org/ Emacs (see Recipe 10.1 [Using Emacs], page 232) has a major mode to facilitate the editing of html les called html-mode. To start html-mode in a buer, type:
ALT - X
html-mode RET
The features of html-mode include the insertion of skeleton constructs. The Emacs help text for the html-mode function includes a very short html authoring tutorialview the documentation on this function to display the tutorial. To read a short html tutorial in Emacs, type:
CTRL - H
f html-mode RET
NOTES: When youre editing an html le in an Emacs buer, you can open the same le in a Web browser in another windowWeb browsers only read
663
and dont write the html les they open, so you can view the rendered document in the browser as you create it in Emacs. When you make and save a change in the Emacs buer, reload the le in the browser to see your changes take eect immediately.
664
Here are two ways to use this. To peruse the le index.html with its html tags removed, type:
$ unhtml index.html | less RET
To remove the html tags from the le index.html and write the output to a le called index.txt, type:
$ unhtml index.html > index.txt RET
NOTES: When you remove the html tags from a le with unhtml, no further formatting is done to the text. Furthermore, it only works on les, and not on urls themselves. METHOD #2 Lynx DEB: lynx RPM: lynx WWW: http://lynx.browser.org/ Use lynx to save an html le or a url as a formatted text le, so that the resultant text looks like the original html when viewed in lynx. It can also preserve italics and hyperlink information in the original html. See Recipe 33.2.4 [Sending Text from the Web to Standard Output], page 646. One thing you can do with this lynx output is pipe it to tools for spacing text, and then send that to enscript for setting in a font. This is useful for printing a Web page in typescript manuscript form, with images and graphics removed and text set double-spaced in a Courier font. To print a copy of the url http://example.com/essay/ in typescript manuscript form, type (all on one line):
$ lynx -dump -underscore -nolist http://example.com/essay/ | pr -d | enscript -B RET
NOTES: In some cases, you might want to edit the le before you print it, such as when a Web page contains text navigation bars or other text that youd want to remove before you turn it into a manuscript. In such a case, youd pipe the lynx output to a le, edit the le, and then use pr on the le and pipe that output to enscript for printing.
665
METHOD #3 Html2ps DEB: html2ps RPM: html2ps WWW: http://www.tdb.uu.se/~jan/html2ps.html Use html2ps to convert an html le to PostScript; this is useful when you want to print a Web page with all its graphics and images, or when you want to convert all or part of a Web site into pdf. Give the urls or le names of the html les to convert as options. Use the -u option to underline the anchor text of hypertext links; specify a le name to write to as an argument to the -o option. The defaults are to not underline links and to write to the standard output. Here are two ways to use this. To print a PostScript copy of the document at the url http://example.com/essay/ to the default printer, type:
$ html2ps http://example.com/essay/ | lpr RET
To write a copy of the document at the url http://example.com/essay/ to a PostScript le submission.ps with all hypertext links underlined, type:
$ html2ps -u -o submission.ps http://example.com/essay/ RET
666
667
To save an analysis of all the Web log les in the ~/web/logs/2005/ directory to an html le in the current directory named analog.html, type:
$ analog ~/web/logs/2005/* > analog.html RET
METHOD #2 You can also grep your log les. If the log les follow a standard format, you can use cut to cut out elds you are not interested in, thus outputting the desired elds. This is useful in doing things like nding the number of unique domains that have visited a certain directory or page of yours, which you pass to cut via grep. To list the number of unique domains that have visited your reviews page, based on your logs in the ~/private_html/logs/2006 directory, type (all on one line):
$ grep reviews ~/private_html/logs/2006/* | cut -f2 -d':' | cut -f1 -d' ' | sort -u | wc -l RET
NOTES: If any of the log les are compressed, use zgrep or use grep with the -z option.
Amaya
Developed by the World Wide Web Consortium; both a graphical Web browser and a wysiwyg editor for writing html. DEB: amaya RPM: amaya WWW: http://www.w3.org/Amaya/
668
Arena
Developed by the World Wide Web Consortium; a very compact, html 3.0-compliant Web browser for X. RPM: arena WWW: http://www.w3.org/Arena/ Very fast, and small, yet graphical, Web browser. DEB: dillo RPM: dillo WWW: http://www.dillo.org/ Small browser that works in X with gnome installed. WWW: http://tinyurl.com/32p4d gnome browser based on Mozilla. DEB: galeon-common galeon RPM: galeon WWW: http://galeon.sourceforge.net/ Graphical browser for X, currently in an early stage of development. RPM: gzilla WWW: http://www.levien.com/gzilla/ Newer, text-only browser that some prefer over Lynx. DEB: links RPM: links WWW: http://artax.karlin.mff.cuni.cz/~mikulas/links/ Graphical browser based on Mozilla, but with many excess components removed. RPM: skipstone WWW: http://www.muhri.net/skipstone/
Dillo
Express
Galeon
Gzilla
Links
Skipstone
669
W3m
Newer, text-only browser whose features include table support and an interesting freeform cursor control. DEB: w3m RPM: w3m WWW: http://w3m.sourceforge.net/
670
671
login:
In this example, the user connected to the remote system at lab1.example.edu; the login: prompt displayed is from that system. At this point, entering a username and password that is valid for lab1.example.edu will log you in to that system; you will be given a shell prompt and you can run commands on that system through your terminal just as if you were logged in at that systems console.1
1
Its possible (although not often desirable) to nest multiple layers of telnet sessions on top of each other by running telnet from one system to the next, to the next, and so on, without disconnecting from the previous system. To avoid this, make sure you know which host youre leaving when youre about to telnet o to another; the hostname tool is useful for this (see Recipe 2.2.1 [Logging In to the System], page 29).
672
To disconnect from the system, follow the normal procedures for logging out from the system you are connected to (for how to do that on a Linux system, see Recipe 2.2.2 [Logging Out of the System], page 31). To disconnect from a remote Linux system, type:
$ CTRL - D Connection closed. $
In the preceding example, the rst shell prompt was on the remote system, and the second prompt was on the local system; coincidentally, the prompts were the default on both systemsa dollar sign ($). Once you are connected to a remote system with telnet, everything you type in the terminal is sent to the remote system until you are disconnected from that system. It is sometimes useful to temporarily escape back to the local shell on your local system, and you can do that by typing the escape character, which is a key sequence that is interpreted by telnet before it reaches the remote system. The default escape character is the sequence CTRL - [ . When you type that, you are brought to the telnet command prompt, where you can do a number of useful things, including temporarily suspend the connection or terminate the connection entirelyboth of which are described in the following recipes.
telnet
To return to the remote system, bring the telnet job back into the foreground (see Recipe 3.3.3 [Putting a Job in the Foreground], page 73).
673
In the two preceding examples, the shell prompt of the remote system is faraway-system$. (You dont have to type the escape character at a shell prompt, though; you can type it regardless of what program is running on the remote system.)
674
Once connected and logged in, use the cd and ls commands to change directories and to list les on the remote system. It is standard practice for public systems to have a /pub directory on their ftp host that contains all the les and goodies available to the general public. To change to the /pub directory on the remote system and look at the les that are there, type:
ftp> cd /pub RET 250 Directory changed to /pub. ftp> ls RET ftp> ls 200 PORT command successful. 150 Opening ASCII connection for file (918 bytes) total 52048 -rw-rw-r-1 ftpadmin ftpadmin 1095772 Sep 28 06:32 -rw-rw-r-1 ftpadmin ftpadmin 9521446 Sep 28 06:42 drwxr-xr-x 2 ftpadmin ftpadmin 512 Sep 17 18:23 drwxr-xr-x 3 ftpadmin ftpadmin 512 Sep 17 18:23 drwxr-xr-x 5 ftpadmin ftpadmin 512 Sep 17 18:23 226 Transfer completed with 918 Bytes/s. ftp>
675
In this example, the /pub directory contained three subdirectories (rec, sci, and text) and two les (INDEX.gz and ls-lR.gz); many public systems have les similar to these in their /pub directoriesINDEX.gz is a listing of all les on their ftp site, with descriptions, and ls-lR.gz is the output of the command ls -lR run on the directory tree of their ftp server. The following subsections describe how to upload and download les. Use the quit command to exit ftp and close the connection to the remote system.
The current directory of the local system is, by default, the directory where you ran the ftp command. To change directories on your local system, use lcd; it works just like the cd command, but it changes the local directory. To change to the parent directory of the current directory on the local system, type:
ftp> lcd .. RET Local directory now /home/james/demos ftp>
In this example, the local current directory is now /home/james/demos. There are other important commands for downloading lesuse i to specify that les be transferred as binary; normally, the transfer is set up for text les. When you want to transfer programs, archives, compressed les, or any other non-text le, set the transfer type to i rst. In recent years, most public systems have added a security measure forbidding the upload by anonymous users to anywhere but the /incoming or /pub/incoming directories. The mput command works like put, but it allows you to specify wildcards. By default, mput asks you, for each le, whether to upload the le or not; to turn o this le prompting, type prompt before giving the mput command.
676
This command is a toggletype prompt again to turn le prompting back on for your session.
NOTES: The mget command works like get but allows wildcards; as with mput, you will be prompted to verify each le unless you use the prompt command rst to turn this o.
677
placesthe Net is not the safe haven it was a decade ago, and in practice, few sites allow telnet access anymore. The following recipes describe how to use the openssh implementation of the famous ssh (Secure Shell) protocol. openssh includes the contemporary replacements for older rlogin, rsh, and rcp secure-connection tools. NOTES: The rst time you use one of these tools to connect with a remote system, you may get a message telling you that the host key was not found in the list of known hosts, and asking whether or not to continue with the connectionanswer yes.
In this example, the username ernie made a ssh connection to the system arctic.example.org, on which his password is snowshoe. The ~ $ is the shell prompt on that system, where he can run commands until he exits by either running the exit command or by typing CTRL - D at a shell prompt. If your username on the remote system diers from your username on your local system, use the -l option to specify a dierent username.
678
RET
In this example, the user logged into arctic.example.org with a username on that system of scout, whose password was igloo.
For user, give the name of your username on the remote system (if its the same as the local system, omit both it and the trailing at sign (@). For remote, give the hostname of the remote system to connect to, and for lename give the name of the le as it should appear in the home directory of user. To copy the le index.html from your local_html directory to the public_html directory in your account on the system arctic.example.org, type (all on one line):
$ scp local_html/index.html arctic.example.com:public_html/index.html RET [email protected]'s password: snowshoe RET index.html 100% |*****************************| $
2365
00:00
In this example, the user has a username of ernie on both systems; the progress of the copy is displayed on the screen before scp exits. Use the -r option to copy an entire directory tree.
679
Here are some ways to use this. To copy the local_html directory tree, making it the public_html directory in your account on the system arctic.example.org, type:
$ scp -r local_html arctic.example.com:public_html RET [email protected]'s password: snowshoe RET public_html 100% |*****************************| 4096 $
00:00
To copy the le log.txt from the user scouts public_html directory on the system arctic.example.org, placing it in the current directory on your local system, type:
$ scp [email protected]:public_html/log.txt log.txt RET [email protected]'s password: igloo RET access_log 100% |*****************************| 12655 00:00 $
In the last example, the users local username on arctic diered from his username on scout. NOTES: Use the -v option for a verbose display; this will display information about the le transfer process as it happens.
Always be prepared to be amed, or have your question or purposes mocked, by some bellicose individual who wishes to display his vast knowledge. http://groups.google.com/
680
Newsgroups are named and organized by hierarchies, which can have any number of branches. Each branch is delineated by a period character (.); for example, the comp.os.linux newsgroup is part of the comp.os branch of the comp hierarchy. The following table lists the Big Eight Usenet hierarchies and gives examples of some newsgroups in each one. comp Computing news:comp.os.linux.advocacy, news:comp.text.tex Humanities news:humanities.music.composers.wagner Miscellaneous news:misc.consumers.frugal-living Newsgroups relating to Usenet itself news.newusers.questions Recreation news:rec.music.marketplace.vinyl, news:rec.food.cooking Science news:sci.math, news:sci.cognitive Social groups and cultures news:soc.culture.usa, news:soc.college Talk and chit-chat news:talk.environment, news:talk.politics.guns
sci soc
talk
There are many other hierarchies, but these eight are technically the only newsgroups considered to be part of Usenet proper. While netnews is the term for the collection of all newsgroups including those in Usenet, these terms are often used interchangeably. The alternative hierarchy, alt, is perhaps the most popular hierarchy of alljust about every subject you might want to discuss (and a good deal that you probably wouldnt) has an appropriate newsgroup here. It even has a place for non sequiturs.
681
There are also hierarchies for topics concerning certain geographical areas: For example, the cmh. hierarchy is for topics pertaining to the greater Columbus, Ohio metropolitan area; seattle is for the city of Seattle, Washington. So, while cmh.forsale pertains to items posted for sale in the greater Columbus area, seattle.forsale is for items posted for sale in and around Seattle. Hierarchies can exist also for certain organizations; for example, the gnu hierarchy is for newsgroups concerning the gnu Project, and bit is for newsgroup redistributions of the popular Bitnet listserv mailing lists. The following recipes describe tools for reading and posting articles to netnews.
Gnus
Very powerful and feature-full newsreader for use in Emacs; can be used to read mail, too. DEB: gnus RPM: gnus WWW: http://gnus.org/ Graphical newsreader for use in X whose features include the display of article threads in a graphical tree and options for reading news over slow connections. DEB: knews RPM: knews WWW: http://www.matematik.su.se/~kjj/ Newsreader built into the Mozilla browser (historically, commercial Web browsers had mail and newsreaders built into them, and that capability remains in the Mozilla browser.) DEB: mozilla-browser RPM: mozilla WWW: http://mozilla.org/
Knews
Mozilla News
682
NN
Older (and very popular) newsreader that was designed for reading the most news in the minimal amount of time; its motto is No News is good news, but nn is better. DEB: nn RPM: nn WWW: http://www.nndev.org/ gnome newsreader designed for speed and is meant to be easy for beginners. DEB: pan RPM: pan WWW: http://pan.rebelbase.com/ Suite of small tools for use in X that facilitates the reading and composing of news articles when youre oine, by downloading batches of news when your system is online. DEB: peruser WWW: http://ibiblio.org/pub/Linux/system/news/readers/ Optimized for use over slow connections (like home dial-up connections). Based on rn, one of the oldest newsreaders. DEB: slrn RPM: slrn WWW: http://www.slrn.org/
PAN
News Peruser
SLRN
Use the -u option to only search through unsubscribed groups. This is useful if you are subscribed to a number of groups, and you are looking only for groups you arent subscribed to yet.
683
To output a list of all unsubscribed-to newsgroups that match the pattern society, type:
$ nngrep society RET
In the previous example, if you were already subscribed to the group alt.society.neutopia, that group will not be displayed, but other groups matching the pattern society that you are not subscribed to would be listed. NOTES: nngrep uses your ~/.newsrc le to get the list of groups you are subscribed to.
684
In this example, the user joe on the system at home.example.org is not currently logged in, logged in last on January 20, and uses the tsch shell. NOTES: On unix-based systems, you can put information in a hidden le in your home directory called .plan, and that text will be output when someone fingers you. Some people put elaborate information in their .plan les; in the early 1990s, it was very much in vogue to have long, rambling .plans. Sometimes, people put information in their .plan le for special eventsfor example, someone who is having a party next weekend might put directions to his house in his .plan le.
Login Time Sep 27 17:22 Sep 28 08:29 Sep 28 09:35 Sep 28 08:42
685
In this example, the host bfi.org was pinged and a total of three pings were sent and received before the user typed CTRL - C to interrupt it. As long as these ping lines are output, you know that the other machine is connected to the Internet (or at least to the same network that your localhost is connected to). You really dont need to analyze the information on each line of a ping messagethe only useful information is the number at the end of the line, which tells you how many milliseconds it took to go out to the Internet, touch or ping that host, and come back.4 The quicker the betterpings that are four or ve digits long (or greater) mean a slow connection between the two machines. When you interrupt the ping, some statistics are output, including the minimum, average, and maximum number of milliseconds it took to ping
4
I named it after the sound that a sonar makes, inspired by the whole principle of echo-location, said the original author of ping, Mike Muss. He died in an automobile accident in November 2000.
686
the given host. In the previous example, the high was 190 and the low was 159.9 milliseconds, with an average of 170.1 milliseconds to make the trip. NOTES: If your own system is not online, ping will report that either the network is unreachable or that the host isnt found.
NOTES: On some systems, traceroute is kept in /usr/sbin/. When so, its not on the path of regular users, although such users can still run itjust specify the full path name when you run it, such as /usr/sbin/traceroute.
NOTES: Depending on how the remote host is set up, this method may not work.
687
METHOD #3 Use dig, the domain information groper tool, to get the ip address of a host. Give a hostname as an argument to output information about that host, including its ip address, in a section labeled ANSWER SECTION. To nd the ip address of the host linart.net, type:
$ dig linart.net RET ...output messages... ;; ANSWER SECTION: linart.net. 1D IN A ...output messages... $
64.240.156.195
In this example, dig output the ip address of 64.240.156.195 as the ip address for the host linart.net.
NOTES: Depending on how the remote host is set up, this method may not work. METHOD #2 To nd the hostname for a given ip address, use dig with the -x option. Give an ip address as an argument to output information about that address, including its hostname in a section labeled ANSWER SECTION.
688
metalab.unc.edu.
In this example, dig output that the fqdn corresponding to the given ip address was metalab.unc.edu.
To view the domain record for columbia.edu, whois.educause.net Whois Server, type:
$ whois -h whois.educause.net columbia.edu RET
using the
NOTES: This command also outputs the names of the nameservers that handle the given domainthis is useful to get an idea of where a particular Web site is hosted.
689
The other user can reply to you by running write and giving your username as an argument. Traditionally, a user ended a write message with -o, which indicated that what he was saying was over and that it was now the other persons turn to talk. When a user believed that a conversation was completed, he would end a line with oo, meaning that he was over and out. METHOD #2 A similar command, wall, writes a text message to all other users on the local system. It takes a text le as an argument and outputs the contents of that le; with no argument, it outputs what you type until you type CTRL - D on a line by itself. It precedes the message with the text Broadcast message from username (where username is your username) followed by the current system time, and it rings the bell on all terminals it broadcasts to. Here are two ways to use this. To output the contents of /etc/motd to all logged-in terminals, type:
$ wall /etc/motd RET
690
To output the text Who wants to go out for Chinese food? to all logged-in terminals, type:
$ wall RET Who wants to go out for Chinese food? RET CTRL - D
In the preceding example, mesg indicated that messages are currently disallowed to be written to your terminal.
691
is requested. If that person then runs talk, giving your username as an argument, you will both be connected in a talk sessionthe screen will clear, and then what you type will appear on the top of the screen; what the other user types will appear at the bottom of the screen. To request a chat with the user [email protected], type:
$ talk [email protected] RET
This command sends a connection request to the user [email protected]. If the user is not logged on or is refusing messages, talk will output a message indicating such; but if that user is available, talk will send a message to that user asking to complete the connection, and it will tell you that it is ringing your party. If that user isnt logged on, you will be told so and then talk will exit. If the user is logged on and then types talk [email protected] (if, in this example, thats what your email address is), the talk connection will be established between you. At this point, your screen will clear and look like Figure 34-1.
Figure 34-1. Beginning a talk session. You can then type, and what you type will appear on both your screen and that users screen; that user, in turn, can also typeeven while you are typingand what that user types appears on the other half of both screens, as in Figure 34-2.
692
Figure 34-2. A talk session in progress. It is convention to indicate that you are done saying something by typing RET , thus bringing the cursor down past a blank line on your half of the screen. Some users, once they have typed down to the bottom of their part of the screen during the course of the conversation, type RET repeatedly to clear their half of the screen, thus bringing the cursor back to the top of a blank half.
RET
Type
CTRL
When you type, both users see the characters appear in realtime; my rst demonstration of the interactive nature of the Internet, back in 1991, was when I had a live, real-time chat with a user in Australia, on the other side of the globe from methe magic felt that day still remains whenever I run this command! NOTES: A similar command, ytalk, allows simultaneous connection between multiple users, and it contains other features as well; it is generally considered to be the superior successor of talk, but it is not yet available or standard on all unix-based systems.
693
There are several irc networks, each with its own servers and tens of thousands of users; to go on irc, you use an irc client program to connect with an irc server. Like cb radio, irc networks have channels, usually based on a particular topic, which you join to chat with other users in that channel (you can also send private messages to other users). The following table lists some of the irc clients available for Linux.
BitchX
irc client whose features include ansi color escapes, so it can display all of the character escape codes that are popularly used on irc for special eects. Despite what you might gather from its name, it actually doesnt require X in order to run. DEB: bitchx RPM: BitchX WWW: http://www.bitchx.org/ Large, feature-lled irc client. DEB: epic RPM: epic WWW: http://www.epicsol.org/ Modular irc client; note that some versions can only be run in X with gnome. DEB: irssi-common RPM: irssi WWW: http://irssi.org/ Graphical irc chat client for use in X. DEB: xchat RPM: xchat WWW: http://www.xchat.org/ Minimalist and no-frills (yet fully extensible) irc mode for Emacs. DEB: zenirc WWW: http://www.zenirc.org/
EPIC
Irssi
Xchat
ZenIRC
694
other users in realtime. Since then, many free software chat tools have been written that use the icq protocol. One nice feature of icq is that you can maintain a buddy list of email addresses, and when you have an icq client running, it will tell you whether or not any of your buddies are online. But unlike talk, you cant watch the other user type in realtimemessages are displayed in the other users icq client only when you send them. The following table lists some of the free software icq clients currently available.
LICQ
icq client for use in X. DEB: licq RPM: licq WWW: http://www.licq.org/ Matts icq clone, an easy-to-use icq client that can be used in a shell. DEB: micq RPM: micq WWW: http://www.micq.org/ micq with a modied user interface. RPM: zicq
MICQ
ZICQ
695
Everybuddy
im client (now called Ayttm) that recognizes the protocols used with aim, icq, Yahoo, and msn. DEB: everybuddy RPM: everybuddy WWW: http://ayttm.sourceforge.net/ Popular message client that recognizes the protocols used with many im networks, including aim, icq, Yahoo, msn, irc, and Jabber. DEB: gaim RPM: gaim WWW: http://gaim.sourceforge.net/ Free im system using an xml-based protocol, popular in the Linux world. DEB: jabber RPM: jabber WWW: http://www.jabber.org/ tcl/tk client for aim. DEB: tik RPM: tik WWW: http://tik.sourceforge.net/
Gaim
Jabber
Tik
696
APPENDICES
697
APPENDICES
698
699
700
has a proprietary interface that only works with a certain non-free operating system. To nd out whether your hardware will work under Linux, try the following: 1. Read the Linux Hardware Compatibility HOWTO (see Recipe 2.8.6 [Reading System Documentation and Help Files], page 50), an up-to-date list of hardware that is compatible with Linux. 2. Search for it on the two sites that provide reviews and information about hardware that works with Linux, http://www.linuxhardware.net/ and http://www.linuxhardware.org/. 3. Search the Internetparticularly Usenet news and the linux.com site for information on the hardware you intend to buy. Read any trouble reports people may have written about getting it to work with Linux, so that you wont be writing the next one about it.
In the second example above, the day, month, and year are not set, and remain at the value they had before this command was run. METHOD #2 Use one of the following tools to set the system date and time to that given by remote hosts on the Internet. This is good for keeping your time adjusted with various public time servers, such as the ones run by the United States Navy.
701
Chrony
Sets the date according to time servers available on the Internet, and adjusts for drift by periodically readjusting the system time from these servers. DEB: chrony RPM: chrony WWW: http://chrony.sunsite.dk/index.php Sets the system date to the time and date given by a remote host. DEB: rdate RPM: rdate
Rdate
Figure A-1. User-mountable devices in /etc/inittab. This would mean that whenever any user (since both of these mount points have user access) typed mount /floppy, the disk corresponding to the /dev/fd0 device (the rst oppy drive) would be mounted on /floppy, and its lesystem type would be detected automatically. If a user were to type mount /cdrom, the data cd in the drive corresponding to the /dev/cdrom device would be mounted on /cdrom as an iso 9660 lesystem. NOTES: If you do specify a particular mount point for a device already in your /etc/fstab, that device will be mounted at the point you specifythis method doesnt limit your mount point to only the device specied in the le.
702
For Red Hat systems, x86 boot images are available via ftp (see Recipe 34.2 [Transferring Files to and from a Remote Host], page 673), from the host ftp.redhat.com. Its kept in a directory named /pub/redhat/linux/version/en/os/i386/images, where version is your Red Hat version number, and the le is called either boot.img (on older versions) or bootdisk.img. To make a boot oppy from a Linux kernel image, use dd, giving the name of the kernel image as the input le and the name of the oppy device as the output le. To make the oppy in the rst oppy drive a boot disk, containing the boot image le bootdisk.img, type:
# dd if=bootdisk.img of=/dev/fd0 RET
NOTES: Use caution with this command. If you erase the mbr on a disk that you rely on for booting, you wont be able to boot with it until you write a new, bootable image on that mbr.
703
704
Here are two ways to use this. To immediately shut down and halt the system, type:
# shutdown -h now RET
You can follow the now argument with a quoted message that will be displayed on all terminals of all users currently logged in. To immediately shut down and halt the system, and send a warning message to all users, type:
# shutdown -h now "The system is being shut down now!" RET
To shut down the system in a certain number of minutes, give that number of minutes prefaced by a plus sign (+). To shut down and halt the system in ve minutes, type:
# shutdown -h +5 RET
Follow the time with a quoted message to be displayed on the terminals of all logged-in users. To shut down and halt the system at midnight, and give a warning message to all logged-in users, type (all on one line):
# shutdown -h 00:00 "The system is going down for maintenance at midnight" RET
705
As with a normal system shutdown, you can send out an explanatory message with the cancel to be shown to all users. To cancel any pending shutdown and send an explanatory message to all logged-in users, type:
# shutdown -c "Sorry, I hit the wrong key!" RET
This command cancels any pending system shutdown and displays the message, Sorry, I hit the wrong key! on all the terminals of anyone logged in. NOTES: If the shutdown process has advanced to the point where all terminals are stopped, you wont be able to run this command.
This command will put you in a root shell on the console, where you can run e2fsck or do whatever it is you intended to do. In the example, the root user has the simple password of abracadabra. To exit the shell, type wish to reboot again with
CTRL CTRL
706
People are constantly contributing to the free software movement, publishing their work online. This means that new software programs are constantly being added to Linux distributions, and current software programs are continually being improvednew features to match new hardware, faster program execution, security updates, and so forth. A Linux system, therefore, needs to be kept up to date in order to reap the benets of the latest free software. And sooner or later, you will want to install more programs, or you will want to upgrade your existing software when newer versions are available with some feature you desire. The following recipes are for installing software on your system.
707
This is, like any le name, just convention. Nothing but convention (and common sense) is to stop you from giving a compressed tar le an .EXE extension, or a Debian deb format le an .rpm, or from omitting le extensions altogether.
708
your system, and then make is run with either install or all as an argument, depending on what the packages particular documentation instructs. To compile and install a software package from its source directory, you generally type:
# ./configure RET ... conguration messages ... # make install RET ... compilation messages ... ... installation messages ... #
When you install source packages on your system, you are said to be installing local softwarethe les are kept in the /usr/local directory tree. Binaries are placed in /usr/local/bin, libraries in /usr/local/lib, man pages in /usr/local/man, and documentation in either /usr/local/doc or /usr/local/share/doc.
This line means that the script is written in the perl language; the text after the #! is the full path name of the perl program, which in this case is /usr/local/bin/perl. If the location for a tool here in the rst line of the script is dierent from the location on your system, it will not work (see
709
Recipe 7.5 [Finding Where a Program Is Located], page 185). For example, if perl is located on your system at /usr/bin/perl, you will have to edit the rst line in this script so that it matches that actual location. If you try to execute this script, and the system reports an error nding the le, youll have to change that rst line to correspond to the location of the perl binary on your system. The which tool will output this location. To nd out where perl is installed on your system, type:
# which perl RET
If this command returns /usr/bin/perl or some path name other than /usr/local/bin/perl, youll have to change the location in the rst line of the script to the path name given:
#!/usr/bin/perl
NOTES: If the output of the which command returns nothing, that means that the perl program is not installed on your system at all; in that case, you should install the perl software in order to run the script.
Even its man page makes note of this: The dselect package selection interface is confusing or even alarming to the new user.
710
its own at the command line. This is what will be described in the following recipes. Methods using the newer apt-get tool, part of Debians Advanced Package Tool system, will also be described; apt-get is preferred by most experienced users. NOTES: All of the following actions can also be done with the dselect application, but that method will not be described.
To list all known deb packages whose name begins with gimp, type:
# dpkg -l gimp* RET
To list all deb packages on the system whose name has gimp anywhere in it, type:
# dpkg -l '*gimp*' RET
To list a particular package, give its name. To search for a pattern among installed packages, pipe the output of dpkg -l to grep. Here are two ways to use this. To determine whether or not the gimp package is installed, type:
# dpkg -l gimp RET
To list all installed deb packages with gimp in their names, type:
# dpkg -l | grep gimp RET
You can also get a summary of a particular deb package by giving it as an argument to apt-cache with the show option. To get a summary of the gimp package, type:
# apt-cache show gimp RET
711
NOTES: Any conicts or dependencies will have to be resolved by you before the package is installed. If a problem is detected, dpkg will report it and exit without installing the package. You can also combine -i with the --no-act ag, to test the installation. This will go through all the motions of installation, but will not actually install any les. METHOD #2 To obtain and install a package with apt-get, use the install option and give the base name of the package as an argument. Make sure your Debian distribution is ready when you run this command. If you are installing from cd-rom, put the rst Debian cd-rom disc in your cd drive; if installing via Internet, make sure that your system is online. To obtain and install the proper le for the hello deb package, type:
# apt-get install hello RET
NOTES: Should there be any dependences, or should the package conict with others already installed, an action will be presented to x this, and you will be prompted to conrm or abort the operation.
712
To upgrade the gimp1.2 package with the deb le gimp1.2_1.2.4_ i386.deb, type:
# dpkg -i gimp1.2_1.2.4_i386.deb RET
METHOD #2 Use apt-get to upgrade either single packages or the entire system. To upgrade a single package with apt-get, just install it again with the install option, and follow that with the name of the package to upgrade. To upgrade the hello package, type:
# apt-get install hello RET
This command will upgrade the hello package to the most current version available on your Debian distribution source, if there is one greater than the version already installed on your system. If additional packages must be upgraded rst, in order for this new package upgrade to function properly, this command will fetch and upgrade those packages, too. Before downloading any packages, apt-get will show the list of packages that will be installed, replaced, or otherwise changed, and it will wait for conrmation rst. To bring your entire Debian system up to date, use the apt-get tool with the following command arguments. First, use the update argument to update your systems list of available software packages. Then run apt-get again, using either the upgrade argument to upgrade all of the installed packages to their most recently available versions, or use the dist-upgrade argument when a new version of the Debian system is announced, to upgrade to that new version. Here are two ways to use this. To upgrade all of the software on your system to their most recent versions, type:
# apt-get update RET ...processing messages... # apt-get upgrade RET ...processing messages... #
713
This removes the package but keeps any conguration les. Use the --purge option to completely eliminate everything related to a package, including all conguration and setup les. To purge the gimp1.2 package, type:
# dpkg --purge gimp1.2 RET
NOTES: If purging a package will break dependencies, dpkg will not let you do it. You can force it, though; to get a list of force options, run dpkg with the --force-help option.
714
To peruse all of the les that are part of the gimp1.2 package, type:
# dpkg -L gimp1.2 RET
715
To list all rpm packages with the string gimp in their names, regardless of case, type:
# rpm -qa | grep -i gimp RET
To list a particular package, use rpm with the -q option, and give the package name. To see if the gimp package is installed, type:
# rpm -q gimp RET
If a package has unmet dependencies, rpm will not install it; it also wont install a package if a current or newer version is installed. Use -i in conjunction with the --nodeps ag to install a package even if it has unmet dependencies. To install the gimp-1.2.3-9.i386.rpm package, regardless of unmet dependencies, type:
# rpm -i --nodeps gimp-1.2.3-9.i386.rpm RET
716
If other packages depend on the package, rpm wont erase it; use --nodeps to override this behavior. To remove the gimp package, regardless of any dependencies, type:
# rpm -e --nodeps gimp RET
To get some basic information about a package, including a brief description, use rpm with the -qi option, and give as an argument the package name. To display some information about the gimp package, type:
# rpm -qi gimp RET
717
NOTES: By default, the name of the users home directory will be the same as the username. So, for example, the user mary will have a home directory of /home/mary.
718
Here are some ways to use this. To get a list of all usernames on the system, type:
# cut -d: -f1 /etc/passwd RET
719
To get a list of the times and dates when the system was recently rebooted, give reboot as an argument to last (see Recipe 2.6.4 [Listing the Last Time a User Logged In], page 41). To output a list of times when the system was rebooted, type:
# last reboot RET
NOTES: An operating system capable of running constantly for a long time without crashes or freeze-ups is a good one, so having a high uptime value is a matter of pride for many Linux users. It is not uncommon to hear of systems that have been running for months and sometimes even years non-stopone Linux administrator reported on the Internet about one of his work systems, which had been running continuously without reboot for three years!
NOTES: This requires that the special /proc lesystem is installed, but this has been a Linux standard for some time.
720
METHOD #2 You can also use gnu uname to output the cpu processor type of the system (such as i686, powerpc, etc.); specify this with the -m option. To output the cpu processor type of the system, type:
# uname -m RET
Use the -r option to output the operating system release number. To output the release number of the operating system, type:
# uname -r RET
The -a option is useful; it outputs all information about the system that it can, including os name and release number, cpu type, plus the version date and number of the operating system and the machines hostname. To output all of the uname information for the system you are on, type:
# uname -a RET
721
722
723
image image
.gpg .gray
data image
724
.gsm
audio
Global System for Mobile Communications (gsm) speech le format, used in some voice-mail applications. A le compressed with gzip compression. html (HyperText Markup Language) format. Impulse Tracker mod le. Joint Photographic Experts Group (jpeg) File Interchange Format (jfif) format (usually pronounced jay-peg). a L TEX document. Tro input le. Standard extensions for midi les. ImageMagick miff (Magick Image Format File) format. mod (tracker module) le. mpeg-1 or -2, layer 3 le. Tro input le. mod le. Ogg Vorbis le. Black and white portable bitmap format. Kodak PhotoCD format, 512x768 pixels maximum resolution. Page Control Language format. ZSoft ibm pc Paintbrush format. Adobe Portable Document Format.
.gz .htm .html .it .jpeg .jpg .latex .ltx .me .mid .midi .miff .mod .mp3 .ms .mtm .ogg .pbm .pcd .pcl .pcx .pdf
binary text
audio image
text
text audio
image
725
.pict .png .pnm .ppm .ps .ra .raw .rgb .s3m .sf
image image
Apple Macintosh QuickDraw format. Portable Network Graphics pronounced ping). Portable anymap format. Color portable pixmap format. Adobe PostScript format. RealAudio le. Raw audio data. Raw red, green, and blue bytes. mod le. ircam SoundFile format, used by some music composition software, such as CSound and MiXViews. sgml (Standardized General Markup Language) format. mod le. a TEX or L TEX document. Plain, unformatted text. TrueVision Targa image format. Tagged Image File Format. Plain, unformatted text. mod le. mod le. SoundBlaster voc le. Microsoft riff format (aka wav). X Window System bitmap format. format (usually
.sgml .stm .tex .text .tga .tif .tiff .txt .ult .uni .voc .wav .xbm
text
726
mod le. xml (Extended Markup Language) format. Color X Window System pixmap format. Color X Window System window dump le format.
727
2. Use a text editor to edit your .bashrc, and change the path to include ~/bin (see Recipe 3.5.7 [Adding to Your Path], page 81). It is a quoted, comma-delimited list. For example:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:~/bin:."
In your own bin, you can put scripts and tools of your own devising. They will be executable by you, but by no other users on the system. To make a le executable by all users, the superuser will have to put the le in /usr/local/bin, the system-wide local directory for binaries. NOTES: The current shell wont recognize any changes you make in your .bashrc; youll have to run it by hand the rst time, or just exit and start a new shell.
728
729
730
731
Red Hat Enterprise Linux is Red Hat, Inc.s successor to its popular and well-established distribution. [http://redhat.com/] Run Up to date Linux Everywhere (rule) is designed for users who need modern Linux, but cannot aord a modern computer. It is based on the very latest Fedora Core, but it can run on systems with low memory and small cpus. [http://www.rule-project.org/] Slackware Linux is the [http://slackware.com/] oldest Linux distribution still publishing.
732
SuSE Linux is German-designed, is now owned by Novell, and is popular in Europe. [http://suse.com/] Turbolinux, a variation on the UnitedLinux distribution, is the most popular distribution in China. [http://www.turbolinux.com/] Yellow Dog Linux is made specially for powerpc computers, such as some Apple Macintoshes (Debian and other distributions have such versions too). [http://www.yellowdoglinux.com/]
733
LinuxHardware.net is a user-contributed database of hardware that works with Linux. [http://www.linuxhardware.net/] LinuxHardware.org has hardware news and reviews components that work with Linux. [http://linuxhardware.org/] Linux on Laptops has an up-to-date database of laptop and notebook computer models and the extent of their support for Linux. [http://www.linuxlaptop.net/] ResellerRatings is a consumer database of hardware resellers, with ratings and comments. [http://resellerratings.com/] Price Watch is an up-to-the-minute database of reseller stock and their prices. Search by component or brand to get current listings for sale. [http://pricewatch.com/]
734
book, it is typeset with TEX on a Linux system (cd-rom included). [http://rute.sourceforge.net/] Wirzenius, Lars, et al., Linux System Administrators Guide, Linux Documentation Project, 1993. A classic text on administrating a Linux system. [http://tldp.org/LDP/sag/]
735
IRC Caraballo, David, and Joseph Lo, The IRC Prelude, Web site, 2000. Excellent introduction to irc for rst-timers. [http://irchelp.org/irchelp/new2irc.html] PERL Kuhn, Bradley M., Picking Up Perl, Web site, 2002. A good but unnished perl tutorial. [http://www.ebb.org/PickingUpPerl/] PostScript Capella Archive Publications, Capella Archive, Web site, 2001. Handson tutorials and reference library for programming in PostScript. [http://www.cappella.demon.co.uk/] SED Bonzini, Paolo, The seders Grab-Bag, Web site, 2002. A useful collection of sed information including a faq and many example scripts. [http://sed.sourceforge.net/grabbag/] Pement, Eric, Handy One-Liners for sed, Web site, 2003. A single page listing many useful commands for editing and processing text. [http://www.student.northpark.edu/pemente/sed/ sed1line.txt] Pizzini, Ken, sed, a Stream Editor, Free Software Foundation, 1998. [http://www.gnu.org/software/sed/manual/sed.html] TEX and Friends Doob, Michael, A Gentle Introduction to TEX, Web page, 1993. A recommended introduction to using plain TEX. [ftp://ctan.tug.org/tex-archive/documentation/gentle/] a Grandsire, Christophe, The Metafont and TEX/L TEX Resource Page, Web site, 2003. Gives an introductory tutorial to using metafont. [http://metafont.latex.free.fr/]
736
a Hahn, Jane, L TEX for Everyone, PTR Prentice-Hall Inc., 1993. A wonderful book for those who want to use the power of TEX for typesetting correspondence, papers, articles, and reports. Knuth, Donald E., The TEXbook, Addison-Wesley, 1984. The original TEX book, written by the author of TEX. a Oetiker, Tobias, et al., The Not So Short Introduction to L TEX, Web a site, 1999. A recommended introduction to using L TEX. [ftp://ctan.tug.org/tex-archive/documentation/lshort/] Robbins, Arnold, Whats GNU: Texinfo, Linux Journal, issue 6, October 1994. An introductory tutorial. [http://www.linuxjournal.com/article.php?sid=2840] a Underwood, Rebecca, et al., L TEX and BibTEX Tutorials and Assigna ment, Web site, 1996. A good L TEX tutorial that shows how to typeset an article. Available online in dvi format. [http://www.soe.ucsc.edu/~karplus/80k/latex-tutorialnew.dvi]
737
738
Program Index
739
Program Index
atrm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . audacity . . . . . . . . . . . . . . . . . . . . . . . . . . . aumix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . aview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 496 474 418
! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 & . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72, 118 && . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 &> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69, 98 ; . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63, 144 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 || . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 > . . . . . . . . . . . . . . . . . . . . . . . . . . 68, 258, 276 >> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68, 258 < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67, 449 2> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 9wm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
B
backgammon . . . . . . . . . . . . . . . . . . . . . . . . . 583 balsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 banner . . . . . . . . . . . . . . . . . . . . . . . . . 402, 583 basename . . . . . . . . . . . . . . . . . . . . . . . 143, 148 bash . . . . 42, 53, 54, 62, 74, 77, 85, 90, 148, 343 battlestar . . . . . . . . . . . . . . . . . . . . . . . . . 584 bbdb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 bc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114, 562 bcd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 bg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 biff . . . . . . . . . . . . . . . . . . . . . . . . . . . 624, 690 bitchx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 bitmap . . . . . . . . . . . . . . . . . . . . . . . . . 118, 436 blackbox . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 blender . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 bluefish . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 boggle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 browser-history . . . . . . . . . . . . . . . . . . . . 656 bunzip2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 bye . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 bzip2 . . . . . . . . . . . . . . . . . 196, 197, 198, 407
A
abbrev-mode . . . . . . . . . . . . . . . . . . . . . . . . 242 abiword . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 addgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 adduser . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 adventure . . . . . . . . . . . . . . . . . . . . . . . . . . 583 aee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 afterstep . . . . . . . . . . . . . . . . . . . . . . 117, 120 alias . . . . . . . . . . . . . . . . . . . . . . . . . 83, 84, 87 amaya . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667 amixer . . . . . . . . . . . . . . . . . . . . . . . . . 463, 474 an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 analog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 animate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 antiword . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 aplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 apropos . . . . . . . . . . . . . . . . 44, 67, 68, 69, 72 apt-get. . . . . . . . . . . . . . . . . . . . 709, 711, 712 arena . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667 arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . 583 ascii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 asclock . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 ash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 aspell . . . . . . . . . . . . . . . . . . . . . . . . . 278, 280 at . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 atc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 aterm . . . . . . . . . . . . . . . . . . . . . . . . . . 114, 117 atq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
C
caesar . . . . . . . . . . . . . . . . . . . . . . . . . 569, 584 cal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256, 539 calc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 calendar. . . . . . . . . . 541, 542, 543, 544, 545 can . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 canfield . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 cat . . . . . 153, 163, 190, 216, 217, 226, 256, 260, 294, 305, 327, 343, 401, 442, 566, 586, 587, 719, 720 catdoc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 ccal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132, 133
740
cdcd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 cdda2wav . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 cdeject . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 cdinfo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 cdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 cdparanoia . . . . . . . . . . . . . . . . . . . . . . . . . 480 cdpause . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 cdplay . . . . . . . . . . . . . . . . . . . . . . . . . 477, 479 cdrecord . . . . . . . . . . . . . . . . . . . . . . . 482, 485 cdstop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 cdtool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 ce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 cfscores . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 chbg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 chcase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 chgrp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 chilight . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 chmod . . . . . . . . . . . . . . . . . . 85, 168, 169, 170 chrony . . . . . . . . . . . . . . . . . . . . . . . . . 538, 701 chsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 chvt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 ci . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63, 88 cmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191, 192 co . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 col . . . . . . . . . . . . . . . . . . . 310, 311, 329, 531 colcrt . . . . . . . . . . . . . . . . . . . . . . . . . 227, 329 colrm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 column. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 comm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 command mode . . . . . . . . . . 245, 248, 251, 346 compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 composite . . . . . . . . . . . . . . . . . . . . . . . . . . 430 consolechars . . . . . . . . . . . . . . . . . . . . . . . 400 convert . . . . . . . . . . . . . . . 431, 432, 446, 447 cooledit . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 count-lines-page . . . . . . . . . . . . . . . . . . . 294 countmail . . . . . . . . . . . . . . . . . . . . . . . . . . 584 cp . . . . . . . . . . . . . . . . . . . . . . . . . 141, 143, 153 cribbage . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 cron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 crontab. . . . . . . . . . . . . . . . . . . . 545, 558, 559 cse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 csh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90, 92
D
dadadodo . . . . . . . . . . . . . . . . . . . . . . . . . . . date . . . . . . . . . 137, 188, 251, 537, 587, dc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367, dd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . def . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . del . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . df . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diction . . . . . . . . . . . . . . . . . . . . . . . . 286, diff . . . . . . . . . . . . . . . . . . . . . . . 192, 301, diff3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dillo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . display . . 407, 412, 416, 427, 603, 604, dissociated-press . . . . . . . . . . . . . . . . . . doctor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dpkg . . . . . . . . . . . . . . . . . . . 44, 709, 711, du . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183, dvi2fax . . . . . . . . . . . . . . . . . . . . . . . . . . . . dvips . . . . . . . . . . . . . 374, 390, 452, 512, 592 700 580 702 264 284 150 501 436 288 366 193 687 668 651 593 594 580 713 502 606 515
E
e2fsck. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . e3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . echo . . . . . . . . . 56, 79, 82, 91, 146, 447, ed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259, ee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . efax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . efix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . egrep . . . . . . . . . . . . . . . . . . . . . . . . . . 338, elm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622, elvis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . emacs . . . . . . . . . . . . . 232, 233, 266, 280, enlightenment . . . . . . . . . . . . . . . . . . . . . . 705 264 617 338 265 601 605 342 632 265 542 120
Program Index
741
enscript . . . . 225, 297, 359, 361, 363, 368, 369, 370, 371, 447, 512, 523, 646, 663 esh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 eshell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 eterm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 everybuddy . . . . . . . . . . . . . . . . . . . . . . . . . 694 evolution . . . . . . . . . . . . . . . . . . . . . . . . . . 553 exec . . . . . . . . . . . . . . . . . . . . . . . . 90, 118, 121 exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83, 91 expand. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
G
gaim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 gcal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 ghostview . . . . . . . . . . . . . . . . . 359, 414, 451 gimp . . . . . . . . . . . . . . . . . . . . . . . . . . . 434, 446 glame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 glimmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 gnumeric . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 gnuplot . . . . . . . . . . . . . . . . . . . . . . . . 437, 575 gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . 632, 681 gomoku. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 gpg . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572, 574 gpm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 gramofile . . . . . . . . . . . . . . . . . . . . . . . . . . 474 graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 grep . . . . 43, 44, 45, 75, 150, 171, 178, 283, 288, 295, 300, 306, 307, 333, 335, 343, 344, 347, 348, 350, 373, 533, 546, 591, 627, 659, 667 groff . . . . . . . . . . . . . . . . . . . . . . . . . . 383, 385 grog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 grunch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 gs . . . 391, 451, 457, 460, 518, 521, 522, 605 gunzip. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 gv . . . . . . . . . . . . . . . . 226, 359, 383, 414, 415 gzip . . . . . 179, 196, 197, 198, 349, 407, 614
F
factor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 faxon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 fdformat . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 feh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 festival . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 fetchmail . . . . . . . . . . . . . . . . . . . . . . . . . . 622 fg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 fgconsole . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 fgrep . . . . . . . . . . . . . . . . . . . . . . . . . . 335, 336 figlet . . . . . . . . . . . . . . . . . 86, 369, 401, 402 file . . . . . . . . . . . . . . . . . . . . . . . 187, 211, 471 filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 find . . . . . . . . . . . . . . 172, 179, 182, 184, 552 find-file . . . . . . . . . . . . . . . . . . . . . . . . . . 235 finger . . . . . . . . . . . . . . . . . . . . . . . . . 683, 684 fish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 fluxbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 flyspell-mode . . . . . . . . . . . . . . . . . . . . . . 281 fmt . . . . . . . . . . . . . . . . . . . 228, 305, 308, 343 fold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 fonter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 for . . . . . . 143, 146, 148, 192, 193, 207, 428 fortune . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 freax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 free . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43, 720 freebirth . . . . . . . . . . . . . . . . . . . . . . . . . . 496 frm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 from . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62, 626 fromdos . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 ftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
H
hangman . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 hcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 hdel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 head . . . . . . . . . . . . . . . . . . . 65, 218, 219, 592 hello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 hexdump . . . . . . . . . . . . . . . . . . . . . . . . 221, 222 hexl-mode . . . . . . . . . . . . . . . . . . . . . . . . . . 223 hformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 hfsutils . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
742
hls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . hmount . . . . . . . . . . . . . . . . . . . . . . . . . 527, host . . . . . . . . . . . . . . . . . . . . . . . . . . . 686, hostname . . . . . . . . . . 36, 37, 38, 54, 63, hpcdtoppm . . . . . . . . . . . . . . . . . . . . . . . . . . html-mode . . . . . . . . . . . . . . . . . . . . . . . . . . html2ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . hunt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
L
last . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41, 719 latex . . . . . . . . . . . . . . . . . . . . . . 374, 377, 390 le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 leave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 less . . . . . 44, 45, 50, 69, 75, 183, 193, 211, 218, 222, 223, 227, 228, 287, 297, 306, 327, 346, 354, 399, 464, 546, 548, 590, 622, 628, 646, 663 licq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 linuxdoc . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 ln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 locate . . . . . . . . . . . . . . . . . . . . . . 10, 171, 399 logout . . . . . . . . . . . . . . . . . . . . . . . . . . . 31, 63 look . . . . . . . . . . . . . . . . . . 226, 283, 286, 590 lpq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 lpr . . . . . 195, 309, 370, 374, 510, 512, 513, 514, 515, 517, 521, 522 lpr-buffer . . . . . . . . . . . . . . . . . . . . . . . . . 517 lpr-region . . . . . . . . . . . . . . . . . . . . . . . . . 517 lprm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 lptest. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 ls . . . . . 36, 83, 84, 133, 136, 140, 153, 166, 168, 182, 184, 504 lsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 lynx . . . . . 37, 114, 158, 287, 350, 412, 514, 515, 615, 643, 659, 663, 666 lyx . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378, 379 LyX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
I
idraw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . imgsizer . . . . . . . . . . . . . . . . . . . . . . . . . . . import . . . . . . . . . . . . . . . . . . . . . 441, 447, info . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48, input mode . . . . . . . . . . . . . . . . . . . . . 246, ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . insert mode . . . . . . . . . . . . . . . . . . . . 246, insert-mode . . . . . . . . . . . . . . . . . . . . . . . . ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . isearch-backward . . . . . . . . . . . . . . . . . . . iso-accents-mode . . . . . . . . . . . . . . . . . . . ispell . . . . . . . . . . . . . . . . . . . . . 277, 278, 437 663 448 517 328 259 248 234 121 352 240 280
J
jabber. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 jed . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232, 267 jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 joe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
M
m4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 magicfilter . . . . . . . . . . . . . . . . . . . . 518, 703 mail . . . . 545, 550, 611, 612, 613, 614, 616, 617, 619, 622 Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 mailx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 man . . . . . . . . . . . . . . 44, 46, 62, 228, 358, 522 mc . . . . . . . . . . . . . . . . . . . . . . . . . 157, 191, 223 mcedit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
K
kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 konsole . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 korganizer . . . . . . . . . . . . . . . . . . . . . . . . . 553 kraut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 ksh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Program Index
743
mcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mdel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . members . . . . . . . . . . . . . . . . . . . . . . . . . . . . menu-bar-mode . . . . . . . . . . . . . . . . . . . . . . mesg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . messages . . . . . . . . . . . . . . . . . . . . . . . . . . . metamail . . . . . . . . . . . . . . . . . . . . . . . . . . . metasend . . . . . . . . . . . . . . . . . . . . . . . . . . . mf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . mhshow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . micq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mikmod. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mille . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . minicom . . . . . . . . . . . . . . . . . . . . . . . . . . . . miscfiles . . . . . . . . . . . . . . . . . . . . . . . . . . mkdir . . . . . . . . . . . . . . . . . . . . . . 130, 131, mkisofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . mlterm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mogrify . . . . . . . . . . . 421, 422, 425, 427, monop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . montage . . . . . . . . . . . . . . . . . . . . . . . . . . . . more . . . . . . . . . . . . . . . . . . . . . . . . . . . 211, morse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mount . . . . . . . . . . . . . . . . . . . . . . 504, 506, mozilla . . . . . . . . . . . 160, 224, 412, 638, mp3info . . . . . . . . . . . . . . . . . . . . . . . . . . . . mpg321 . . . . . . . . . . . . . . . . . . . . . 469, 470, mtools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . multi-gnome-terminal . . . . . . . . . . . . . . mutt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . mv . . . . . . . . . . . . . . . . . 65, 144, 146, 148,
526 526 525 165 235 690 625 628 629 404 526 629 694 469 584 606 290 727 504 115 429 584 430 346 584 529 661 472 494 525 115 634 153
O
oclock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221, 222 ogg123 . . . . . . . . . . . . . . . . . . . . . 466, 467, 495 oggenc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 ogginfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 oleo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 overwrite-mode . . . . . . . . . . . . . . . . 234, 238
P
pan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 passwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 paste . . . . . . . . . . . . . . . . . . . . . . . . . . 322, 592 patch . . . . . . . . . . . . . . . . . . . . . . . . . . 192, 196 pbmtext . . . . . . . . . . . . . . . . . . . . . . . . 447, 448 pcdtoppm . . . . . . . . . . . . . . . . . . . . . . . 416, 445 pd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 pdf2ps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 pdksh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 pdmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . 91, 93 perl . . . . . . . . . . . . . . . . . . . . . . . . . . . 351, 589 phantasia . . . . . . . . . . . . . . . . . . . . . . . . . . 585 pig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 ping . . . . . . . . . . . . . . . . . . . . . . . . . . . 685, 686 plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 player. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 playmidi . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 plog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 poff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 pom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 pon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 powershell . . . . . . . . . . . . . . . . . . . . . . . . . 115 ppmquant . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 ppt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 pr . . . . . . . . . . . . . . . . 297, 307, 308, 312, 663 primes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 print-node . . . . . . . . . . . . . . . . . . . . . . . . . 517 ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41, 42, 73 ps-print-buffer . . . . . . . . . . . . . . . . . . . . 517 ps-print-region . . . . . . . . . . . . . . . . . . . . 517 ps2book . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
N
nano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . netpbm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . newspeak . . . . . . . . . . . . . . . . . . . . . . . 371, nl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . nngrep. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . number . . . . . . . . . . . . . . . . . . . . . . . . . 568, nyc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 421 586 326 681 682 584 586
744
ps2pdf . . . . . . . . . . . . . . . . . . . . . . . . . 391, 460 psbook. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 pscat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 psh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 psmerge . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 psnup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 psresize . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 psselect . . . . . . . . . . . . . . . . . . . . . . . 452, 513 pstoascii . . . . . . . . . . . . . . . . . . . . . . . . . . 460 pwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132, 133
rzsz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
S
sail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 saytime . . . . . . . . . . . . . . . . . . . . . . . . 539, 555 sc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 scanimage . . . . . . . . . . . . . . . . . . . . . . 443, 444 scp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 sdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 search-backward-regexp . . . . . . . . . . . . 353 search-forward-regexp . . . . . . . . . . . . . 353 sed . . . . . 219, 220, 255, 307, 311, 316, 346, 347, 351, 660 see . . . . . . . . . . . . . . . . . . . . . . . . 198, 199, 413 seq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 set . . . . . . . . . . . . . . . . . . . . . . . . . . 80, 87, 252 seyon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 sh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 shar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 showcfont . . . . . . . . . . . . . . . . . . . . . . . . . . 400 showimg . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 showpicture . . . . . . . . . . . . . . . . . . . . . . . . 419 shutdown . . . . . . . . . . . . . . . . . . . 28, 703, 704 sigrot. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 sleep . . . . . . . . . . . . . . . . . . . . . . . . . . 442, 555 slrn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 snake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 snd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 snscore . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 sort . . 24, 183, 277, 297, 298, 299, 319, 320 sox . . . . . . . . . . . . . . . 466, 481, 488, 493, 494 spell . . . . . . . . . . . . . . . . . . . . . . 275, 281, 286 splay . . . . . . . . . . . . . . . . . . . . . . . . . . 470, 474 spline. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 ssh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 startx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 states. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 strfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 strings. . . . . . . . . . . . . . . . . . . . 228, 350, 533 style . . . . . . . . . . . . . . . . . 286, 288, 289, 293 suggest . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Q
quiz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 quoted-insert . . . . . . . . . . . . . . . . . . . . . . 354
R
rain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 random. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 rclock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 rcp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 rcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 rdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 rdjpgcom . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 rec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 remembrance-agent . . . . . . . . . . . . . . . . . . 302 rename . . . . . . . . . . . . . . . . . . . . . . . . . 145, 147 replace-regexp . . . . . . . . . . . . . . . . . . . . . 353 replace-regular-expression . . . . . . . . 328 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 rev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 rlog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 rlogin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 rm . . . . . . . . . . . . . . . . . . . . 149, 153, 178, 190 rmdir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 rn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 robots. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 rosegarden . . . . . . . . . . . . . . . . . . . . . . . . . 497 rot13 . . . . . . . . . . . . . . . . . . . . . . . . . . 569, 585 rpm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45, 714 rsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 rxvt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Program Index
745
superformat . . . . . . . . . . . . . . . . . . . . . . . . 504
T
tac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 tail . . . . . . . . . . . . . . . . . . 218, 219, 298, 592 talk . . . . . . . . . . . . . . . . . . . . . . . . . . . 690, 694 tapiir. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 tar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199, 614 tbl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 tclsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 tcsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 teachgammon . . . . . . . . . . . . . . . . . . . . . . . . 585 Ted . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 tee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69, 471 telnet . . . . . . . . . . . . . . . . . . . . . . . . . 671, 672 tetris-bsd . . . . . . . . . . . . . . . . . . . . . . . . . 585 tex . . . . . . . . . . . . . . . 372, 374, 375, 377, 399 text-mode . . . . . . . . . . . . . . . . . . . . . . . . . . 234 the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 tik . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 587 timidity . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 todos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 touch . . . . . . . . . . . . . . . . . . . . . . 130, 176, 189 tr . . . 24, 146, 222, 297, 310, 312, 316, 343, 531, 569 traceroute . . . . . . . . . . . . . . . . . . . . . . . . . 686 tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 trek . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 trivia games . . . . . . . . . . . . . . . . . . . . . . . 585 twm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 txt2html . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 txt2tex . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
unhtml. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663 uniq . . . . . . . . . . . . . . 277, 297, 298, 299, 319 units . . . . . . . . . . . . . . . . . . . . . . . . . . . 82, 567 universal-argument . . . . . . . . . . . . 243, 541 unset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 unzip . . . . . . . . . . . . . . . . . . . . . . . . . . 533, 535 uptime . . . . . . . . . . . . . . . . . . . . . . . . . . 43, 719 uuencode . . . . . . . . . . . . . . . . . . . . . . . . . . . 614 uxterm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
V
vacation . . . . . . . . . . . . . . . . . . . . . . . . . . . vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245, Vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248, vimtutor . . . . . . . . . . . . . . . . . . . . . . . . . . . vrfy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 247 270 211 346 248 627
W
w . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40, 64 w3-mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649 w3m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 wall . . . . . . . . . . . . . . . . . . . . . . . . . . . 689, 690 wargames . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 watch . . . . . . . . . . . . . . . . . . . . . . . . . . 559, 653 wc . . . . 24, 184, 275, 293, 294, 295, 300, 587 wdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 weblint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665 wenglish . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 wget . . . . 350, 470, 615, 653, 654, 655, 656, 659 whatis . . . . . . . . . . . . . . . . . . . . . . . . . . 46, 586 which . . . . . . . . . . . . . . . . . . . . . . . . . . 185, 708 while . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 who . . . . . . . . . . . . . . . . . . . . . . . . 24, 36, 39, 64 whoami . . . . . . . . . . . . . . . . . 39, 46, 65, 78, 79 whois . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688 wily . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 wish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 wm2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 wmaker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
U
ul . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 umount . . . . . . . . . . . . . . . . . . . . . . . . . 505, 507 unalias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 uname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 unexpand . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
746
wmdate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282, wnb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wnintro . . . . . . . . . . . . . . . . . . . . . . . . . . . . word-search-backward . . . . . . . . . . . . . . word-search-forward . . . . . . . . . . . . . . . word2x . . . . . . . . . . . . . . . . . . . . . 531, 532, wordstar-mode . . . . . . . . . . . . . . . . . . . . . . workbone . . . . . . . . . . . . . . . . . . . . . . . . . . . workman . . . . . . . . . . . . . . . . . . . . . . . . . . . . worm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . worms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wp2x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . write . . . . . . . . . . . . . . . . . . . . . . 689, 690, WRITER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wrjpgcom . . . . . . . . . . . . . . . . . . . . . . . . . . . wterm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wtf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . wv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
554 284 282 283 353 353 533 231 485 485 586 586 536 694 392 427 115 586 586 536
Xfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xfontsel . . . . . . . . . . . . . . . . . . . . . . . 104, xli . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xloadimage . . . . . . . . . . . . . . . . . . . . . 419, xls2csv . . . . . . . . . . . . . . . . . . . . . . . . . . . . xlsfonts . . . . . . . . . . . . . . . . . . . . . . . . . . . xmag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xmms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xpaint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xpaste. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xpcd . . . . . . . . . . . . . . . . . . . . . . . . . . . 415, xpdf . . . . . . . . . . . . . . . . . . . . . . . . . . . 415, xset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xsetroot . . . . . . . . . . . . . . . . . . . . . . . . . . . xspread . . . . . . . . . . . . . . . . . . . . . . . . . . . . xterm . . . . 101, 109, 295, 398, 518, 555, xwave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xwud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
458 397 419 420 536 397 116 475 439 254 445 521 119 118 581 559 497 420 420
X
X11R6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 xae . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 xbiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 xcal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 xcalc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 xcdroast . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 xclock . . . . . . . . . . . . . . . . . . . . . 101, 102, 105 xcolors . . . . . . . . . . . . . . . . . . . . . . . . 103, 118 xcoral. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 xdm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27, 98 xdvi . . . . . . . . . . . . . . . . . . . . . . . 374, 399, 413 xedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 xemacs . . . . . . . . . . . . . . . . . . . . . . . . . 233, 273 xfd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Y
yes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65, 151 yow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 ytalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
Z
zcat . . . . . . . . . . . . . . . . . . . . . . . 257, 385, 449 zgrep . . . . . . . . . . . . . . . . . . . . . . 349, 656, 657 zgv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 zicq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 zinf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 zip . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533, 534 zless . . . . . . . . . . . . . . . . . . . . . . . 50, 198, 211 zsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Concept Index
747
Concept Index
adding echo to a sound le . . . . . . . . . . . 491 adding ange to a sound le . . . . . . . . . . 491 adding line breaks to text . . . . . . . . . . . . 308 adding margins to text . . . . . . . . . . . . . . . 308 adding members to a group . . . . . . . . . . 718 adding parameters to image tags . . . . . . 663 adding phase to a sound le . . . . . . . . . . 492 adding reverb to a sound le . . . . . . . . . 490 adding to your path . . . . . . . . . . . . . . . . . . 81 adding Vibro-Champ eects to a sound le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 Address Book, Mozilla . . . . . . . . . . . . . . . 638 adjusting the audio controls . . . . . . . . . . 463 adjusting the colors of an image . . . . . . 425 administrating a network . . . . . . . . . . . . . . 11 administrating users . . . . . . . . . . . . . . . . . 717 administrative issues . . . . . . . . . . . . . . . . . 699 Adobe Systems . . . . . . . . . . . . . . . . . . . . . . 451 Adobe Type 1 fonts . . . . . . . . . . . . . 362, 403 Advanced Easy Editor (aee) . . . . . . . . . 263 Advanced Linux Sound Architecture (alsa) . . . . . . . . . . . . . . . . . . . . . 463, 467 Advanced Package Tool (apt) . . . . . . . . 709 aee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 AfterStep . . . . . . . . . . 96, 100, 108, 117, 120 AfterStep xvt . . . . . . . . . . . . . . . . . . . . . . . 114 aim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 aip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 Air Trac Controller simulation . . . . . . 583 airport city codes . . . . . . . . . . . . . . . . . . . . 290 aix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 alias words, using . . . . . . . . . . . . . . . . . . . . . 82 alias, removing an . . . . . . . . . . . . . . . . . . . . 84 aliases, listing . . . . . . . . . . . . . . . . . . . . . . . . 84 Almquist shell (Ash) . . . . . . . . . . . . . . . . . . 92 alsa . . . . . . . . . . . . . . . . . . . . . . . . . . . 463, 467 alternation operator . . . . . . . . . . . . . . . . . 337 alternative . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Amaya . . . . . . . . . . . . . . . . . . . . . . . . . 656, 667 America On-Line Instant Messenger (aim) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 American Institute of Physics (aip) . . . 380 American Mathematical Society (ams) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 #! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 ### . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 $ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 $0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 $1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 $Id$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 *** . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 *scratch* . . . . . . . . . . . . . . . . . . . . . . . . . . 236 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126, 138 .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126, 138 .bash_history . . . . . . . . . . . . . . . . . . . . . . 74 .bash_logout . . . . . . . . . . . . . . . . . . . . . . . 88 .bash_profile . . . . . . . . . . . . . . 84, 86, 112 .bashrc. . . . . . . . . . . . . . . . . . 81, 84, 86, 550 .forward . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 .newsrc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683 .xsession . . . . . . . . . . . . . . . . . . . . . 117, 656 [:space:] . . . . . . . . . . . . . . . . . . . . . . . . . . 307 1984 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 39 Steps, The . . . . . . . . . . . . . . . . . . . . . . . . 29 9wm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
A
Aa3d . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 Aatv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 abbreviations, a list of common . . . . . . . 290 abbreviations, making in Emacs . . . . . . 242 AbiWord . . . . . . . . . . . . . . . . . . . . . . . 391, 535 absolute le name . . . . . . . . . . . . . . . . . . . 126 accent characters, inserting in Emacs . . 239 access mode . . . . . . . . . . . . . . . . . . . . . . . . . 167 accessing the Web in Emacs . . . . . . . . . . 649 account . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Acme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 acronyms, translating common. . . . . . . . 292 active client . . . . . . . . . . . . . . . . . . . . . . . . . 105 active job . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 Ada95 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 adding a cron job . . . . . . . . . . . . . . . . . . . 558 adding borders to an image. . . . . . . . . . . 429 adding chorus to a sound le . . . . . . . . . 492
748
American Physical Society (aps) . . . . . . 380 American Standard Code for Information Interchange (ascii) . . . . . . . . . . . . . . 228 amounts, converting . . . . . . . . . . . . . . . . . 567 amplitude of a sound le, changing . . . . 489 ams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 amusements . . . . . . . . . . . . . . . . . . . . . . . . . 583 anagrams, nding in text . . . . . . . . . . . . . 588 Analog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 analyzing text . . . . . . . . . . . . . . . . . . . . . . . 293 analyzing your Web trac . . . . . . . . . . . 666 animation, viewing . . . . . . . . . . . . . . . . . . 417 annotating an image . . . . . . . . . . . . . . . . . 427 anonymous ftp . . . . . . . . . . . . . . . . . . . . . . 673 ansi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 ansi control sequences . . . . . . . . . . . . . . . 111 ansi-c quoting . . . . . . . . . . . . . . . . . . . . . . . 60 Antiword . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 antonyms, of words . . . . . . . . . . . . . . . . . . 285 Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 appendices . . . . . . . . . . . . . . . . . . . . . . . . . . 697 appending text to a le . . . . . . . . . . . . . . 258 Apple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Apple LaserWriter . . . . . . . . . . . . . . . . . . . 451 Apple Macintosh . . . . . . . . . . . . . . . . 357, 732 application . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 application, nding the location of a . . 185 applications . . . . . . . . . . . . . . . . . . . . . . . . . . 22 applications, guides for . . . . . . . . . . . . . . . 734 applying sound eects. . . . . . . . . . . . . . . . 488 appointment le, making . . . . . . . . . . . . . 543 appointments, automatic delivery of . . . 545 appointments, managing . . . . . . . . . . . . . 542 aps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 archive, listing the contents of an . . . . . 201 archive, making a le . . . . . . . . . . . . . . . . 200 archive, managing le . . . . . . . . . . . . . . . . 199 archives of Linux and related software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 archives, extracting les from . . . . . . . . . 201 archiving an entire Web site . . . . . . . . . . 654 archiving part of a Web site . . . . . . . . . . 655 Arena . . . . . . . . . . . . . . . . . . . . . . . . . . 656, 667 arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
ari . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 arithmetic calculation, making a quick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 arithmetic, calculating . . . . . . . . . . . . . . . 561 armored le . . . . . . . . . . . . . . . . . . . . . . . . . 574 arranging PostScript pages in signatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 articles, Usenet . . . . . . . . . . . . . . . . . . . . . . 679 ascii art . . . . . . . . . . . . . . . . . . . 400, 435, 436 ascii art, viewing . . . . . . . . . . . . . . . . . . . . 418 ascii character set . . . . . . . . . . . . . . . . . . . 290 ascii character set, viewing . . . . . . . . . . 228 Ash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 aspect ratio . . . . . . . . . . . . . . . . . . . . . . . . . 423 assembler listings . . . . . . . . . . . . . . . . . . . . 365 assigning a variable . . . . . . . . . . . . . . . . . . . 78 Astronomy and Astrophysics . . . . . . . . . 380 at&t. . . . . . . . . . . 16, 93, 120, 271, 286, 542 atlases, online . . . . . . . . . . . . . . . . . . . . . . . 290 attributes, listing le . . . . . . . . . . . . . . . . . 136 attributes, specifying in an X window . . 105 Audacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 audio cd tracks, shuing. . . . . . . . . . . . . 479 audio cd, displaying information about an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 audio cd, ejecting an . . . . . . . . . . . . . . . . 480 audio cd, pausing an . . . . . . . . . . . . . . . . 478 audio cd, playing an . . . . . . . . . . . . . . . . . 477 audio cd, sampling from an . . . . . . . . . . 480 audio cd, stopping an . . . . . . . . . . . . . . . . 479 audio cd-r, writing an . . . . . . . . . . . . . . . 482 audio cds, using . . . . . . . . . . . . . . . . . . . . . 477 audio compact discs . . . . . . . . . . . . . . . . . 477 audio compact discs, using other tools for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 audio controls, adjusting the. . . . . . . . . . 463 audio devices, muting . . . . . . . . . . . . . . . . 465 audio recording source, selecting an . . . 465 audio settings, listing the current . . . . . 464 aumix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 Aumix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 authorization, viewing a site that requires . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Concept Index
749
Automated Readability Index (ari) . . . 289 automatic appointment delivery . . . . . . 545 automatically answering a command prompt . . . . . . . . . . . . . . . . . . . . . . . . . . 65 AutoTrace . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Aview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 awk . . . . . . . . . . . . . . . . . . . . . . . . 85, 365, 734 Ayttm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
B
backgammon . . . . . . . . . . . . . . . . . . . . . . . . 583 background and history of linux . . . . . . . 15 background jobs . . . . . . . . . . . . . . . . . . . . . . 70 background, putting a job in the . . . . . . . 72 backspace underlines . . . . . . . . . . . . . . . . . 329 backspace underlining . . . . . . . . . . . 226, 327 backups, making. . . . . . . . . . . . . . . . . . . . . 200 Balsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 bang . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Banner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 banners, outputting text . . . . . . . . . . . . . 402 Barcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 base le name . . . . . . . . . . . . . . . . . . . . . . . 129 Bash . . . . 10, 30, 36, 53, 112, 143, 146, 148, 188, 192, 207, 231, 254, 365, 428, 478, 561, 565, 603 basic commands and concepts . . . . . . . . . 27 bass, adjusting . . . . . . . . . . . . . . . . . . . . . . 463 Battlestar . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 bbs, connecting to a . . . . . . . . . . . . . . . . . 606 bell character . . . . . . . . . . . . . . . . . . . . . . . . 80 Bell Labs . . . . . . . . . . . . . . . . . . . . . . . . . 15, 16 bell, margin . . . . . . . . . . . . . . . . . . . . . . . . . 112 bell, visual . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Berkeley Systems Distribution . . . . . . . . . 16 Bi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 Big Eight hierarchies . . . . . . . . . . . . . . . . . 680 Bill of Rights . . . . . . . . . . . . . . . . . . . . . . . . 291 binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 binaries, using a directory for personal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 binary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 binary les, listing text in . . . . . . . . . . . . 228
binary les, matching lines in . . . . . . . . . 350 bindings, key . . . . . . . . . . . . . . . . . . . . . . . . 237 bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 bit bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 BitchX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 Bitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 bitmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Bitnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 black and white, transforming color images to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 BlackBox . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Blender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 blog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 Bluesh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 662 body size . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 Boggle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 Bonzini, Paolo. . . . . . . . . . . . . . . . . . . . . . . 735 booklet, arranging a PostScript document in a . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 booklets, printing . . . . . . . . . . . . . . . . . . . . 371 books and guides, Linux . . . . . . . . . . . . . 733 books, unix and Linux history . . . . . . . . 736 boot disk . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 boot oppy, making a . . . . . . . . . . . . . . . . 702 booting up . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 borders, adding to images . . . . . . . . . . . . 429 Bortzmeyer, Stphane . . . . . . . . . . . . . . . . 734 e Bourne shell . . . . . . . . . . . . . . . . . . . 53, 85, 92 Bourne, Steve . . . . . . . . . . . . . . . . . . . . . . . . 53 Brahms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 Browne, Christopher B. . . . . . . . . . . . . . . 358 browser history, keeping a . . . . . . . . . . . . 656 browser history, searching through your . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657 browser history, viewing your . . . . . . . . . 657 browsing les . . . . . . . . . . . . . . . . . . . . . . . . 157 browsing image collections in X . . . . . . . 409 browsing images in a console . . . . . . . . . 410 browsing PhotoCD archives . . . . . . . . . . 415 browsing the Web . . . . . . . . . . . . . . . . . . . 637 bsd . . . . . . . . . . . . . . . . . . . . . 16, 92, 245, 542 Buckyballs . . . . . . . . . . . . . . . . . . . . . . . . . . 580 buddy list . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 buer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
750
buer, killing a . . . . . . . . . . . . . . . . . . . . . . buer, visiting a . . . . . . . . . . . . . . . . . . . . . buers, viewing multiple at once . . . . . . Bulletin Board System (bbs) . . . . . . . . . burning audio to cd-r . . . . . . . . . . . . . . . Burroughs, William S. . . . . . . . . . . . . . . .
C
C . . . . . . . . . . . . . . . . . . . . . . . 92, 94, 291, 365 C program source code, viewing . . . . . . 224 C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 Cable Modem Providers HOWTO . . . . 597 cable modem, using a . . . . . . . . . . . . . . . . 597 CADUBI . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Caesar, Julius . . . . . . . . . . . . . . . . . . . . . . . 569 Calc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579 calculating arithmetic . . . . . . . . . . . . . . . . 561 calculator, using a . . . . . . . . . . . . . . . . . . . 562 calendar clock . . . . . . . . . . . . . . . . . . . . . . . 117 calendar le . . . . . . . . . . . . . . . . . . . . . . . . . 542 calendar le, making . . . . . . . . . . . . . . . . . 543 calendar les, including . . . . . . . . . . . . . . 544 calendar, displaying a . . . . . . . . . . . . . . . . 539 calendar, displaying in Emacs . . . . . . . . 541 calendars, using . . . . . . . . . . . . . . . . . . . . . 539 calling a command by some other name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 calling out on a modem . . . . . . . . . . . . . . 606 Camediaplay . . . . . . . . . . . . . . . . . . . . . . . . 449 cameras, downloading images from . . . . 449 cancel command . . . . . . . . . . . . . . . . . . . . . . . 7 canceling a print job . . . . . . . . . . . . . . . . . 511 canceling a shutdown . . . . . . . . . . . . . . . . 704 caneld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 Capella Archive . . . . . . . . . . . . . . . . . . . . . 735 capture logs . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Caraballo, David . . . . . . . . . . . . . . . . . . . . 735 carbon copies, sending . . . . . . . . . . . . . . . 612 caret, in regexps . . . . . . . . . . . . . . . . . . . . . 343 carriage return characters, removing . . 310 carriage returns, replacing with linefeeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 Case Western Reserve University . . . . . 232
case, sorting text regardless of . . . . . . . . 321 Casear, Julias . . . . . . . . . . . . . . . . . . . . . . . 584 Ccal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 cd drives, letting users mount . . . . . . . . 718 cd, mounting a . . . . . . . . . . . . . . . . . . . . . . 506 cd-rom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 cd-rom drive . . . . . . . . . . . . . . . . . . . . . . . 477 Cdcd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 Cdinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 CDlabelgen . . . . . . . . . . . . . . . . . . . . . . . . . 484 Cdp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 cdr drive . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 cdrw drive . . . . . . . . . . . . . . . . . . . . . . . . . 477 cds, using data . . . . . . . . . . . . . . . . . . . . . . 506 cdtool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 center-justifying text . . . . . . . . . . . . . . . . . 312 ChangeLog les . . . . . . . . . . . . . . . . . . . . . 365 changing a les modication time . . . . 189 changing characters in text . . . . . . . . . . . 317 changing directories . . . . . . . . . . . . . . . . . . 132 changing le names to lowercase . . . . . . 145 changing the amplitude of a sound le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 changing the default X terminal behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 changing the ownership of a le . . . . . . . 166 changing the permissions of a le . . . . . 168 changing the root window parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 changing the sampling rate of a sound le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 changing the shell prompt . . . . . . . . . . . . . 80 changing the size of an image . . . . . . . . . 422 changing the volume level . . . . . . . . . . . . 465 changing to the last directory you visited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 changing to your home directory . . . . . . 132 changing your default shell . . . . . . . . . . . . 91 changing your password . . . . . . . . . . . . . . . 38 channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692 character cell font . . . . . . . . . . . . . . . . . . . 396 character class. . . . . . . . . . . . . . . . . . . . . . . 316 character set, viewing a . . . . . . . . . . . . . . 228 characters, changing in text . . . . . . . . . . 317
Concept Index
751
characters, counting in a text . . . . . . . . . 294 characters, deleting in text . . . . . . . . . . . 318 characters, extended . . . . . . . . . . . . . . . . . 228 characters, quoting reserved . . . . . . . . . . . 56 characters, reversing on lines . . . . . . . . . 331 characters, squeezing duplicates in text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 characters, transposing . . . . . . . . . . . . . . . . 62 characters, transposing in text . . . . . . . . 316 chart, making a . . . . . . . . . . . . . . . . . . . . . 385 chatting directly with a user . . . . . . . . . . 690 chatting on icq . . . . . . . . . . . . . . . . . . . . . . 693 chatting with other users . . . . . . . . . . . . . 688 chatting with users on irc . . . . . . . . . . . . 692 ChBg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Cheap*Bytes . . . . . . . . . . . . . . . . . . . . . . . . 706 check in. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 check out . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 checking grammar . . . . . . . . . . . . . . . . . . . 286 checking in a le revision . . . . . . . . . . . . . 203 checking in many les . . . . . . . . . . . . . . . . 206 checking online dictionaries . . . . . . . . . . . 285 checking out a le revision . . . . . . . . . . . 204 checking sgml document syntax . . . . . . 390 checking text for dicult sentences. . . . 289 checking text for doubled words . . . . . . 288 checking text for long sentences . . . . . . . 289 checking text for misused phrases . . . . . 286 checking text for readability . . . . . . . . . . 288 checking whether a user is online . . . . . 683 Chets Emacs . . . . . . . . . . . . . . . . . . . . . . . 232 child directory . . . . . . . . . . . . . . . . . . . . . . . 125 choosing a newsreader . . . . . . . . . . . . . . . 681 chords, mouse . . . . . . . . . . . . . . . . . . . . . . . 271 chorus, adding to a sound le. . . . . . . . . 492 Chrony . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 classes, document . . . . . . . . . . . . . . . . . . . . 378 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 clearing the screen . . . . . . . . . . . . . . . . 54, 86 clearing the terminal screen . . . . . . . . . . . 35 clients, X . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Clinton, William Jeerson . . . . . . . . . . . . . 22 clock, calendar . . . . . . . . . . . . . . . . . . . . . . 117 Coleman-Liau formula . . . . . . . . . . . . . . . 289
Collver, Ben. . . . . . . . . . . . . . . . . . . . . . . . . 734 color depth . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 color directory listing . . . . . . . . . . . . . . . . 134 color map . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 Color QuickCams, capturing images from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 color reduction . . . . . . . . . . . . . . . . . . . . . . 426 colors, window . . . . . . . . . . . . . . . . . . . . . . 103 Colossal Cave . . . . . . . . . . . . . . . . . . . . . . . 583 columnating a list . . . . . . . . . . . . . . . . . . . 323 columnating text . . . . . . . . . . . . . . . . . . . . 322 columnating text from separate les . . . 323 columns of text, pasting from separate les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 columns, listing directories in . . . . . . . . . 138 columns, outputting text in . . . . . . . . . . 370 columns, placing text in . . . . . . . . . . . . . . 314 columns, removing from text . . . . . . . . . 324 combining images . . . . . . . . . . . . . . . . . . . . 430 combining PostScript documents . . . . . . 457 combining PostScript pages . . . . . . . . . . 454 command line . . . . . . . . . . . . . . . . . . . . . . . . 54 command line editing, keys for . . . . . . . . . 54 command line mode . . . . . . . . . . . . . . . . . 246 command line, in Vi . . . . . . . . . . . . . . . . . 245 command line, typing at the . . . . . . . . . . . 54 command line, undoing a mistake at the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 command line, using basic editing keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 command output, inserting in Vi . . . . . 251 command prompt, automatically answering a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Command Run On (cron) . . . . . . . . . . . 557 command shell . . . . . . . . . . . . . . . . . . . . . . . 53 command substitution . . . . . . . . . . . . . . . . 65 command, calling by some other name . . 83 command, mailing the output of a . . . . 613 command, repeating the last. . . . . . . . . . . 62 command, running a . . . . . . . . . . . . . . . . . . 36 command, running in an X window . . . 113 command, running in Vi . . . . . . . . . . . . . 251 command, running on a delay . . . . . . . . 555 command, running on a timer . . . . . . . . 556
752
command, watching one from time to time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 commands, listing usage . . . . . . . . . . . . . . . 46 commands, piping . . . . . . . . . . . . . . . . . . . . 69 commands, running a list of . . . . . . . . . . . 63 commands, running on the les you nd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 commands, running one and then another . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 commands, running one or another . . . . . 64 commands, scheduling . . . . . . . . . . . . . . . 557 commands, specifying from your history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 communications . . . . . . . . . . . . . . . . . . . . . 597 communications tools, using other . . . . 608 compact discs, audio . . . . . . . . . . . . . . . . . 477 comparing les . . . . . . . . . . . . . . . . . . . . . . 191 compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 completion, tab . . . . . . . . . . . . . . . . . . 61, 149 Composer, Mozilla . . . . . . . . . . . . . . 638, 661 composing mail . . . . . . . . . . . . . . . . . . . . . . 616 compressed le, seeing whats in a . . . . 199 compressed les . . . . . . . . . . . . . . . . . . . . . 196 compressed les, matching lines in . . . . 349 compressing a le . . . . . . . . . . . . . . . . . . . . 197 compression speed, specifying . . . . . . . . . 197 computer geek . . . . . . . . . . . . . . . . . . . . . . . . 25 concatenating text . . . . . . . . . . . . . . . . . . . 256 Concurrent Versions System (cvs) . . . . 202 conguring X . . . . . . . . . . . . . . . . . . . . . . . 116 connecting to a remote host . . . . . . . . . . 671 connecting to the Internet . . . . . . . . . . . . 597 console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Console Font Editor . . . . . . . . . . . . . . . . . 403 console font, displaying the characters in a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 console font, setting the . . . . . . . . . . . . . . 400 console fonts, using . . . . . . . . . . . . . . . . . . 400 console number, getting the . . . . . . . . . . . 33 console, browsing images in a . . . . . . . . . 410 console, emulating in X . . . . . . . . . . . . . . 109 console, scrolling text in the . . . . . . . . . . . 34 consoles and terminals, using . . . . . . . . . . 32 consoles, switching between. . . . . . . . . . . . 33
consoles, virtual . . . . . . . . . . . . . . . . . . . . . . 32 Constitution of the United States of America, The . . . . . . . . . . . . . . . . . . . 291 consulting word lists and helpful les . . 290 contact manager database, keeping a . . 548 contact managers, using . . . . . . . . . . . . . . 546 context, showing matched lines in their . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 context, showing matches in . . . . . . . . . . 344 control character, typing a . . . . . . . . . . . . 55 control characters, displaying . . . . . . . . . 217 control characters, inserting in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 control characters, inserting in Vi . . . . . 251 control keys . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 controlling access to les . . . . . . . . . . . . . 167 controlling how the shell checks your mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 controlling power to the system . . . . . . . . 27 controlling the system bell in X . . . . . . . 119 conventional le name extensions . . . . . 723 conventions, typographical . . . . . . . . . . . . . 6 conversions, cross-platform . . . . . . . . . . . 525 converting a PhotoCD image . . . . . . . . . 446 converting amounts and numbers . . . . . 567 converting an amount between units of measurement . . . . . . . . . . . . . . . . . . . . 567 converting an Arabic numeral to English . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 converting an mp3 le. . . . . . . . . . . . . . . . 494 converting html . . . . . . . . . . . . . . . . . . . . . 663 converting image les . . . . . . . . . . . . . . . . 432 converting Microsoft Word les . . . . . . . 531 converting ogg to another format . . . . . 495 converting PostScript . . . . . . . . . . . . . . . . 459 converting PostScript to pdf . . . . . . . . . 460 converting PostScript to plain text . . . . 460 converting sound les . . . . . . . . . . . . . . . . 493 converting text les between dos and Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 530 converting text from proprietary formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 converting to and from fax format . . . . 604 converting underlines in text . . . . . . . . . 328
Concept Index
753
a converting Word to L TEX . . . . . . . . . . . . 532 converting Word to plain text . . . . . . . . 533 Cooledit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Coordinated Universal Time (utc) . . . 204, 537 copying a link to the clipboard from Mozilla . . . . . . . . . . . . . . . . . . . . . . . . . 642 copying an email address to the clipboard from Mozilla . . . . . . . . . . . . . . . . . . . . 642 copying les and directories . . . . . . . . . . 141 copying les by a unique parent directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 copying les to and from a dos disk . . . 526 copying les to and from a Macintosh disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 copying les with their attributes . . . . . 142 copying subdirectories . . . . . . . . . . . . . . . 143 copyleft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 corba Interface Denition Language (idl) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Corderoy, Ralph . . . . . . . . . . . . . . . . . . . . . 734 counting a selection of text . . . . . . . . . . . 295 counting how many messages you have . . . . . . . . . . . . . . . . . . . . . . . . . . . 584, 625 counting lines per page in Emacs . . . . . 294 counting selected word occurrences in text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 counting text . . . . . . . . . . . . . . . . . . . . . . . . 293 counting the characters in a text . . . . . . 294 counting the lines in a text . . . . . . . . . . . 294 counting the occurrences of something . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 counting the words in a text . . . . . . . . . . 294 counting word occurrences in text . . . . . 299 cpu type, displaying . . . . . . . . . . . . . . . . . 719 Cqcam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Craft of Text Editing, The . . . . . . . . . . . 736 cribbage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 cron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 cron job, adding a . . . . . . . . . . . . . . . . . . 558 cron job, removing a . . . . . . . . . . . . . . . . 558 cron jobs, listing your . . . . . . . . . . . . . . . 559 cron table . . . . . . . . . . . . . . . . . . . . . . . . . . 557 crontab le . . . . . . . . . . . . . . . . . . . . . . . . . 557
cross-platform conversion, using other tools for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 cross-platform conversions . . . . . . . . . . . . 525 crossword puzzle words, nding . . . . . . . 590 Crowther, William . . . . . . . . . . . . . . . . . . . 583 Csh . . . . . . . . . . . . . . . . . . . . . . . . . . 10, 92, 365 current directory, getting the name of the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 current shell, getting the name of your . . 91 current working directory . . . . . . . . . . . . 126 custom headers, paginating with . . . . . . 313 custom page length, paginating with a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 custom page width, paginating with a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 customizing Vi . . . . . . . . . . . . . . . . . . . . . . 252 cut and paste operations . . . . . . . . . . . . . 253 cut-ups, making in emacs . . . . . . . . . . . . 593 cut-ups, making random word . . . . . . . . 592 cut-ups, making simple text . . . . . . . . . . 592 cut-ups, text . . . . . . . . . . . . . . . . . . . . . . . . 591 Cutils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 cutting out part of a sound le . . . . . . . 488 cutting text . . . . . . . . . . . . . . . . . . . . . . . . . 254 cvs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
D
daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . data cd, unmounting a. . . . . . . . . . . . . . . data cds . . . . . . . . . . . . . . . . . . . . . . . . . . . . data, plotting . . . . . . . . . . . . . . . . . . . . . . . date, displaying the . . . . . . . . . . . . . . . . . . date, setting the system . . . . . . . . . . . . . . Davis, John E. . . . . . . . . . . . . . . . . . . . . . . Dawson, Terry . . . . . . . . . . . . . . . . . . . . . . day of the year, displaying the . . . . . . . . dc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . deb package, getting the status of a . . . deb package, installing a . . . . . . . . . . . . . deb package, listing all les in a . . . . . . 717 496 227 507 506 575 537 700 267 733 538 580 713 711 713
754
deb package, listing dependences for a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 deb package, listing the one a le is a part of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 deb package, removing a . . . . . . . . . . . . . 713 deb package, upgrading a . . . . . . . . . . . . 711 deb packages . . . . . . . . . . . . . . . . . . . . . 4, 707 deb packages, listing . . . . . . . . . . . . . . . . . 710 deb packages, managing . . . . . . . . . . . . . 709 Debian . . . . . . . . . . . . . . . . . . . 4, 19, 542, 731 Debian Font Manager . . . . . . . . . . . . . . . . 403 Debian Free Software Guidelines (dfsg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Debian, Red Hat, and other Linux distributions . . . . . . . . . . . . . . . . . . . . . 19 dec vt102/220 . . . . . . . . . . . . . . . . . . . . . 109 Declaration of Independence of the Thirteen Colonies, The . . . . . . . . . . 291 decoding text in rot13 . . . . . . . . . . . . . . 571 decompressing a le. . . . . . . . . . . . . . . . . . 198 decrypting data with gpg . . . . . . . . . . . . 575 DEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 default shell, changing your . . . . . . . . . . . . 91 denitions, of words . . . . . . . . . . . . . . . . . 284 deiconifying an X window . . . . . . . . . . . . 107 delay, running a command on a . . . . . . . 555 deleting a job scheduled to run . . . . . . . 557 deleting characters in text . . . . . . . . . . . . 318 deleting les and directories . . . . . . . . . . 149 deleting les on a dos disk . . . . . . . . . . . 526 deleting les on a Macintosh disk . . . . . 528 deleting mail . . . . . . . . . . . . . . . . . . . . . . . . 619 Dell Computer Corporation . . . . . . . . . . 699 Delphi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 denying messages to your terminal . . . . 690 Desk Calculator (dc) . . . . . . . . . . . . . . . . 580 desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 desktop environment . . . . . . . . . . . . . . . . . . 97 desktop themes . . . . . . . . . . . . . . . . . . . . . . 732 desktop, magnifying a portion of the . . 116 desktop, moving around the . . . . . . . . . . 108 destroying an X window. . . . . . . . . . . . . . 108 determining a programs type. . . . . . . . . 188 determining le type and format . . . . . . 187
determining if a host is online . . . . . . . . 685 determining the command line options for a groff le . . . . . . . . . . . . . . . . . . . . . 384 determining the ownership of a le . . . . 166 determining whether two directories dier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 determining whether two les dier . . . 191 determining which hardware is compatible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 dfsg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Dia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 dialects, outputting text in . . . . . . . . . . . 586 Diary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 dict Development Group . . . . . . . . . . . . 285 diction, checking. . . . . . . . . . . . . . . . . . . . . 286 dictionaries, checking online . . . . . . . . . . 285 dictionaries, using . . . . . . . . . . . . . . . . . . . 282 dictionary, personal . . . . . . . . . . . . . . . . . . 277 dictionary, searching for words in the . . 283 dierence report . . . . . . . . . . . . . . . . 192, 366 dierence report, patching a le with a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 dis, visual. . . . . . . . . . . . . . . . . . . . . . . . . . 437 Digital Audio Processor (dap) . . . . . . . . 496 digital cameras, downloading images from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Digital Millennium Copyright Act (dmca) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Digital Subscriber Line (dsl) . . . . . . . . . 597 Dillo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 directories . . . . . . . . . . . . . . . . . . . . . . . . . . 125 directories, changing . . . . . . . . . . . . . . . . . 132 directories, copying . . . . . . . . . . . . . . . . . . 141 directories, determining whether two dier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 directories, nding . . . . . . . . . . . . . . . . . . . 182 directories, nding the dierences between . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 directories, nding the largest . . . . . . . . 183 directories, nding the smallest . . . . . . . 183 directories, listing. . . . . . . . . . . . . . . . . . . . 133 directories, listing hidden . . . . . . . . . . . . . 138 directories, listing in color . . . . . . . . . . . . 134 directories, listing in columns . . . . . . . . . 138
Concept Index
755
directories, listing tree graphs of . . . . . . 156 directories, making . . . . . . . . . . . . . . . . . . 130 directories, moving . . . . . . . . . . . . . . . . . . 144 directories, naming . . . . . . . . . . . . . . . . . . 129 directories, removing . . . . . . . . . . . . . . . . . 149 directories, renaming . . . . . . . . . . . . . . . . . 144 directory listings, nding les in . . . . . . 182 directory order, sorting text in . . . . . . . . 322 directory panels . . . . . . . . . . . . . . . . . . . . . 158 directory tree . . . . . . . . . . . . . . . . . . . . . . . 125 directory tree, nding les in a . . . . . . . 172 directory tree, making a . . . . . . . . . . . . . . 131 directory, changing to the last one you visited . . . . . . . . . . . . . . . . . . . . . . . . . . 133 directory, nding the largest les in a . . 182 directory, nding the smallest les in a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 directory, mailing a . . . . . . . . . . . . . . . . . . 613 disk storage . . . . . . . . . . . . . . . . . . . . . . . . . 501 disk usage, listing a les . . . . . . . . . . . . . 502 disk, listing the free space on a . . . . . . . 501 diskette . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 diskettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 disks, oppy. . . . . . . . . . . . . . . . . . . . . . . . . 503 displaying a calendar . . . . . . . . . . . . . . . . 539 displaying a calendar in Emacs . . . . . . . 541 displaying a tools available options . . . . 37 displaying cpu type . . . . . . . . . . . . . . . . . . 719 displaying how long the system has been up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 displaying information about a host . . . 684 displaying information about a sound le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 displaying information about an audio cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 displaying information about an mp3 le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 displaying information about an ogg le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 displaying information about the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 displaying information about users . . . . 683 displaying memory usage . . . . . . . . . . . . . 720 displaying non-printing characters . . . . 217
displaying random quotations. . . . . . . . . 587 displaying text . . . . . . . . . . . . . . . . . . . . . . 216 displaying the beginning part of text . . 218 displaying the characters in a console font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 displaying the characters in an X font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 displaying the contents of a variable . . . . 79 displaying the date and time . . . . . . . . . 537 displaying the day of the year . . . . . . . . 538 displaying the distribution version . . . . 720 displaying the end part of text . . . . . . . . 218 displaying the hex values of text . . . . . . 221 displaying the Linux version . . . . . . . . . . 720 displaying the literal characters of text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 displaying the middle part of text . . . . . 219 displaying the minute of the hour . . . . . 538 displaying the text between strings . . . . 220 displaying the version of a tool . . . . . . . . 38 displaying your username. . . . . . . . . . . . . . 39 a distinguishing between TEX and L TEX les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 distribution, displaying the version . . . . 720 distribution, installing packages for your . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 distributions of Linux . . . . . . . . . . . . . . . . . 19 distributions, Linux . . . . . . . . . . . . . . . . . . 731 DistroWatch . . . . . . . . . . . . . . . . . . . . . . . . 731 dmca . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 DocBook dtd . . . . . . . . . . . . . . . . . . . 380, 382 document classes . . . . . . . . . . . . . . . . . . . . 375 Document Type Denition (dtd) . . . . . 388 documentation, system . . . . . . . . . . . . . . . . 50 Documenters Workbench (dwb) . . . . . . 286 domain name, listing the owner of a . . . 688 domain record . . . . . . . . . . . . . . . . . . . . . . . 688 Dome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Doob, Michael . . . . . . . . . . . . . . . . . . 376, 735 dos . . . . . . . . . . . . 28, 93, 231, 267, 270, 525 dos disk, copying les to and from a . . 526 dos disk, deleting les on a. . . . . . . . . . . 526 dos disk, formatting a . . . . . . . . . . . . . . . 526 dos disk, listing the contents of a . . . . . 525
756
dos disk, using . . . . . . . . . . . . . . . . . . . . . . 525 dos text les, converting . . . . . . . . . . . . . 530 dot les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 dots per inch (dpi) . . . . . . . . . . . . . . 396, 444 double-spacing text . . . . . . . . . . . . . . . . . . 307 doubled words, checking text for . . . . . . 288 downloading a le from a remote host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 downloading an url . . . . . . . . . . . . . . . . . 654 dpi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396, 444 drawing tablets . . . . . . . . . . . . . . . . . . . . . . 450 Drgenius . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 Drgeo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 drive letters for dos disks . . . . . . . . . . . . 526 driver, null . . . . . . . . . . . . . . . . . . . . . . . . . . 467 driver, sound . . . . . . . . . . . . . . . . . . . . . . . . 463 drives, letting users mount . . . . . . . . . . . 718 dsa/ElGamal . . . . . . . . . . . . . . . . . . . . . . . 573 dselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 Dselect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 Dselect Documentation for Beginners . . 734 dsl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 DSL HOWTO for Linux . . . . . . . . . . . . . 597 dtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 DTMFdial . . . . . . . . . . . . . . . . . . . . . . . . . . 608 Duggan, Angus . . . . . . . . . . . . . . . . . . . . . . 451 dumb terminal . . . . . . . . . . . . . . . . . . . . . . . 32 dumb terminals. . . . . . . . . . . . . . . . . . . . . . . 95 dummy data, writing to a le . . . . . . . . . 513 duplicate lines of text, ltering out . . . . 319 dvd drive . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 dvds, viewing . . . . . . . . . . . . . . . . . . . . . . . 419 Dvgrab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 dvi le, preparing for printing . . . . . . . . 520 dvi le, previewing a . . . . . . . . . . . . . . . . 413 dvi le, printing a . . . . . . . . . . . . . . . . . . . 515 dvi pages, extracting to PostScript . . . . 452 dwb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 dxf format. . . . . . . . . . . . . . . . . . . . . . . . . . 438
E
e2fs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504 E3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
early days of unix . . . . . . . . . . . . . . . . . . . . 15 Easy Editor (ee) . . . . . . . . . . . . . . . . . . . . 265 easy shell (Esh) . . . . . . . . . . . . . . . . . . . . . . 93 eBook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 echo area . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 echo, adding to a sound le. . . . . . . . . . . 491 edit . . . . . . . . . . . . . . . . . . . . . . . 231, 267, 531 editing images . . . . . . . . . . . . . . . . . . . . . . . 421 Editing MACroS . . . . . . . . . . . . . . . . . . . . 244 editing sound les . . . . . . . . . . . . . . . . . . . 487 editing streams of text . . . . . . . . . . . . . . . 255 editing text . . . . . . . . . . . . . . . . . . . . . . . . . 231 EDITOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 ee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 eects, sound . . . . . . . . . . . . . . . . . . . . . . . . 488 Eectv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 ejecting an audio cd . . . . . . . . . . . . . . . . . 480 Electric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 electronic mail . . . . . . . . . . . . . . . . . . . . . . 611 Elements of Style . . . . . . . . . . . . . . . . . . . . 286 eliminating extra spaces in text . . . . . . . 305 eliza . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 Elm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 Elvis . . . . . . . . . . . . . . . . . . . . . . . . . . . 245, 265 em dashes . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Emacs . . 8, 54, 93, 223, 231, 247, 253, 264, 266, 311, 328, 487, 542, 546, 579, 648, 662 Emacs buer, printing an . . . . . . . . . . . . 516 Emacs buers, viewing multiple at once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Emacs diary . . . . . . . . . . . . . . . . . . . . . . . . 542 Emacs Lisp . . . . . . . . . . . . . . . . . . . . . . 93, 366 Emacs Public License . . . . . . . . . . . . . . . . . 17 Emacs tutorial, running an . . . . . . . . . . . 237 Emacs, accessing the Web in . . . . . . . . . 649 Emacs, counting lines per page in . . . . . 294 Emacs, displaying a calendar in . . . . . . . 541 Emacs, getting acquainted with . . . . . . . 232 Emacs, inserting special characters in . . 239 Emacs, listing relevant les in . . . . . . . . 302 Emacs, Lucid . . . . . . . . . . . . . . . . . . . . . . . 232 Emacs, making abbreviations in . . . . . . 242 Emacs, making cut-ups in . . . . . . . . . . . . 593
Concept Index
757
Emacs, recording and running macros in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Emacs, searching and replacing in. . . . . 353 Emacs, searching for a phrase in . . . . . . 353 Emacs, searching for a regexp in . . . . . . 353 Emacs, searching incrementally in. . . . . 352 Emacs, searching text in . . . . . . . . . . . . . 352 Emacs, spell checking in. . . . . . . . . . . . . . 280 Emacs, using . . . . . . . . . . . . . . . . . . . . . . . . 232 Emacs, using basic editing keys . . . . . . . 237 email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 email address, copying to the clipboard from Mozilla . . . . . . . . . . . . . . . . . . . . 642 email addresses, verifying . . . . . . . . . . . . 627 email reminders, sending yourself . . . . . 550 email signature, making an . . . . . . . . . . . 631 empty le, making an . . . . . . . . . . . . . . . . 130 empty les, nding in a directory tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 empty set . . . . . . . . . . . . . . . . . . . . . . 335, 336 empty string . . . . . . . . . . . . . . . . . . . . . . . . . 79 Encapsulated PostScript (eps) . . . . . . . . 451 encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 encoding an ogg le . . . . . . . . . . . . . . . . . . 495 encoding mp3 . . . . . . . . . . . . . . . . . . . . . . . 494 encoding text in rot13 . . . . . . . . . . . . . . 570 encrypting data with gpg . . . . . . . . . . . . 574 end of le (eof) . . . . . . . . . . . . . . . . . . . . . 259 Enlightened Sound Daemon . . . . . . . . . . 467 Enlightened Terminal Emulator . . . . . . . 114 Enlightenment . . . . . . . . . . . . . . . . . . . . . . 120 Enscript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 envelopes, printing . . . . . . . . . . . . . . . . . . . 515 eof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 EPIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 eps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 eps le, previewing a . . . . . . . . . . . . . . . . 414 error messages, redirecting to a le . . . . . 68 escape character . . . . . . . . . . . . . . . . . 56, 672 escapement class . . . . . . . . . . . . . . . . . . . . 396 Escher, M.C. . . . . . . . . . . . . . . . . . . . . . . . . 438 Esh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Eshell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 etext-style underlining . . . . . . . . . . . . . . . 327
Eudora . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632 event number . . . . . . . . . . . . . . . . . . . . . . . . 74 events, history . . . . . . . . . . . . . . . . . . . . . . . . 74 Everybuddy . . . . . . . . . . . . . . . . . . . . . . . . . 694 Evolution . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Ewing, Larry . . . . . . . . . . . . . . . . . . . . . . . . . 20 Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Excel, Microsoft . . . . . . . . . . . . . . . . . . . . . 536 exclamation point, quoting . . . . . . . . . . . . 59 executable . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 execute permission . . . . . . . . . . . . . . . . . . . 167 executing a command . . . . . . . . . . . . . . . . . 36 exiting a shell . . . . . . . . . . . . . . . . . . . . . . . . 91 expansion, variable . . . . . . . . . . . . . . . . . . . 78 expansions, le name . . . . . . . . . . . . . . . . 153 Express . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 extended characters . . . . . . . . . . . . . . . . . . 228 extensions, conventional le name . . . . . 723 extracting dvi pages to PostScript . . . . 452 extracting les from an archive . . . . . . . 201 extracting pages from a PostScript le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 extracting PhotoCD images . . . . . . . . . . 445
F
fancy headers, outputting text with . . . 368 Fannin, David . . . . . . . . . . . . . . . . . . . . . . . 597 faq. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 faqs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 faqs, linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 fax format, converting to and from . . . . 604 fax, receiving a . . . . . . . . . . . . . . . . . . . . . . 603 fax, sending a . . . . . . . . . . . . . . . . . . . . . . . 601 faxes, receiving automatically . . . . . . . . . 603 faxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 Fbi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Fbtv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Fedora . . . . . . . . . . . . . . . . . . . . . . . 19, 98, 731 Feh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Fender Vibro-Champ . . . . . . . . . . . . . . . . 493 Festival . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 fetching pop mail . . . . . . . . . . . . . . . . . . . . 622 elds, text . . . . . . . . . . . . . . . . . . . . . . 323, 324
758
fifo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Figurine . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 le archive, making a . . . . . . . . . . . . . . . . 200 le archives, managing . . . . . . . . . . . . . . . 199 le attributes, listing . . . . . . . . . . . . . . . . . 136 le compression, using . . . . . . . . . . . . . . . 196 le formats . . . . . . . . . . . . . . . . . . . . . . . . . . 723 le modication time, changing . . . . . . . 189 le name extensions, conventional . . . . . 723 le names, changing to lowercase . . . . . 145 le names, specifying with patterns . . . 153 le permissions . . . . . . . . . . . . . . . . . . . . . . 167 le revision, checking in a . . . . . . . . . . . . 203 le revision, checking out a . . . . . . . . . . . 204 le specication . . . . . . . . . . . . . . . . . . . . . 153 File Transfer Protocol (ftp) . . . . . . . . . . 673 le types, listing . . . . . . . . . . . . . . . . . . . . . 135 le, appending text to a . . . . . . . . . . . . . . 258 le, armored . . . . . . . . . . . . . . . . . . . . . . . . 574 le, changing the ownership of a . . . . . . 166 le, changing the permissions of a . . . . . 168 le, determining the ownership of a . . . 166 le, getting information about a . . . . . . 187 le, inserting text at the beginning of a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 le, keeping one of patterns to search for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 le, listing disk usage of a . . . . . . . . . . . . 502 le, listing the permissions of a . . . . . . . 168 le, listing when it was last modied . . 188 le, mailing a . . . . . . . . . . . . . . . . . . . . . . . 613 le, making executable . . . . . . . . . . . . . . . 170 le, making private . . . . . . . . . . . . . . . . . . 169 le, making public . . . . . . . . . . . . . . . . . . . 170 le, perusing a . . . . . . . . . . . . . . . . . . . . . . 213 le, redirecting error messages to a . . . . . 68 le, redirecting input to a . . . . . . . . . . . . . 67 le, redirecting output to a . . . . . . . . . . . . 68 le, saving mail to a . . . . . . . . . . . . . . . . . 620 le, source . . . . . . . . . . . . . . . . . . . . . . . . . . 141 le, target . . . . . . . . . . . . . . . . . . . . . . . . . . 141 le, using one with spaces in its name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
les . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123, 125 les and directories . . . . . . . . . . . . . . . . . . 125 les, archiving . . . . . . . . . . . . . . . . . . . . . . . 199 les, browsing . . . . . . . . . . . . . . . . . . . . . . . 157 les, checking in many . . . . . . . . . . . . . . . 206 les, columnating text from separate . . 323 les, comparing. . . . . . . . . . . . . . . . . . . . . . 191 les, compressing . . . . . . . . . . . . . . . . . . . . 197 les, controlling access to. . . . . . . . . . . . . 167 les, converting Microsoft Word . . . . . . 531 les, copying . . . . . . . . . . . . . . . . . . . . . . . . 141 les, copying by a unique parent directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 les, copying with their attributes . . . . 142 les, creating . . . . . . . . . . . . . . . . . . . . . . . . 189 les, decompressing . . . . . . . . . . . . . . . . . . 198 les, determining type and format of . . 187 les, determining whether two dier . . . 191 les, dot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 les, executable . . . . . . . . . . . . . . . . . . . . . 170 les, nding . . . . . . . . . . . . . . . . . . . . . . . . . 171 les, nding all that match a pattern . . 171 les, nding in a directory tree . . . . . . . 172 les, nding in a directory tree by access time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 les, nding in a directory tree by change time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 les, nding in a directory tree by modication time . . . . . . . . . . . . . . . 176 les, nding in a directory tree by name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 les, nding in a directory tree by owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 les, nding in a directory tree by size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 les, nding in listings . . . . . . . . . . . . . . . 182 les, nding the dierences between . . . 192 les, nding the largest in a directory . . 182 les, nding the number of in a listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 les, nding the percentage two dier by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 les, nding the smallest . . . . . . . . . . . . . 183 les, nding words in . . . . . . . . . . . . . . . . 333
Concept Index
759
getting from the Web . . . . . . . . . . . 653 giving more than one name . . . . . . 152 hidden . . . . . . . . . . . . . . . . . . . . . . . . . 138 including text from other . . . . . . . . 261 linking . . . . . . . . . . . . . . . . . . . . . . . . . 152 listing in sorted order . . . . . . . . . . . 139 listing recursively . . . . . . . . . . . . . . . 140 listing the misspellings in . . . . . . . . 276 making empty . . . . . . . . . . . . . . . . . . 130 managing . . . . . . . . . . . . . . . . . . . . . . 187 matching lines in many . . . . . . . . . . 348 moving . . . . . . . . . . . . . . . . . . . . . . . . 144 naming . . . . . . . . . . . . . . . . . . . . . . . . 129 owning . . . . . . . . . . . . . . . . . . . . . . . . . 166 pasting columns of text from separate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 les, perusing multiple text . . . . . . . . . . . 215 les, perusing the dierences in a group of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 les, preparing for printing . . . . . . . . . . . 518 les, previewing print . . . . . . . . . . . . . . . . 413 les, printing . . . . . . . . . . . . . . . . . . . . . . . . 509 les, read-only. . . . . . . . . . . . . . . . . . . . . . . 169 les, reference . . . . . . . . . . . . . . . . . . . . . . . 289 les, removing . . . . . . . . . . . . . . . . . . . . . . . 149 les, removing interactively . . . . . . . . . . . 150 les, removing those with strange names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 les, removing without verication . . . . 151 les, renaming . . . . . . . . . . . . . . . . . . . . . . . 144 les, renaming multiple . . . . . . . . . . . . . . 147 les, searching more than plain text . . . 348 les, sharing . . . . . . . . . . . . . . . . . . . . . . . . 163 les, showing which contain matching lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 les, splitting into smaller . . . . . . . . . . . . 189 les, touching . . . . . . . . . . . . . . . . . . . . . . . 189 les, tracking revisions to . . . . . . . . . . . . 202 les, transferring large . . . . . . . . . . . . . . . 189 les, undeleting. . . . . . . . . . . . . . . . . . . . . . 150 les, unzipping . . . . . . . . . . . . . . . . . . . . . . 535 les, world readable . . . . . . . . . . . . . . . . . . 170 les, world writable . . . . . . . . . . . . . . . . . . 170 les, write-protecting . . . . . . . . . . . . . . . . 169 les, les, les, les, les, les, les, les, les, les, les, les, les, les, les,
les, writing text to . . . . . . . . . . . . . . . . . . 258 les, zipping . . . . . . . . . . . . . . . . . . . . . . . . 534 lespec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 lesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 Filesystem Hierarchy Standard . . . . . . . 129 lter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 lter, dened . . . . . . . . . . . . . . . . . . . . . . . . 586 lter, outputting text through ax . . . . . 371 ltering out duplicate lines of text . . . . 319 nances, managing . . . . . . . . . . . . . . . . . . 580 Findimagedupes . . . . . . . . . . . . . . . . . . . . . 437 nding all les that match a pattern . . 171 nding anagrams in text . . . . . . . . . . . . . 588 nding crossword puzzle words . . . . . . . 590 nding directories . . . . . . . . . . . . . . . . . . . 182 nding les . . . . . . . . . . . . . . . . . . . . . . . . . 171 nding les by multiple criteria . . . . . . . 179 nding les in a directory tree . . . . . . . . 172 nding les in a directory tree by access time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 nding les in a directory tree by change time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 nding les in a directory tree by modication time . . . . . . . . . . . . . . . 176 nding les in a directory tree by name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 nding les in a directory tree by owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 nding les in a directory tree by size . . 174 nding les in directory listings . . . . . . . 182 nding matches for word games . . . . . . . 588 nding newsgroups for a topic . . . . . . . . 682 nding palindromes in text . . . . . . . . . . . 589 nding patterns in certain places. . . . . . 342 nding patterns only in certain positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 nding phrases in text regardless of spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 nding prime factors . . . . . . . . . . . . . . . . . 567 nding relevancies in texts . . . . . . . . . . . 301 nding similar or relevant text . . . . . . . . 301 nding the correct spelling of a word . . 275 nding the dierences between directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
760
nding the dierences between les . . . 192 nding the largest directories . . . . . . . . . 183 nding the largest les in a directory . . 182 nding the number of les in a listing . . 184 nding the percentage two les dier by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 nding the right tool for the job . . . . . . . 44 nding the smallest directories . . . . . . . . 183 nding the smallest les in a directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 nding where a program is located . . . . 185 Finseth, Craig A. . . . . . . . . . . . . . . . . . . . . 736 FireWire . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 Five in a Row . . . . . . . . . . . . . . . . . . . . . . . 584 xed disk . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 xed storage . . . . . . . . . . . . . . . . . . . . . . . . 501 ags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 ame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679 ange, adding to a sound le . . . . . . . . . 491 FlashPix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 Flesch Reading Ease Score . . . . . . . . . . . 289 oppy disk . . . . . . . . . . . . . . . . . . . . . . . . . . 501 oppy disk, formatting a . . . . . . . . . . . . . 504 oppy disk, mounting a . . . . . . . . . . . . . . 504 oppy disk, unmounting a . . . . . . . . . . . . 505 oppy disks . . . . . . . . . . . . . . . . . . . . . . . . . 503 oppy drives, letting users mount . . . . . 718 oppy, permitting user access to . . . . . . 718 Floyd-Steinberg error diusion . . . . . . . . 426 Fluxbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Flying Saucer Attack . . . . . . . . . . . . . . . . 490 focus, window . . . . . . . . . . . . . . . . . . . . . . . 105 Fog Index . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 foils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 FoilTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 following links . . . . . . . . . . . . . . . . . . . . . . . 639 font tools, using other . . . . . . . . . . . . . . . . 403 Font Viewer . . . . . . . . . . . . . . . . . . . . . . . . . 403 font, outputting text in a . . . . . . . . . . . . . 361 font, resizing in an xterm . . . . . . . . . . . . . 398 font, selecting in X . . . . . . . . . . . . . . . . . . 397 font, window . . . . . . . . . . . . . . . . . . . . . . . . 104 Fonter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 FontForge . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
fonts, console . . . . . . . . . . . . . . . . . . . . . . . . 400 fonts, text. . . . . . . . . . . . . . . . . . . . . . . . . . . 400 fonts, using . . . . . . . . . . . . . . . . . . . . . . . . . 395 foreground jobs . . . . . . . . . . . . . . . . . . . . . . . 70 foreground, putting a job in the . . . . . . . . 73 format of recipes. . . . . . . . . . . . . . . . . . . . . . . 4 format, determining le . . . . . . . . . . . . . . 187 formats, le . . . . . . . . . . . . . . . . . . . . . . . . . 723 formatting a dos disk . . . . . . . . . . . . . . . . 526 formatting a oppy disk . . . . . . . . . . . . . . 504 formatting a Macintosh disk . . . . . . . . . . 529 formatting text . . . . . . . . . . . . . . . . . . . . . . 305 formfeed character . . . . . . . . . . . . . . . . . . . 312 formfeeds, inserting in a text le . . . . . . 239 formfeeds, placing in text . . . . . . . . . . . . 316 Fortran 77 . . . . . . . . . . . . . . . . . . . . . . . . . . 366 fortune cookie, getting a . . . . . . . . . . . . . 588 fqdn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 frames, splitting . . . . . . . . . . . . . . . . . . . . . 244 frames, window . . . . . . . . . . . . . . . . . . 95, 106 Free Audio Music Player (FreeAmp) . . 475 free content . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Free Internet Lexicon and Encyclopedia (file) . . . . . . . . . . . . . . . . . . . . . . . . . . 285 free software . . . . . . . . . . . . . . . . . . . . . . 17, 20 Free Software Foundation . . . . . . . . . . . . 737 Free Software Foundation (fsf) . . . . 17, 18, 21, 48, 232 free software movement, genesis of the . . 16 free-form address list, keeping a . . . . . . . 546 Free-Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 FreeAmp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Freebirth . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 freeware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 frequently asked questions . . . . . . . . . . . . . 50 frequently asked questions (faq) . . . . . . . 13 Freshmeat . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Friedmen, Noah . . . . . . . . . . . . . . . . . . . . . 624 fsf . . . . . . . . . . . . . . . . . . . 17, 18, 21, 48, 232 fsf/unesco Free Software Directory . . 732 ftp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 ftp, anonymous . . . . . . . . . . . . . . . . . . . . . . 673 Fuji digital cameras . . . . . . . . . . . . . . . . . . 449
Concept Index
761
full path name . . . . . . . . . . . . . . . . . . . . . . 126 Fuller, R.Buckminster . . . . . . . . . . . . . . . . . 23 fully qualied domain name (fqdn) . . . 687 functions, Emacs . . . . . . . . . . . . . . . . . . . . 234 furniture, designing . . . . . . . . . . . . . . . . . . 438 fvwm2 . . . . . . . . . . . . . . . . . . . . . 96, 100, 108 fvwm95 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
G
Gaim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 Galeon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 games, nding matches for word . . . . . . 588 gamma correction . . . . . . . . . . . . . . . . . . . 427 Gcal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 geek, computer . . . . . . . . . . . . . . . . . . . . . . . 25 general Linux guides and instruction . . 733 General Public License (gnu gpl) . . . . . 17 generating output from sgml . . . . . . . . . 390 genesis of the free software movement . . 16 Gentle Introduction to TEX, A . . . 376, 735 Gentoo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 geodesic domes . . . . . . . . . . . . . . . . . . . . . . 580 geometry, window . . . . . . . . . . . . . . . . . . . 102 getting a description of a program . . . . . 46 getting a terminal window in X . . . . . . . 109 getting acquainted with Emacs . . . . . . . 232 getting acquainted with Mozilla . . . . . . . 638 getting acquainted with Vi . . . . . . . . . . . 245 getting and installing a Linux distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 getting les from the Web . . . . . . . . . . . . 653 getting information about a le . . . . . . . 187 getting information about an X window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 getting started with LyX . . . . . . . . . . . . . 379 a getting started with TEX and L TEX . . . 375 getting the hostname of an ip address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 getting the ip address of a hostname . . 686 getting the name of the current directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 getting the name of your current shell . . 91 getting the status of a deb package . . . 713
getting the status of an rpm package . . 716 getting the virtual console number . . . . . 33 Ghostscript . . . . . . . 391, 451, 457, 460, 605 gid . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163, 717 gimp . . . . . . . . . . . . . . . 20, 427, 433, 446, 514 gimp, using the . . . . . . . . . . . . . . . . . . . . . . 434 giving a le more than one name. . . . . . 152 glame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 Glimmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 glob expression . . . . . . . . . . . . . . . . . . . . . . 153 Global System for Mobile Communications (gsm) . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Global Thermonuclear War . . . . . . . . . . . 585 globbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 glue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 gmt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 gnome . . . 97, 115, 157, 264, 580, 632, 638, 668, 682 GNU Awk Users Guide, The . . . . . . . . . 734 gnu Emacs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 gnu le utilities . . . . . . . . . . . . . . . . . . . . . . 23 gnu General Public License (gnu gpl) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18, 21 gnu gpl . . . . . . . . . . . . . . . . . . . . . . 17, 18, 21 gnu Image Manipulation Program (gimp) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434 gnu Manifesto . . . . . . . . . . . . . . . . . . . . . . 290 gnu Network Object Model Environment (gnome) . . . . . . . 97, 580, 632, 668, 682 gnu notation . . . . . . . . . . . . . . . . . . . . . . . . . . 8 gnu Privacy Guard (gpg) . . . . . . . . . . . . 572 gnu Project . . 17, 19, 97, 121, 286, 680, 737 gnu text utilities . . . . . . . . . . . . . . . . . . . . . 23 gnu-style options . . . . . . . . . . . . . . . . . . . . . 37 gnu/Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 GnuCash . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Gnumeric . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 Gnus . . . . . . . . . . . . . . . . . . . . . . . . . . . 632, 681 Go Fish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 gocr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 going into maintenance mode . . . . . . . . . 705 Google Groups . . . . . . . . . . . . . . . . . . . . . . 679 Gopher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
762
Gozer . . . . . . . . . . . . . . . . . . . . . . . . . . 403, 447 gpg encryption, using . . . . . . . . . . . . . . . . 572 gpg, decrypting data with . . . . . . . . . . . 575 gpg, encrypting data with . . . . . . . . . . . 574 gPhoto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 gpl, gnu . . . . . . . . . . . . . . . . . . . . . . 17, 18, 21 grammar and reference . . . . . . . . . . . . . . . 275 grammar, checking. . . . . . . . . . . . . . . . . . . 286 GramoFile . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Grandsire, Christophe. . . . . . . . . . . . . . . . 735 graphic les, viewing . . . . . . . . . . . . . . . . . 407 graphs, making with a single data set . . 575 graphs, making with multiple data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577 Greenwich Mean Time gmt . . . . . . . . . . 537 grep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 groff . . . . . . . . . . . . . . . . . . . . . 358, 448, 734 GROFF and Friends HOWTO, The . . . 734 groff le, determining the command line options for a . . . . . . . . . . . . . . . . . . . . 384 groff le, processing a . . . . . . . . . . . . . . 383 groff tutorial, running a . . . . . . . . . . . . 385 groff, using . . . . . . . . . . . . . . . . . . . . . . . . 383 Groovy CD Player . . . . . . . . . . . . . . . . . . . 484 group id (gid) . . . . . . . . . . . . . . . . . . 163, 717 group, listing the members of a . . . . . . . 165 group, login . . . . . . . . . . . . . . . . . . . . . . . . . 163 Groups of Linux Users Everywhere (glue) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 groups, adding members to . . . . . . . . . . . 718 groups, listing . . . . . . . . . . . . . . . . . . . . . . . 163 groups, listing a users . . . . . . . . . . . . . . . 164 groups, working in . . . . . . . . . . . . . . . . . . . 163 groupware . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Grunch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 gsm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 Gsumi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 guru . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Gysin, Brion . . . . . . . . . . . . . . . . . . . . . . . . 591 Gzilla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
H
Haardt, Michael . . . . . . . . . . . . . . . . . . . . . 286 hacker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Hahn, Jane . . . . . . . . . . . . . . . . . . . . . . . . . 735 Handy One-Liners for SED . . . . . . . . . . . 735 Hangman . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 hard disk . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 hard links . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 hardware for Linux . . . . . . . . . . . . . . . . . . 732 hardware peripherals, letting users access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 hardware, determining which is compatible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 hardware, setting up . . . . . . . . . . . . . . . . . 699 hardware, sources of . . . . . . . . . . . . . . . . . 731 Haskell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 hat notation . . . . . . . . . . . . . . . . . . 8, 214, 217 Hauben, Michael . . . . . . . . . . . . . . . . . . . . 736 Hauben, Ronda. . . . . . . . . . . . . . . . . . . . . . 736 Haun, Gregory Cosmo . . . . . . . . . . . . . . . 277 headers of a Web page, reading the . . . 656 help facilities, using the . . . . . . . . . . . . . . . 43 help les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 help les, reading . . . . . . . . . . . . . . . . . . . . . 50 help, if you need more . . . . . . . . . . . . . . . . 13 Hessling Editor, The (the) . . . . . . . . . . . 270 hex dump . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 hex values of text, displaying the . . . . . 221 hfs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 hidden les, listing . . . . . . . . . . . . . . . . . . . 138 hidden links, viewing . . . . . . . . . . . . . . . . 646 Hierarchical File System (hfs) . . . . . . . . 527 highlighting matches on their lines . . . . 345 HISTFILESIZE . . . . . . . . . . . . . . . . . . . . . . . . 87 history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 history of visited Web sites, keeping a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 history, of Linux and free software . . . . . 15 history, searching . . . . . . . . . . . . . . . . . . . . . 75 history, specifying a command from your . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 history, using command . . . . . . . . . . . . . . . 74 history, viewing. . . . . . . . . . . . . . . . . . . . . . . 74
Concept Index
763
HISTSIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Hitchcock, Alfred . . . . . . . . . . . . . . . . . . . . . 29 holidays, including in your reminders . . 544 Hollywood . . . . . . . . . . . . . . . . . . . . . . . . . . 382 HOME . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77, 154 home directory . . . . . . . . . . . . . . . . . . . . . . 125 home directory, changing to your . . . . . 132 home directory, setting up your . . . . . . . 727 home page . . . . . . . . . . . . . . . . . . . . . . . . . . 638 horizontal text fonts, outputting . . . . . . 401 host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 host key . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 host, determining if one is online . . . . . . 685 host, displaying information about a . . 684 host, tracing the path to another . . . . . 686 hostname . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 HOSTNAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 hostname, getting the ip address of a . . 686 house style, ltering text for . . . . . . . . . . 587 howtos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 hp-10c calculator, emulating the. . . . . . 581 html . . . . . . . . . . . . . . . . . . . . . . 358, 366, 637 html selection, viewing an . . . . . . . . . . . 647 html source code . . . . . . . . . . . . . . . . . . . . 223 html, converting . . . . . . . . . . . . . . . . . . . . 663 html, validating. . . . . . . . . . . . . . . . . . . . . 665 html, writing . . . . . . . . . . . . . . . . . . . . . . . 661 html-formatted text, viewing . . . . . . . . 223 http . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 Hunt the Wumpus . . . . . . . . . . . . . . . . . . . 586 HylaFAX . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 hypernyms, of words . . . . . . . . . . . . . . . . . 285 HyperText Markup Language (html) . . . . . . . . . . . . . . . . . . . . . . . 366, 637, 661 HyperText Transfer Protocol (http) . . 637
I
I Seek You (icq). . . . . . . . . . . . . . . . . . . . . iana . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ibiblio Linux Archive . . . . . . . . . . . . . . . . Ibm Corporation. . . . . . . . . . . . . . . . . . . . . icq, chatting on . . . . . . . . . . . . . . . . . . . . . id, group. . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 291 732 699 693 163
Ida . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 idl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 ieee. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18, 380 ieee1394 link . . . . . . . . . . . . . . . . . . . . . . . 449 if you need more help . . . . . . . . . . . . . . . . . 13 im services, using . . . . . . . . . . . . . . . . . . . . 694 image editors, using other . . . . . . . . . . . . 435 image les, converting . . . . . . . . . . . . . . . 432 image tags, adding parameters to . . . . . 663 image viewers, using other. . . . . . . . . . . . 418 image, printing an . . . . . . . . . . . . . . . . . . . 514 image, scanning an . . . . . . . . . . . . . . . . . . 444 image, turning text into an . . . . . . . . . . . 447 ImageMagick . . . . . . . . . . . . . . . 407, 421, 724 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 images, adding borders to . . . . . . . . . . . . 429 images, adjusting colors of. . . . . . . . . . . . 425 images, annotating . . . . . . . . . . . . . . . . . . 427 images, browsing in X. . . . . . . . . . . . . . . . 409 images, changing the size of . . . . . . . . . . 422 images, combining . . . . . . . . . . . . . . . . . . . 430 images, combining in montages . . . . . . . 430 images, editing . . . . . . . . . . . . . . . . . . . . . . 421 images, importing . . . . . . . . . . . . . . . . . . . 441 images, lossy . . . . . . . . . . . . . . . . . . . . . . . . 433 images, morphing two together . . . . . . . 431 images, quantizing . . . . . . . . . . . . . . . . . . . 427 images, rotating . . . . . . . . . . . . . . . . . . . . . 425 images, scanning . . . . . . . . . . . . . . . . . . . . 443 images, transforming . . . . . . . . . . . . . . . . . 421 images, viewing . . . . . . . . . . . . . . . . . . . . . 407 images, viewing in X . . . . . . . . . . . . . . . . . 407 importing images . . . . . . . . . . . . . . . . . . . . 441 importing images, using other tools for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 ImPress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Impulse Tracker . . . . . . . . . . . . . . . . . . . . . 469 inbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 inbox, locating . . . . . . . . . . . . . . . . . . . . . . 617 include le . . . . . . . . . . . . . . . . . . . . . . . . . . 261 includes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544 including holidays in your reminders . . 544 including text from other les . . . . . . . . 261 inclusion, le . . . . . . . . . . . . . . . . . . . . . . . . 261
764
indentation, outputting text with . . . . . 370 Info . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237, 390 Info manual, reading an . . . . . . . . . . . . . . . 48 Info node, printing an . . . . . . . . . . . . . . . . 517 ingredients . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Innovation3d . . . . . . . . . . . . . . . . . . . . . . . . 437 input devices, pressure-sensitive. . . . . . . 450 input le . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 input levels, setting for audio . . . . . . . . . 463 input line . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 input, redirecting . . . . . . . . . . . . . . . . . . . . . 67 input, redirecting output to another commands . . . . . . . . . . . . . . . . . . . . . . 69 inserting command output in Vi . . . . . . 251 inserting special characters in Emacs . . 239 inserting special characters in Vi . . . . . . 251 inserting text at the beginning of a le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 InstallFests . . . . . . . . . . . . . . . . . . . . . . 11, 706 installing a deb package . . . . . . . . . . . . . . 711 installing a shell script . . . . . . . . . . . . . . . 708 installing a source package . . . . . . . . . . . 707 installing an rpm package . . . . . . . . . . . . 715 installing packages for your Linux distribution . . . . . . . . . . . . . . . . . . . . . 707 Instant Messenger, America On-Line . . 694 Institute of Electrical and Electronics Engineers, Inc. (ieee) . . . . . . . . . . . . 18 Integrated Services Digital Network (isdn) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 interactive spell checking . . . . . . . . . . . . . 278 interlaced image . . . . . . . . . . . . . . . . . . . . . 432 Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Internet Assigned Numbers Authority (iana) . . . . . . . . . . . . . . . . . . . . . . . . . . 291 Internet Relay Chat (irc) . . . . . . . . . . . . 692 Internet Service Provider (isp) . . . . . . . . 597 internet services, other . . . . . . . . . . . . . . . 671 Internet, connecting to the . . . . . . . . . . . 597 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Ion . . . . . . . . . . . . . . . . . . . . . . . . 100, 106, 121 ip address, getting the hostname of an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 irc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692, 735
IRC Prelude, The . . . . . . . . . . . . . . . . . . . irc, chatting with users on . . . . . . . . . . . Irssi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . isdn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso 639 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iso 8859-1 character set, viewing . . . . . iso 9660 . . . . . . . . . . . . . . . . . . . . . . . . . . . . isp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ISP Hookup HOWTO . . . . . . . . . . . . . . . italic font . . . . . . . . . . . . . . . . . . . . . . . . . . . Ivtools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
735 692 693 597 290 228 483 597 597 395 437
J
Jabber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 Japanese characters, displaying . . . . . . . 264 Jargon File. . . . . . . . . . . . . . . . . . . . . . . . . . 291 Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Javascript . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Jaz drives . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 jed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 jfif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 job number . . . . . . . . . . . . . . . . . . . . . . . . . . 70 job, deleting one scheduled to run . . . . . 557 job, printing multiple copies of a . . . . . . 510 jobs, background . . . . . . . . . . . . . . . . . . . . . 72 jobs, cron . . . . . . . . . . . . . . . . . . . . . . . . . . 557 jobs, foreground . . . . . . . . . . . . . . . . . . . . . . 73 jobs, killing . . . . . . . . . . . . . . . . . . . . . . . . . . 74 jobs, listing those scheduled to run . . . . 557 jobs, listing your . . . . . . . . . . . . . . . . . . . . . . 73 jobs, managing . . . . . . . . . . . . . . . . . . . . . . . 70 jobs, suspending . . . . . . . . . . . . . . . . . . . . . . 71 joe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Joes Own Editor (joe) . . . . . . . . . . . . . . 267 John E.Davis editor (jed) . . . . . . . . . . . 267 join eld . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 Joint Photographic Experts Group (jpeg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 Joy, Bill . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 jpeg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 Jpilot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 Julias Casears cipher . . . . . . . . . . . 569, 584 jump scrolling . . . . . . . . . . . . . . . . . . . . . . . 111
Concept Index
765
L
Lamport, Leslie . . . . . . . . . . . . . . . . . . . . . 372 landscape orientation, outputting text in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 landscape orientation, PostScript pages in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 language highlighting, outputting text with . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 laser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 last-in rst-out (lifo) . . . . . . . . . . . . . . . . 580 LaStrange, Tom . . . . . . . . . . . . . . . . . . . . . 121 a L TEX . . . . . . . . . . . . . . . . . 328, 358, 372, 387 aTEX and BibTEX Tutorials and L Assignment . . . . . . . . . . . . . . . . . . . . . 736 a L TEX document templates, using . . . . . 376 a L TEX Environment, The . . . . . . . . . . . . . 387 a L TEX le, determining format of a . . . . 373 a L TEX le, processing a . . . . . . . . . . . . . . . 374 a L TEX for Everyone . . . . . . . . . . . . . . . . . . 735 a L TEX, converting plain text to . . . . . . . 393 a L TEX, getting started with . . . . . . . . . . . 375 ldp . . . . . . . . . . . . . . . . . . . . . 13, 50, 380, 733 Le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 learning more about LyX. . . . . . . . . . . . . 381 leave, reminding yourself when you have to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 left-justifying text . . . . . . . . . . . . . . . . . . . 311 Lesk, M.E. . . . . . . . . . . . . . . . . . . . . . . . . . . 734 less . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 less, searching text in . . . . . . . . . . . . . . . . 354 letting the shell complete what you type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 letting users access hardware peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 letting users mount drives . . . . . . . . . . . . 718 lexicons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 licq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 lifo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 LignumCAD . . . . . . . . . . . . . . . . . . . . . . . . 438 LilyPond . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 line breaks, adding to text. . . . . . . . . . . . 308 line printer . . . . . . . . . . . . . . . . . . . . . . . . . . 510 line, typing a long . . . . . . . . . . . . . . . . . . . . 66
K
K Desktop Environment (kde) . . . 97, 474, 496, 553 Kali . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 kde . . . . . . . . . . . 97, 114, 157, 474, 496, 553 Kedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 keeping a browser history . . . . . . . . . . . . 656 keeping a contact manager database . . 548 keeping a le of patterns to search for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 keeping a free-form address list . . . . . . . 546 keeping a spelling word list . . . . . . . . . . . 277 kernel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Kernighan, Brian W. . . . . . . . . . . . . . 15, 736 key notation. . . . . . . . . . . . . . . . . . . . . . . . . . . 8 key sequence . . . . . . . . . . . . . . . . . . . . . . . . 237 keyring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574 keys for command line editing . . . . . . . . . 54 keys, encryption . . . . . . . . . . . . . . . . . . . . . 573 killing a job . . . . . . . . . . . . . . . . . . . . . . . . . . 74 killing buers . . . . . . . . . . . . . . . . . . . . . . . 236 killing text . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Kincaid formula . . . . . . . . . . . . . . . . . . . . . 288 Kino. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 Kirch, Olaf . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Knews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 KNOPPIX . . . . . . . . . . . . . . . . . . . . . . . . . . 731 Knuth, Donald E. . . . . . . . . . . 372, 404, 736 Kodak PhotoCD . . . . . . . . . . . . . . . . . . . . 724 Kodak PhotoCD (pcd) . . . . . . . . . . . . . . 445 Konqueror . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Konsole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 KOrganizer . . . . . . . . . . . . . . . . . . . . . . . . . 553 Korn, David . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Krecord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 Ksh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Kuhn, Bradley M. . . . . . . . . . . . . . . . . . . . 735 Kvaleberg, Egil . . . . . . . . . . . . . . . . . . . . . . 597
766
lines beginning with certain text, matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 lines ending with certain text, matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 lines of a certain length, matching . . . . 339 lines of sorted text, viewing . . . . . . . . . . 226 lines per page, counting in Emacs . . . . . 294 lines, counting in a text . . . . . . . . . . . . . . 294 lines, matching that only contain certain characters . . . . . . . . . . . . . . . . . . . . . . 340 lines, outputting random . . . . . . . . . . . . . 585 lines, showing the ends of . . . . . . . . . . . . 217 link, copying to the clipboard from Mozilla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642 link, opening in a new window . . . . . . . . 642 links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 links, following . . . . . . . . . . . . . . . . . . . . . . 639 links, listing all in a page . . . . . . . . . . . . . 646 links, viewing hidding . . . . . . . . . . . . . . . . 646 Linux and related software, archives of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Linux books and guides . . . . . . . . . . . . . . 733 Linux distribution, getting and installing a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 Linux distributions . . . . . . . . . . . . . . . . . . 731 Linux Documentation Project (ldp) . . . 13, 50, 380, 733 Linux FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Linux Gazette . . . . . . . . . . . . . . . . . . . . . . . 733 Linux guides and instruction, general . . 733 Linux Journal . . . . . . . . . . . . . . . . . . . . . . . 737 Linux Network Administrators Guide, The . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 Linux Network Administrators Guide . . 11 Linux Network Administrators Guide, Second Edition . . . . . . . . . . . . . . . . . . 733 Linux news and commentary . . . . . . . . . 737 Linux on Laptops . . . . . . . . . . . . . . . . . . . . 733 Linux software and hardware, sources of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 Linux System Administrators Guide . . 11, 734 Linux Today . . . . . . . . . . . . . . . . . . . . . . . . 737
Linux tool and application guides . . . . . 734 Linux User Group (lug) . . . . . . . . . . 11, 737 Linux User Groups (lugs) . . . . . . . . . . . . . 14 Linux Weekly News . . . . . . . . . . . . . . . . . . 737 Linux, background and history of . . . . . . 15 Linux, displaying the version . . . . . . . . . 720 Linux, distributions of . . . . . . . . . . . . . . . . 19 Linux, hardware for . . . . . . . . . . . . . . . . . . 732 Linux, in specialized elds . . . . . . . . . . . . . 12 Linux, installing . . . . . . . . . . . . . . . . . . . . . . 10 Linux, the arrival of . . . . . . . . . . . . . . . . . . 18 Linux.Com . . . . . . . . . . . . . . . . . . . . . . . . . . 737 Linux: Rute Users Tutorial and Exposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 LinuxDoc dtd. . . . . . . . . . . . . . . . . . . . . . . 380 Linuxdoc-Tools . . . . . . . . . . . . . 358, 376, 388 LinuxHardware.net . . . . . . . . . . . . . . 700, 732 LinuxHardware.org . . . . . . . . . . . . . . 700, 733 Lisp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 list, columnating a . . . . . . . . . . . . . . . . . . . 323 listing a disks free space . . . . . . . . . . . . . 501 listing a les disk usage . . . . . . . . . . . . . . 502 listing a sequence of numbers . . . . . . . . . 565 listing aliases . . . . . . . . . . . . . . . . . . . . . . . . . 84 listing all les in a deb package . . . . . . . 713 listing all les in an rpm package . . . . . 716 listing all of a users processes . . . . . . . . . 42 listing all of the words in text . . . . . . . . 297 listing all processes on the system . . . . . . 42 listing all the links in a page . . . . . . . . . . 646 listing available groups . . . . . . . . . . . . . . . 163 listing available scanner devices . . . . . . . 443 listing available TEX fonts . . . . . . . . . . . . 398 listing available X fonts . . . . . . . . . . . . . . 397 listing deb packages . . . . . . . . . . . . . . . . . 710 listing dependences for a deb package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 listing dependences for an rpm package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 listing directories . . . . . . . . . . . . . . . . . . . . 133 listing directories in color . . . . . . . . . . . . 134 listing directories in columns . . . . . . . . . 138 listing directory tree graphs . . . . . . . . . . 156 listing le attributes . . . . . . . . . . . . . . . . . 136
Concept Index
767
listing le types . . . . . . . . . . . . . . . . . . . . . 135 listing les in sorted order . . . . . . . . . . . . 139 listing hidden les . . . . . . . . . . . . . . . . . . . 138 listing only the unique words in text . . 298 listing processes . . . . . . . . . . . . . . . . . . . . . . 41 listing processes by name or number . . . 43 listing relevant les in Emacs . . . . . . . . . 302 listing rpm packages . . . . . . . . . . . . . . . . . 715 listing subdirectories . . . . . . . . . . . . . . . . . 140 listing system activity . . . . . . . . . . . . . . . . . 41 listing text in binary les . . . . . . . . . . . . . 228 listing the antonyms of a word . . . . . . . . 285 listing the contents of a dos disk. . . . . . 525 listing the contents of a Macintosh disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 listing the contents of an archive . . . . . . 201 listing the current audio settings . . . . . . 464 listing the deb package a le is a part of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 listing the denitions of a word . . . . . . . 284 listing the groups a user belongs to . . . 164 listing the hypernyms of a word. . . . . . . 285 listing the jobs scheduled to run . . . . . . 557 listing the last time a user logged in . . . . 41 listing the members of a group . . . . . . . . 165 listing the Misspellings in text . . . . . . . . 276 listing the owner of a domain name . . . 688 listing the permissions of a le . . . . . . . . 168 listing the rpm package a le is a part of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 listing the synonyms of a word . . . . . . . . 284 listing the urls in text . . . . . . . . . . . . . . . 659 listing the usage of a tool. . . . . . . . . . . . . . 46 listing the words in text sorted alphabetically . . . . . . . . . . . . . . . . . . . 298 listing user activity . . . . . . . . . . . . . . . . . . . 39 listing variables . . . . . . . . . . . . . . . . . . . . . . . 80 listing when a le was last modied . . . 188 listing who is logged in to a system . . . 684 listing who is on and what theyre doing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 listing who is on the system . . . . . . . . . . . 39 listing words in text . . . . . . . . . . . . . . . . . 297 listing words that match a pattern . . . . 283
listing your cron jobs . . . . . . . . . . . . . . . 559 listing your current processes . . . . . . . . . . 42 listing your jobs . . . . . . . . . . . . . . . . . . . . . . 73 listing your print jobs . . . . . . . . . . . . . . . . 510 lists and data, using a directory for personal . . . . . . . . . . . . . . . . . . . . . . . . 728 listserv mailing lists . . . . . . . . . . . . . . . . 680 literal characters of text, displaying the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 literate programming . . . . . . . . . . . . . . . . 382 Lix formula . . . . . . . . . . . . . . . . . . . . . . . . . 289 Lo, Joseph . . . . . . . . . . . . . . . . . . . . . . . . . . 735 logging in to the system . . . . . . . . . . . . . . . 29 logging out of the system . . . . . . . . . . . . . . 31 logical pages . . . . . . . . . . . . . . . . . . . . . . . . 451 login group. . . . . . . . . . . . . . . . . . . . . . . . . . 163 logs, Web . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 lol . . . . . . . . . . . . . . . . . . . . . . . . 290, 292, 586 long line, typing a . . . . . . . . . . . . . . . . . . . . 66 long-style options . . . . . . . . . . . . . . . . . . . . . 37 lossy image formats . . . . . . . . . . . . . . . . . . 433 lp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 Lrzsz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 Lsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Lucid Emacs . . . . . . . . . . . . . . . . . . . . . . . . 232 lug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11, 737 lugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Lynch, Jack . . . . . . . . . . . . . . . . . . . . . . . . . 301 Lynx . . . . . . . . . 158, 253, 615, 637, 654, 658 Lynx, basic browsing keys for . . . . . . . . . 643 Lynx, saving a Web page from . . . . . . . . 645 Lynx, specifying key bindings in . . . . . . 648 Lynx, using . . . . . . . . . . . . . . . . . . . . . . . . . 643 Lynx, using with a mouse . . . . . . . . . . . . 648 LyX . . . . . . . . . . . . . . . . . . . 358, 375, 376, 390 LyX Documentation Project . . . . . . . . . . 381 LyX Graphical Tour . . . . . . . . . . . . . . . . . 381 LyX, getting started with . . . . . . . . . . . . 379 LyX, learning more about . . . . . . . . . . . . 381 LyX, using . . . . . . . . . . . . . . . . . . . . . . . . . . 378
768
M
m4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Mac OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Macintosh disk, copying les to and from a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Macintosh disk, deleting les on a. . . . . 528 Macintosh disk, formatting a . . . . . . . . . 529 Macintosh disk, listing the contents of a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 Macintosh disk, specifying . . . . . . . . . . . . 527 Macintosh disks, using . . . . . . . . . . . . . . . 527 macos . . . . . . . . . . . . . . . . . . . . . 131, 234, 525 macros, recording and running in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Magick Image Format File (miff) . . . . . 724 magnifying a portion of the X desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 MAIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82, 617 Mail and News, Mozilla . . . . . . . . . . . . . . 638 mail archives, searching . . . . . . . . . . . . . . 627 mail attachment, reading a . . . . . . . . . . . 628 mail attachment, sending a . . . . . . . . . . . 629 mail attachments, using . . . . . . . . . . . . . . 628 mail folder . . . . . . . . . . . . . . . . . . . . . . . . . . 622 mail folder, viewing a . . . . . . . . . . . . . . . . 622 mail headers, showing a list of . . . . . . . . 618 mail host, using a remote . . . . . . . . . . . . 621 mail notication, setting . . . . . . . . . . . . . 624 Mail Transport Agent (mta) . . . . . . . . . 621 mail user agent (mua) . . . . . . . . . . . . . . . 611 mail user agents, using other . . . . . . . . . 631 mail, composing . . . . . . . . . . . . . . . . . . . . . 616 mail, controlling how the shell checks . . . 82 mail, counting . . . . . . . . . . . . . . . . . . 584, 625 mail, deleting . . . . . . . . . . . . . . . . . . . . . . . 619 mail, electronic . . . . . . . . . . . . . . . . . . . . . . 611 mail, managing . . . . . . . . . . . . . . . . . . . . . . 622 Mail, Mozilla . . . . . . . . . . . . . . . . . . . . . . . . 634 mail, receiving. . . . . . . . . . . . . . . . . . . . . . . 617 mail, replying to . . . . . . . . . . . . . . . . . . . . . 620 mail, saving to a le . . . . . . . . . . . . . . . . . 620 mail, seeing who yours is from . . . . . . . . 626 mail, sending . . . . . . . . . . . . . . . . . . . . . . . . 612 mail, undeleting . . . . . . . . . . . . . . . . . . . . . 619
mail, using a directory for . . . . . . . . . . . . 728 mail, using mozilla for . . . . . . . . . . . . . . . 621 MAILCHECK . . . . . . . . . . . . . . . . . . . . . . . . 82, 87 mailing a directory . . . . . . . . . . . . . . . . . . 613 mailing a user on the same system . . . . 613 mailing a Web page . . . . . . . . . . . . . . . . . . 614 mailing les or the output of commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 maintaining a list of visited Web sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 maintenance mode, going into . . . . . . . . 705 make, rule les for . . . . . . . . . . . . . . . . . . . 366 making a boot oppy . . . . . . . . . . . . . . . . 702 making a chart or table . . . . . . . . . . . . . . 385 making a directory . . . . . . . . . . . . . . . . . . 130 making a directory tree . . . . . . . . . . . . . . 131 making a le archive . . . . . . . . . . . . . . . . . 200 making a le executable . . . . . . . . . . . . . . 170 making a le private . . . . . . . . . . . . . . . . . 169 making a le public . . . . . . . . . . . . . . . . . . 170 making a new Mozilla window . . . . . . . . 642 making a quick arithmetic calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 making a secure le copy to a remote host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 making a secure shell connection to a remote host . . . . . . . . . . . . . . . . . . . . . 677 making a shell script . . . . . . . . . . . . . . . . . . 85 making a typescript of a shell session . . . 88 making a user account . . . . . . . . . . . . . . . 717 making abbreviations in Emacs . . . . . . . 242 making an appointment le. . . . . . . . . . . 543 making an email signature . . . . . . . . . . . 631 making an empty le . . . . . . . . . . . . . . . . 130 making an image montage . . . . . . . . . . . . 430 making and managing print jobs . . . . . . 509 making cut-ups in Emacs. . . . . . . . . . . . . 593 making graphs with a single data set . . 575 making graphs with multiple data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577 making random word cut-ups . . . . . . . . . 592 making simple text cut-ups . . . . . . . . . . . 592 man page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 man page, preparing for printing . . . . . . 522
Concept Index
769
managing appointments . . . . . . . . . . . . . . 542 managing deb packages . . . . . . . . . . . . . . 709 managing le archives . . . . . . . . . . . . . . . . 199 managing les . . . . . . . . . . . . . . . . . . . . . . . 187 managing jobs . . . . . . . . . . . . . . . . . . . . . . . . 70 managing mail . . . . . . . . . . . . . . . . . . . . . . 622 managing rpm packages . . . . . . . . . . . . . . 714 managing software . . . . . . . . . . . . . . . . . . . 705 managing zip archives. . . . . . . . . . . . . . . . 533 Mandrake . . . . . . . . . . . . . . . . . . . . . . . 19, 731 manipulating PostScript documents . . . 456 manipulating PostScript pages . . . . . . . . 452 manipulating selections from sound les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 manipulating selections of text. . . . . . . . 253 manipulating X client windows . . . . . . . 105 manual feed tray . . . . . . . . . . . . . . . . . . . . 516 manual pages, reading . . . . . . . . . . . . . . . . 46 manual pages, searching . . . . . . . . . . . . . . . 44 Maplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 margin bell . . . . . . . . . . . . . . . . . . . . . . . . . 112 margins, adding to text . . . . . . . . . . . . . . 308 mark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Massachusetts Institute of Technology (mit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 master boot record, removing a . . . . . . . 702 matched lines, showing in their context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 matched patterns, showing only the . . . 347 matches, highlighting on their lines . . . 345 matches, showing in context . . . . . . . . . . 344 matching lines beginning with certain text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 matching lines ending with certain text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 matching lines in binary les . . . . . . . . . 350 matching lines in compressed les . . . . . 349 matching lines in many les . . . . . . . . . . 348 matching lines in Web pages . . . . . . . . . . 350 matching lines of a certain length . . . . . 339 matching lines that contain all of some regexps . . . . . . . . . . . . . . . . . . . . . . . . . 339 matching lines that contain any of some regexps . . . . . . . . . . . . . . . . . . . . . . . . . 339
matching lines that dont contain a regexp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 matching lines that only contain certain characters . . . . . . . . . . . . . . . . . . . . . . 340 matching lines, showing which les contain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 matching patterns of text . . . . . . . . . . . . 335 mathematics . . . . . . . . . . . . . . . . . . . . . . . . 561 mathematics tools, using other . . . . . . . 579 Matts icq clone (micq . . . . . . . . . . . . . . 694 maximizing an X window . . . . . . . . . . . . 106 Maxwell . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 mbr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 mcedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 measurement, converting an amount between units of . . . . . . . . . . . . . . . . . 567 members of a group, listing . . . . . . . . . . . 165 memory usage, displaying . . . . . . . . . . . . 720 menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 menu bar . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Merrill, David C. . . . . . . . . . . . . . . . . . . . . 733 message of the day . . . . . . . . . . . . . . . . . . . . 30 messages, counting how many you have . . . . . . . . . . . . . . . . . . . . . . . . . . . 584, 625 messages, denying to your terminal . . . 690 messages, sending to another users terminal . . . . . . . . . . . . . . . . . . . . . . . . 689 Messaging in the Emacs World (mew) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 meta keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 metafont . . . . . . . . . . . . . . . . . . . . . . . . . . 735 Metafont . . . . . . . . . . . . . . . . . . . . . . . 373, 404 a Metafont and TEX/L TEX Resource Page, The . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 mew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 mh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 mh-e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 micq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 micro-editing, text . . . . . . . . . . . . . . . . . . . 258 microphone, selecting . . . . . . . . . . . . . . . . 465 Microsoft Excel . . . . . . . . . . . . . . . . . . . . . . 536 Microsoft PowerPoint . . . . . . . . . . . . . . . . 536 Microsoft Windows . . . . . . . . . 129, 234, 357 Microsoft Word . . . . . . . . 129, 391, 525, 535
770
Microsoft Word les, converting . . . . . . 531 midi le, playing a . . . . . . . . . . . . . . . . . . . 467 Midnight Commander . . 157, 191, 223, 263, 268 Midnight Macros . . . . . . . . . . . . . . . . . . . . 378 miff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 Mille Bornes . . . . . . . . . . . . . . . . . . . . . . . . 584 mime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 628 minibuer. . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Minicom . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 minimizing an X window . . . . . . . . . . . . . 107 Minix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 minute of the hour, displaying the . . . . 538 Mirabilis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 mirroring an entire Web site . . . . . . . . . . 654 mistake, undoing at the command line . . 62 mit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 mixers, audio . . . . . . . . . . . . . . . . . . . . . . . . 463 mixing sound les together . . . . . . . . . . . 488 mod le, playing a . . . . . . . . . . . . . . . . . . . 469 modal editor . . . . . . . . . . . . . . . . . . . . . . . . 245 mode line . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 modem, calling out on a. . . . . . . . . . . . . . 606 modem, permitting user access to . . . . . 718 modes, Emacs . . . . . . . . . . . . . . . . . . . . . . . 234 monochrome, transforming color images to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 Monopoly . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 monospaced font . . . . . . . . . . . . . . . . . . . . 396 montages, making image . . . . . . . . . . . . . 430 Moon, getting the current phase of the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 Moonlight Creator . . . . . . . . . . . . . . . . . . . 438 Moonlight3d . . . . . . . . . . . . . . . . . . . . . . . . 438 More 2-Cent Tips . . . . . . . . . . . . . . . . . . . 733 morphing two images together . . . . . . . . 431 Morse code, ltering text into . . . . . . . . 584 Mosaic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638 motd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 mount point. . . . . . . . . . . . . . . . . . . . . . . . . 501 mount points, specifying for certain devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 mounting a data cd . . . . . . . . . . . . . . . . . 506 mounting a oppy disk . . . . . . . . . . . . . . . 504
mounting disks . . . . . . . . . . . . . . . . . . . . . . 501 mounting Windows and nt partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 mouse pointer . . . . . . . . . . . . . . . . . . . . . . . 105 mouse, using Lynx with a . . . . . . . . . . . . 648 mouse, using Mozilla with the . . . . . . . . 640 movie cameras, importing from . . . . . . . 438 movie scripts . . . . . . . . . . . . . . . . . . . . . . . . 380 moving an X window . . . . . . . . . . . . . . . . 106 moving around the desktop . . . . . . . . . . . 108 moving les and directories . . . . . . . . . . . 144 Mozilla . . . . . . . 160, 412, 514, 656, 658, 668 Mozilla Composer . . . . . . . . . . . . . . . . . . . 661 Mozilla Mail . . . . . . . . . . . . . . . . . . . . . . . . 634 Mozilla News . . . . . . . . . . . . . . . . . . . . . . . . 681 Mozilla, copying a link to the clipboard from . . . . . . . . . . . . . . . . . . . . . . . . . . . 642 Mozilla, copying an email address to the clipboard from . . . . . . . . . . . . . . . . . . 642 Mozilla, getting acquainted with . . . . . . 638 Mozilla, making a new window . . . . . . . 642 Mozilla, searching the source of a Web page in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 643 Mozilla, using . . . . . . . . . . . . . . . . . . . . . . . 638 Mozilla, using basic browsing keys with . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640 Mozilla, using for mail . . . . . . . . . . . . . . . 621 mp3 encoders. . . . . . . . . . . . . . . . . . . . . . . . 494 mp3 le, converting an . . . . . . . . . . . . . . . 494 mp3 le, displaying information about an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 mp3 le, playing an . . . . . . . . . . . . . . . . . . 469 mp3, playing streaming . . . . . . . . . . . . . . 470 mpeg video, viewing . . . . . . . . . . . . . . . . . 419 mta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 mua . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 muLinux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 Multi Gnome Terminal . . . . . . . . . . . . . . . 115 Multi Lingual TERMinal . . . . . . . . . . . . . 115 multics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Multipurpose Internet Mail Extensions (mime) . . . . . . . . . . . . . . . . . . . . . . . . . 628 multisession cd-rs, burning . . . . . . . . . . 482 Muss, Mike . . . . . . . . . . . . . . . . . . . . . . . . . 685
Concept Index
771
N
named pipe . . . . . . . . . . . . . . . . . . . . . . . . . 135 naming les and directories . . . . . . . . . . . 129 Nano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 National Weather Service, city codes for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Nautilus . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Navigator, Mozilla . . . . . . . . . . . . . . . . . . . 638 Navy, United States . . . . . . . . . . . . . 288, 700 nbd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Nedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 netbsd . . . . . . . . . . . . . . . . . . . . . . . . . . . 16, 92 Netizens: On the History and Impact of the Net . . . . . . . . . . . . . . . . . . . . . . . . . 736 netnews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 Netscape . . . . . . . . . . . . . . . . . . . . . . . 638, 656 network administration . . . . . . . . . . . . . . . 11 Network Time Protocol . . . . . . . . . . . . . . 538 Networking . . . . . . . . . . . . . . . . . . . . . . . . . 595 New York . . . . . . . . . . . . . . . . . . . . . . . . . . . 586 newbie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 newline characters, removing or replacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 news . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 news and commentary, Linux . . . . . . . . . 737 News Peruser . . . . . . . . . . . . . . . . . . . . . . . 682 News, Mozilla . . . . . . . . . . . . . . . . . . . . . . . 681 newsgroups . . . . . . . . . . . . . . . . . . . . . . . . . 679 newsgroups, nding for a topic . . . . . . . 682 newsreader, choosing a . . . . . . . . . . . . . . . 681 nextstep . . . . . . . . . . . . . . . . . . 117, 120, 121 nmh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 nn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 noise words . . . . . . . . . . . . . . . . . . . . . . . . . 301 nominal blackness . . . . . . . . . . . . . . . . . . . 395 nominal width . . . . . . . . . . . . . . . . . . . . . . . 396 non-interlaced image . . . . . . . . . . . . . . . . . 432 non-printing characters, displaying . . . . 217
non-printing characters, paginating text with . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 a Not So Short Introduction to L TEX, The . . . . . . . . . . . . . . . . . . . . . . . . . . . 376, 736 notication for new mail, setting . . . . . . 624 Novell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 nroff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 nroff-formatted text, viewing. . . . . . . . 224 nt partitions, mounting . . . . . . . . . . . . . . 529 ntfs lesystem . . . . . . . . . . . . . . . . . . . . . . 529 null device . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 null driver . . . . . . . . . . . . . . . . . . . . . . . . . . 467 null string . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 numbering lines of text. . . . . . . . . . . . . . . 326 numbers, converting . . . . . . . . . . . . . . . . . 567 numbers, listing a sequence of . . . . . . . . 565 numbers, recipe. . . . . . . . . . . . . . . . . . . . . . . . 3 numeral, converting an Arabic to English . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 numeric order, sorting text in . . . . . . . . . 322 Nvi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
O
OReilly & Associates . . . . . . . . . . . . . . . . 733 Object Chracter Recognition (ocr) . . . 449 Objective-C . . . . . . . . . . . . . . . . . . . . . . . . . 366 oblique font . . . . . . . . . . . . . . . . . . . . . . . . . 395 occurrences of something, counting the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 ocr, tools for . . . . . . . . . . . . . . . . . . . . . . . 449 Oetiker, Tobias . . . . . . . . . . . . . . . . . 376, 736 oset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 ogg audio, playing streaming . . . . . . . . . 467 ogg le, displaying information about an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 ogg le, encoding an . . . . . . . . . . . . . . . . . 495 Ogg le, playing an . . . . . . . . . . . . . . . . . . 466 ogg, converting to another format . . . . . 495 Ogle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Oleo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 Olympus Camedia . . . . . . . . . . . . . . . . . . . 449 online dictionaries, checking . . . . . . . . . . 285 Online GROFF Resources . . . . . . . . . . . . 734
772
online, going . . . . . . . . . . . . . . . . . . . . . . . . 597 open content . . . . . . . . . . . . . . . . . . . . . . . . . 21 Open Sound System (oss/free) . . 463, 467 open source . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Open Source Initiative (osi) . . . . . . . . . . . 21 open source, free content and the future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 openbsd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 OpenOce.org . . . . . . . . . . . . . . . . . . . . . . 392 openssh . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 OpenType . . . . . . . . . . . . . . . . . . . . . . . . . . 403 operating system . . . . . . . . . . . . . . . . . . . . . 15 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Optical Society of America (osa) . . . . . 380 options, displaying a tools available . . . . 37 options, long-style . . . . . . . . . . . . . . . . . . . . 37 Orwell, George . . . . . . . . . . . . . . . . . . . . . . 586 osa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 osi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 oss/free . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 oss/Free . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 other internet services. . . . . . . . . . . . . . . . 671 other things you can print . . . . . . . . . . . . 512 ouR CLOCK . . . . . . . . . . . . . . . . . . . . . . . . 554 ouR XVT . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 output, redirecting . . . . . . . . . . . . . . . . . . . . 68 output, redirecting to more than one place . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 outputting a random number . . . . . . . . . 565 outputting horizontal text fonts . . . . . . . 401 outputting multiple copies of text . . . . . 370 outputting selected pages of text . . . . . . 371 outputting text as a poster or sign . . . . 363 outputting text banners . . . . . . . . . . . . . . 402 outputting text in a dialect . . . . . . . . . . . 586 outputting text in a font . . . . . . . . . . . . . 361 outputting text in columns . . . . . . . . . . . 370 outputting text in custom pages . . . . . . 362 outputting text in landscape orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 outputting text in vertical slices . . . . . . 369 outputting text through a lter . . . . . . . 371 outputting text to PostScript . . . . . . . . . 359 outputting text with an underlay . . . . . 367
outputting text with fancy headers . . . . 368 outputting text with indentation . . . . . . 370 outputting text with language highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 overstrike-style underlining. . . . . . . 226, 327 overstriked text. . . . . . . . . . . . . . . . . . . . . . 330 owner, nding les in a directory tree by . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 ownership of a le, changing the . . . . . . 166 ownership of a le, determining the . . . 166 owning les . . . . . . . . . . . . . . . . . . . . . . . . . 166
P
packages, deb . . . . . . . . . . . . . . . . . . . . . . . . . 4 packages, installing for your Linux distribution . . . . . . . . . . . . . . . . . . . . . 707 packages, rpm . . . . . . . . . . . . . . . . . . . . . . . . . 4 page breaks, in text . . . . . . . . . . . . . . . . . . 312 page breaks, inserting in a text le . . . . 239 page, listing all the links in a . . . . . . . . . 646 pager . . . . . . . . . . . . . . . . . . . . . . . 96, 108, 211 pages, extracting from a PostScript le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 pages, logical . . . . . . . . . . . . . . . . . . . . . . . . 451 pages, outputting selected . . . . . . . . . . . . 371 pages, outputting text in custom . . . . . . 362 pages, Web. . . . . . . . . . . . . . . . . . . . . . . . . . 637 paginated columns, placing text in . . . . 314 paginating only part of some text . . . . . 315 paginating text . . . . . . . . . . . . . . . . . . . . . . 312 paginating text with non-printing characters . . . . . . . . . . . . . . . . . . . . . . 315 paginating with a custom page length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 paginating with a custom page width . . 313 paginating with custom headers . . . . . . 313 paging through a le . . . . . . . . . . . . . . . . . 213 paging through multiple les . . . . . . . . . 215 palindromes, nding in text . . . . . . . . . . 589 Palm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 PAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 panels, directory . . . . . . . . . . . . . . . . . . . . . 158 paper punch cards . . . . . . . . . . . . . . . . . . . 584
Concept Index
773
paper tape ribbons . . . . . . . . . . . . . . . . . . 585 parent directory . . . . . . . . . . . . . . . . . . . . . 125 parent directory, copying les by a unique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Pascal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 password, changing your . . . . . . . . . . . . . . 38 password, choosing a . . . . . . . . . . . . . . . . . . 29 password, shadow. . . . . . . . . . . . . . . . . . . . 717 pasting a selection into a sound le . . . 488 pasting columns of text from separate les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 pasting text . . . . . . . . . . . . . . . . . . . . . . . . . 254 patching a le with a dierence report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 PATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81, 87 path name . . . . . . . . . . . . . . . . . . . . . . . . . . 126 path, adding to your . . . . . . . . . . . . . . . . . . 81 pattern, nding all les that match a . . 171 patterns of text, matching . . . . . . . . . . . . 335 patterns, le name . . . . . . . . . . . . . . . . . . . 153 patterns, nding in certain places . . . . . 342 patterns, nding only in certain positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 patterns, keeping a le of. . . . . . . . . . . . . 348 pausing an audio cd . . . . . . . . . . . . . . . . . 478 pcd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 pdf le, preparing for printing . . . . . . . . 521 pdf le, previewing a . . . . . . . . . . . . . . . . 415 pdf, converting from . . . . . . . . . . . . . . . . . 521 pdf, converting to . . . . . . . . . . . . . . . . . . . 521 pdf, from PostScript input . . . . . . . . . . . 460 Pdksh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Pdmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Pement, Eric . . . . . . . . . . . . . . . . . . . . . . . . 735 Pencam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 penguin, the . . . . . . . . . . . . . . . . . . . . . . . . . 20 penguin, the Linux . . . . . . . . . . . . . . . . . . . 20 Perens, Bruce . . . . . . . . . . . . . . . . . . . . . . . . 21 perl . . . . . . . 85, 93, 145, 147, 366, 589, 735 permissions, changing . . . . . . . . . . . . . . . . 168 permissions, le . . . . . . . . . . . . . . . . . . . . . 167 permissions, listing . . . . . . . . . . . . . . . . . . 168
personal dictionary . . . . . . . . . . . . . . . . . . 277 perusing a text le . . . . . . . . . . . . . . . . . . . 213 perusing a text le from the bottom . . 214 perusing multiple text les . . . . . . . . . . . 215 perusing raw text . . . . . . . . . . . . . . . . . . . . 214 perusing text . . . . . . . . . . . . . . . . . . . . . . . . 211 perusing text with a prompt . . . . . . . . . . 213 perusing the dierences in a group of les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 pgp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 Phantasia . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 phase of the Moon, getting the current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 phase, adding to a sound le . . . . . . . . . 492 Phillips, Dave . . . . . . . . . . . . . . . . . . . . . . . 496 PhotoCD archives, browsing . . . . . . . . . . 415 PhotoCD image, converting a . . . . . . . . . 446 PhotoCD image, removing haze from . . 446 PhotoCD images, extracting . . . . . . . . . . 445 PhotoCD, Kodak . . . . . . . . . . . . . . . . . . . . 724 phrase, searching text for a . . . . . . . . . . . 334 phrases, checking text for misused . . . . 286 phrases, nding in text regardless of spacing . . . . . . . . . . . . . . . . . . . . . . . . . 343 piano-roll notation . . . . . . . . . . . . . . . . . . . 496 Picking Up Perl . . . . . . . . . . . . . . . . . . . . . 735 pico . . . . . . . . . . . . . . . . . . . . . . . . . . . 264, 269 pid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Piechart . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 Pig Latin, ltering text into . . . . . . . . . . 585 Pike, Rob . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 pine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 pipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 pipelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 pixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Pizzini, Ken . . . . . . . . . . . . . . . . . . . . . . . . . 735 PkTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 placing formfeeds in text . . . . . . . . . . . . . 316 placing text in paginated columns . . . . . 314 placing underlines in text . . . . . . . . . . . . 328 plain text les, searching more than . . . 348 plain text, converting Word to . . . . . . . . 533 Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
774
Plan 9 . . . . . . . . . . . . . . . . . . . . . . 94, 120, 271 plans, viewing . . . . . . . . . . . . . . . . . . . . . . . 683 Player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 playing a midi le . . . . . . . . . . . . . . . . . . . 467 playing a mod le . . . . . . . . . . . . . . . . . . . 469 playing a sound le . . . . . . . . . . . . . . . . . . 466 playing an audible time announcement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 playing an audio cd . . . . . . . . . . . . . . . . . 477 playing an mp3 le . . . . . . . . . . . . . . . . . . 469 playing an Ogg le . . . . . . . . . . . . . . . . . . 466 playing and recording sound . . . . . . . . . . 463 playing classic unix games . . . . . . . . . . . 583 playing streaming mp3 audio . . . . . . . . . 470 playing streaming ogg audio . . . . . . . . . . 467 plotting data . . . . . . . . . . . . . . . . . . . . . . . . 575 Plotutils . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 pnm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Point-to-Point Protocol (ppp) . . . . . . . . 598 pointer cursor . . . . . . . . . . . . . . . . . . . . . . . 112 points, PostScript . . . . . . . . . . . . . . . . . . . 363 pop mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 pop mail, fetching . . . . . . . . . . . . . . . . . . . 622 portable anymap (pnm) . . . . . . . . . . . . . . 444 Portable Document Format (pdf) . . . . . 451 posix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Post Oce Protocol (pop) . . . . . . . . . . . 621 postal codes . . . . . . . . . . . . . . . . . . . . . . . . . 291 posters, outputting from text . . . . . . . . . 363 PostScript. . . . . . . . . 366, 392, 403, 451, 735 PostScript document, arranging in a booklet . . . . . . . . . . . . . . . . . . . . . . . . . 458 PostScript document, resizing a . . . . . . . 456 PostScript documents, combining . . . . . 457 PostScript documents, manipulating . . 456 PostScript le, converting to fax format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 PostScript le, preparing for printing . . 518 PostScript le, previewing a . . . . . . . . . . 414 PostScript le, printing certain pages of a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 PostScript pages, arranging in signatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
PostScript pages, combining . . . . . . . . . . 454 PostScript pages, extracting from dvi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 PostScript pages, manipulating . . . . . . . 452 PostScript points . . . . . . . . . . . . . . . . . . . . 363 PostScript Utilities (psutils) . . . . . . . . . . 451 PostScript, converting. . . . . . . . . . . . . . . . 459 PostScript, converting to pdf . . . . . . . . . 460 PostScript, converting to plain text . . . 460 PostScript, extracting pages . . . . . . . . . . 452 PostScript, outputting text to . . . . . . . . 359 power, controlling to the system . . . . . . . 27 powering up the system . . . . . . . . . . . . . . . 27 powerpc . . . . . . . . . . . . . . . . . . . . . . . . 720, 732 PowerPoint, Microsoft . . . . . . . . . . . . . . . 536 PowerShell . . . . . . . . . . . . . . . . . . . . . . . . . . 115 ppp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598 ppp connection, starting a . . . . . . . . . . . . 600 ppp connection, stopping a . . . . . . . . . . . 600 ppp log, viewing the . . . . . . . . . . . . . . . . . 601 ppp, setting up . . . . . . . . . . . . . . . . . . . . . . 598 preparation of recipes . . . . . . . . . . . . . . . . . . 3 preparing a dvi le for printing . . . . . . . 520 preparing a manual page for printing . . 522 preparing a pdf le for printing . . . . . . 521 preparing a PostScript le for printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 preparing les for printing . . . . . . . . . . . . 518 preparing text for printing . . . . . . . . . . . 522 pressure-sensitive input devices . . . . . . . 450 Pretty Good Privacy (pgp) . . . . . . . . . . . 572 pretty-printing . . . . . . . . . . . . . . . . . . 225, 365 previewing a dvi le . . . . . . . . . . . . . . . . . 413 previewing a pdf le . . . . . . . . . . . . . . . . . 415 previewing a PostScript le . . . . . . . . . . . 414 previewing print les . . . . . . . . . . . . . . . . . 413 Price Watch . . . . . . . . . . . . . . . . . . . . . . . . . 733 prime factors, nding . . . . . . . . . . . . . . . . 567 prime numbers, outputting . . . . . . . . . . . 585 print les, previewing . . . . . . . . . . . . . . . . 413 print job, canceling a . . . . . . . . . . . . . . . . 511 print job, sending to the printer . . . . . . 510 print jobs, listing your . . . . . . . . . . . . . . . 510 print jobs, making and managing . . . . . 509
Concept Index
775
printer test strip, printing a . . . . . . . . . . 513 printer, setting up a . . . . . . . . . . . . . . . . . 703 printing . . . . . . . . . . . . . . . . . . . . . . . . 509, 510 printing a dvi le . . . . . . . . . . . . . . . . . . . . 515 printing a printer test strip . . . . . . . . . . . 513 printing a Web page . . . . . . . . . . . . . . . . . 514 printing an Emacs buer . . . . . . . . . . . . . 516 printing an image . . . . . . . . . . . . . . . . . . . . 514 printing an Info node . . . . . . . . . . . . . . . . 517 printing certain pages of a PostScript le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 printing multiple copies of a job . . . . . . 510 printing the contents of a terminal window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 printing, more recipes for. . . . . . . . . . . . . 512 printing, preparing les for . . . . . . . . . . . 518 private key . . . . . . . . . . . . . . . . . . . . . . . . . . 573 privileges, user . . . . . . . . . . . . . . . . . . . . . . . 28 process id (pid) . . . . . . . . . . . . . . . . . . . . . . 41 process, sleeping . . . . . . . . . . . . . . . . . . . . . . 41 process, zombie . . . . . . . . . . . . . . . . . . . . . . . 41 processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 processes, listing . . . . . . . . . . . . . . . . . . . . . . 41 processes, listing all of a users . . . . . . . . . 42 processes, listing all on the system . . . . . 42 processes, listing by name or number . . . 43 processes, listing your current. . . . . . . . . . 42 processing a groff le . . . . . . . . . . . . . . . 383 a processing a L TEX le . . . . . . . . . . . . . . . 374 processing a TEX le . . . . . . . . . . . . . . . . . 374 Procomm . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 productivity . . . . . . . . . . . . . . . . . . . . . . . . . 499 program, determining type of . . . . . . . . . 188 program, nding the location of a . . . . . 185 program, getting a description of a . . . . . 46 programs, starting in X . . . . . . . . . . . . . . 101 projects, using a directory for. . . . . . . . . 729 prompt, perusing text with a . . . . . . . . . 213 proportional font . . . . . . . . . . . . . . . . . . . . 396 proprietary formats, converting data from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 proprietary formats, converting text from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 proprietary software . . . . . . . . . . . . . . . 11, 16
Provins, Dean Allen . . . . . . . . . . . . . . . . . 734 PS1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80, 87 Psh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 psutils . . . . . . . . . . . . . . . . . . . . . . . . . 451, 459 psychoanalysis, undergoing . . . . . . . . . . . 594 public domain . . . . . . . . . . . . . . . . . . . . . . . . 17 public key. . . . . . . . . . . . . . . . . . . . . . . . . . . 573 punctuation, quoting . . . . . . . . . . . . . . . . . . . 9 Pure Data . . . . . . . . . . . . . . . . . . . . . . . . . . 497 putting a job in the background . . . . . . . 72 putting a job in the foreground . . . . . . . . 73 putting an image in the root window . . 410 Python . . . . . . . . . . . . . . . . . . . . . . . . . 263, 366
Q
QCad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 quantizing images . . . . . . . . . . . . . . . . . . . 427 Quarter Century of UNIX, A . . . . . . . . . 736 Quick Image Viewer . . . . . . . . . . . . . . . . . 419 QuickList . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 quiz games . . . . . . . . . . . . . . . . . . . . . . . . . . 583 quotations, displaying random . . . . . . . . 587 quotes, in le names . . . . . . . . . . . . . . . . . 132 quoting reserved characters . . . . . . . . . . . . 56 quoting, ansi-c . . . . . . . . . . . . . . . . . . . . . . . 60
R
Rand Mail Handling system (mh) . . . . . 635 RANDOM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 random lines, outputting . . . . . . . . . . . . . 585 random number, outputting a . . . . . . . . 565 range, character . . . . . . . . . . . . . . . . . . . . . 316 raw text, perusing . . . . . . . . . . . . . . . . . . . 214 rcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Rdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 read permission . . . . . . . . . . . . . . . . . . . . . 167 read-abbrev-le . . . . . . . . . . . . . . . . . . . . . . 243 readability, checking text for . . . . . . . . . . 288 Readers Workbench . . . . . . . . . . . . . . . . . 286 reading a mail attachment . . . . . . . . . . . . 628 reading a page from the system manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
776
reading an Info manual . . . . . . . . . . . . . . . 48 reading system documentation and help les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 reading the headers of a Web page . . . . 656 reading Usenet . . . . . . . . . . . . . . . . . . . . . . 679 receiving a fax. . . . . . . . . . . . . . . . . . . . . . . 603 receiving faxes automatically . . . . . . . . . 603 receiving mail . . . . . . . . . . . . . . . . . . . . . . . 617 recipe numbers . . . . . . . . . . . . . . . . . . . . . . . . 3 recipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 recipes, format of . . . . . . . . . . . . . . . . . . . . . . 4 recipes, preparation of . . . . . . . . . . . . . . . . . 3 recording a shell session . . . . . . . . . . . . . . . 88 recording a sound le . . . . . . . . . . . . . . . . 472 recording and running macros in Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 recording sound . . . . . . . . . . . . . . . . . . . . . 463 recording source, selecting an audio . . . 465 records, text . . . . . . . . . . . . . . . . . . . . . . . . 330 records, vinyl . . . . . . . . . . . . . . . . . . . . . . . . 474 Red Hat . . . . . . . . . . . . . . . . . . . . . . 4, 19, 731 redirecting error messages to a le . . . . . 68 redirecting input and output . . . . . . . . . . 67 redirecting input to a le . . . . . . . . . . . . . . 67 redirecting output to a le . . . . . . . . . . . . 68 redirecting output to another commands input . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 redirecting output to more than one place . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 redirecting something to nowhere . . . . . . 70 reference les, using . . . . . . . . . . . . . . . . . 289 reference, tools for . . . . . . . . . . . . . . . . . . . 275 references . . . . . . . . . . . . . . . . . . . . . . . . . . . 646 references for further interest . . . . . . . . . 731 referencing a variable . . . . . . . . . . . . . . . . . 78 referrers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 regexp, matching lines that dont contain a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 regexp, searching for in Emacs . . . . . . . . 353 regexps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 regexps, matching lines that contain all of some . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 regexps, matching lines that contain any of some . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
regexps, popular ones for common situations . . . . . . . . . . . . . . . . . . . . . . . 340 registry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 regular expressions. . . . . . . . . . . . . . . . . . . 335 relevancies, nding in texts . . . . . . . . . . . 301 Remembrance Agent . . . . . . . . . . . . . . . . . 302 Remind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 reminder tools, using other . . . . . . . . . . . 553 reminders . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 reminders, including holidays in your . . 544 reminding yourself of things . . . . . . . . . . 549 reminding yourself when you have to leave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 remote host, connecting to a. . . . . . . . . . 671 remote host, downloading a le from a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 remote host, making a secure le copy to a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 remote host, making a secure shell connection to a. . . . . . . . . . . . . . . . . . 677 remote host, suspending a connection with a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 remote host, terminating a connetion with a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 remote host, transferring les to and from a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 remote host, uploading a le to a . . . . . 675 removable storage . . . . . . . . . . . . . . . . . . . 501 removing a cron job. . . . . . . . . . . . . . . . . 558 removing a deb package . . . . . . . . . . . . . . 713 removing a le with a strange name . . . 149 removing a master boot record . . . . . . . 702 removing a variable . . . . . . . . . . . . . . . . . . . 79 removing an alias . . . . . . . . . . . . . . . . . . . . . 84 removing an rpm package . . . . . . . . . . . . 716 removing carriage return characters . . . 310 removing columns from text . . . . . . . . . . 324 removing les and directories . . . . . . . . . 149 removing les interactively . . . . . . . . . . . 150 removing les without verication . . . . 151 removing or replacing newline characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 removing PhotoCD haze . . . . . . . . . . . . . 446 removing underlines from text . . . . . . . . 329
Concept Index
777
renaming les . . . . . . . . . . . . . . . . . . . . . . . 144 renaming multiple les with the same extension . . . . . . . . . . . . . . . . . . . . . . . 147 rendered html . . . . . . . . . . . . . . . . . . . . . . 223 repeated words, checking text for . . . . . 288 repeating the last command you typed . . 62 replacing text . . . . . . . . . . . . . . . . . . . . . . . 351 replying to mail . . . . . . . . . . . . . . . . . . . . . 620 repository, rcs . . . . . . . . . . . . . . . . . . . . . . 202 Request For Comments (rfc) . . . . . . . . 291 rescue disk . . . . . . . . . . . . . . . . . . . . . . . . . . 702 ResellerRatings . . . . . . . . . . . . . . . . . . . . . . 733 resetting the terminal screen . . . . . . . . . . . 36 resizing a PostScript document . . . . . . . 456 resizing an X window . . . . . . . . . . . . . . . . 106 resizing the xterm font . . . . . . . . . . . . . . . 398 reverb, adding to a sound le . . . . . . . . . 490 reverse incremental search . . . . . . . . . . . . . 62 reverse-polish . . . . . . . . . . . . . . . . . . . . . . . 580 reverse-wraparound, in an xterm . . . . . . 112 reversing lines of text . . . . . . . . . . . . . . . . 330 reversing text . . . . . . . . . . . . . . . . . . . . . . . 330 reversing the audio in a sound le . . . . . 493 reversing the characters on lines . . . . . . 331 reviewing what you did today . . . . . . . . 552 Revision Control System (rcs) . . . . . . . 202 revision log, viewing a les . . . . . . . . . . . 205 revisions, tracking to a le . . . . . . . . . . . 202 Rexx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 rfc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 rfc822 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 rhyme, listing words that . . . . . . . . . . . . . 283 Rich Text Format (rtf) . . . . . 269, 390, 536 Riggle, David . . . . . . . . . . . . . . . . . . . . . . . 584 right-justifying text . . . . . . . . . . . . . . . . . . 311 ripping data from an audio cd . . . . . . . . 480 ripping mp3 . . . . . . . . . . . . . . . . . . . . . . . . . 494 ripple pattern . . . . . . . . . . . . . . . . . . . . . . . 513 Ritchie, Dennis . . . . . . . . . . . . . . . . . . . . . . . 15 rn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 Robbins, Arnold . . . . . . . . . . . . . . . . . . . . . 736 Robbins, Arnold D. . . . . . . . . . . . . . . . . . . 734 Rock Ridge . . . . . . . . . . . . . . . . . . . . . . . . . 483 roff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Rolodex . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 roman font . . . . . . . . . . . . . . . . . . . . . . . . . . 395 root . . . . . . . . . . . . . . . . . . . . 28, 167, 703, 717 root account . . . . . . . . . . . . . . . . . . . . . . . . 699 root directory . . . . . . . . . . . . . . . . . . . . . . . 125 root partition . . . . . . . . . . . . . . . . . . . . . . . 702 root prompt . . . . . . . . . . . . . . . . . . . . . . . . . . 53 root window. . . . . . . . . . . . . . . . . . . . . . . . . . 95 root window parameters, changing the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 root window, putting an image in the . . 410 Rosegarden . . . . . . . . . . . . . . . . . . . . . . . . . 497 rot13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 rot13 encryption, using . . . . . . . . . . . . . 569 rot13, decoding text in . . . . . . . . . . . . . . 571 rot13, encoding text in . . . . . . . . . . . . . . 570 rotating an image. . . . . . . . . . . . . . . . . . . . 425 rpm package, getting the status of an . . 716 rpm package, installing an. . . . . . . . . . . . 715 rpm package, listing all les in an . . . . . 716 rpm package, listing dependences for an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 rpm package, listing the one a le is a part of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 rpm package, removing an. . . . . . . . . . . . 716 rpm package, upgrading an . . . . . . . . . . . 715 rpm packages . . . . . . . . . . . . . . . . . . . . . 4, 707 rpm packages, listing . . . . . . . . . . . . . . . . 715 rpm packages, managing . . . . . . . . . . . . . 714 rtf . . . . . . . . . . . . . . . . . . . . . . . . 269, 390, 536 rtfb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 Run Up to date Linux Everywhere (rule) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 running a command . . . . . . . . . . . . . . . . . . 36 running a command in an X window . . 113 running a command in Vi . . . . . . . . . . . . 251 running a command on a delay . . . . . . . 555 running a command on a timer . . . . . . . 556 running a groff tutorial . . . . . . . . . . . . . 385 running a list of commands . . . . . . . . . . . . 63 running a program in X . . . . . . . . . . . . . . 101 running a shell in X . . . . . . . . . . . . . . . . . 109 running a shell script . . . . . . . . . . . . . . . . . 85
778
running a Vi tutorial. . . . . . . . . . . . . . . . . 247 running an Emacs tutorial. . . . . . . . . . . . 237 running commands on the les you nd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 running one command and then another . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 running one command or another . . . . . . 64 running shells . . . . . . . . . . . . . . . . . . . . . . . . 90 running X . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 running x clients automatically . . . . . . . 117 rute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 Rutten, Rob . . . . . . . . . . . . . . . . . . . . . . . . 377
S
sal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Salus, Peter H. . . . . . . . . . . . . . . . . . . . . . . 736 sampling from an audio cd . . . . . . . . . . . 480 sampling rate of a sound le, changing the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 sane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 Sanyo rmware . . . . . . . . . . . . . . . . . . . . . . 449 Savannah . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 saving a Web page from Lynx . . . . . . . . 645 saving mail to a le . . . . . . . . . . . . . . . . . . 620 Sc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 scaling image size . . . . . . . . . . . . . . . . . . . . 422 Scanner Access Now Easy (sane) . . . . . 443 scanner devices, listing . . . . . . . . . . . . . . . 443 scanner, testing. . . . . . . . . . . . . . . . . . . . . . 444 scanning an image . . . . . . . . . . . . . . . . . . . 444 scanning images . . . . . . . . . . . . . . . . . . . . . 443 Sced . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . 555 scheduling commands . . . . . . . . . . . . . . . . 557 Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 Scientic Applications on Linux (sal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 Scrabble . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 screen shot, taking in a console . . . . . . . 442 screen shots, in X . . . . . . . . . . . . . . . . . . . . 441 screen shots, taking . . . . . . . . . . . . . . . . . . 441 screen, clearing the . . . . . . . . . . . . . . . . 35, 54
screen, resetting the . . . . . . . . . . . . . . . . . . 36 Scribus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 scripts, movie . . . . . . . . . . . . . . . . . . . . . . . 380 scripts, shell . . . . . . . . . . . . . . . . . . . . . . . . . . 84 scroll bar . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 scrolling text in the console . . . . . . . . . . . . 34 searching and replacing in Emacs . . . . . 353 searching and replacing text . . . . . . . . . . 351 searching for a phrase in Emacs . . . . . . . 353 searching for a regexp in Emacs. . . . . . . 353 searching incrementally in Emacs . . . . . 352 searching mail archives . . . . . . . . . . . . . . . 627 searching more than plain text les . . . 348 searching text . . . . . . . . . . . . . . . . . . . . . . . 333 searching text for a phrase . . . . . . . . . . . 334 searching text for a word . . . . . . . . . . . . . 333 searching text in Emacs . . . . . . . . . . . . . . 352 searching text in Vi . . . . . . . . . . . . . . . . . . 354 searching the source of a Web page in Mozilla . . . . . . . . . . . . . . . . . . . . . . . . . 643 searching the text youre perusing. . . . . 354 searching through your browser history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657 searching through your command history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 seascape orientation, PostScript pages in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 second extended le system (e2fs) . . . . 504 SECONDS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 secure internet services, using . . . . . . . . . 676 security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 sed . . . . . . . . . . . . . . . . 85, 255, 297, 316, 346 SED, a Stream Editor . . . . . . . . . . . . . . . 735 SEDers Grab-Bag, The . . . . . . . . . . . . . . 735 seeing how long your shell has been running . . . . . . . . . . . . . . . . . . . . . . . . . . 82 seeing whats in a compressed le . . . . . 199 seeing which users exist on the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 seeing who your mail is from . . . . . . . . . 626 selecting an audio recording source . . . . 465 selecting an X font name . . . . . . . . . . . . . 397 selecting the typesetting system for a job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Concept Index
779
selections of text, manipulating . . . . . . . 253 sending a fax . . . . . . . . . . . . . . . . . . . . . . . . 601 sending a mail attachment . . . . . . . . . . . 629 sending a message to another users terminal . . . . . . . . . . . . . . . . . . . . . . . . 689 sending a print job to the printer . . . . . 510 sending mail . . . . . . . . . . . . . . . . . . . . . . . . 612 sending mail to a user on the same system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 sending text from the Web to standard output. . . . . . . . . . . . . . . . . . . . . . . . . . 646 sending yourself email reminders . . . . . . 550 Sendmail. . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 sentences, checking text for dicult . . . 289 sentences, checking text for long . . . . . . 289 sequence, key. . . . . . . . . . . . . . . . . . . . . . . . 237 sequencer, audio . . . . . . . . . . . . . . . . . . . . . 496 session, recording a . . . . . . . . . . . . . . . . . . . 88 setting notication for new mail . . . . . . 624 setting the console font . . . . . . . . . . . . . . 400 setting the system date and time . . . . . 700 setting up a printer . . . . . . . . . . . . . . . . . . 703 setting up a start page . . . . . . . . . . . . . . . 658 setting up hardware . . . . . . . . . . . . . . . . . 699 setting up ppp. . . . . . . . . . . . . . . . . . . . . . . 598 setting up your home directory . . . . . . . 727 Seyon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 sgml document syntax, checking. . . . . . 390 sgml document, writing an . . . . . . . . . . . 389 sgml, generating output from . . . . . . . . 390 sgml, using . . . . . . . . . . . . . . . . . . . . . . . . . 388 shadow password . . . . . . . . . . . . . . . . . . . . 717 shadow passwords . . . . . . . . . . . . . . . . . . . 163 sharing les . . . . . . . . . . . . . . . . . . . . . . . . . 163 Sheer, Paul . . . . . . . . . . . . . . . . . . . . . . . . . 733 sheet music, typesetting . . . . . . . . . . . . . . 391 shell prompt . . . . . . . . . . . . . . . . . . . . 6, 53, 54 shell prompt, changing the . . . . . . . . . . . . 80 shell redirection . . . . . . . . . . . . . . . . . . . . . . 67 shell script, installing a . . . . . . . . . . . . . . 708 shell script, making a . . . . . . . . . . . . . . . . . 85 shell script, running a . . . . . . . . . . . . . . . . . 85 shell scripts . . . . . . . . . . . . . . . . . . . . . . . . . . 86 shell scripts, using . . . . . . . . . . . . . . . . . . . . 84
shell session, making a typescript of a . . 88 shell variables, using . . . . . . . . . . . . . . . . . . 77 shell, changing your default . . . . . . . . . . . . 91 shell, dened . . . . . . . . . . . . . . . . . . . . . . . . . 30 shell, exiting a . . . . . . . . . . . . . . . . . . . . . . . . 91 shell, getting the name of your current . . 91 shell, running in X . . . . . . . . . . . . . . . . . . . 109 shell, seeing how long it has been running . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 shell, starting a . . . . . . . . . . . . . . . . . . . . . . . 90 shell, the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 shells, running . . . . . . . . . . . . . . . . . . . . . . . . 90 shells, using other . . . . . . . . . . . . . . . . . . . . 92 ShowImg. . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 showing a list of mail headers . . . . . . . . . 618 showing matched lines in their context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 showing matches in context . . . . . . . . . . 344 showing only the matched patterns from input . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 showing which les contain matching lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Showpicture . . . . . . . . . . . . . . . . . . . . . . . . . 419 shuing audio cd tracks . . . . . . . . . . . . . 479 shutdown, canceling a . . . . . . . . . . . . . . . . 704 shutting down at a certain time . . . . . . . 704 shutting down immediately . . . . . . . . . . . 703 shutting down the system . . . . . . . . . . . . 703 Sieb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 signature le . . . . . . . . . . . . . . . . . . . . . . . . 631 signatures, PostScript . . . . . . . . . . . . . . . . 455 signs, outputting from text . . . . . . . . . . . 363 simulation, Air Trac Controller . . . . . 583 single-spacing text . . . . . . . . . . . . . . . . . . . 306 Skencil. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 Skipstone . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 Slackware . . . . . . . . . . . . . . . . . . . . . 5, 19, 731 Slashdot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 sleeping process . . . . . . . . . . . . . . . . . . . . . . 41 slices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 slide show, viewing . . . . . . . . . . . . . . . . . . 417 slides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 slrn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
780
smog-Grading tests . . . . . . . . . . . . . . . . . . 289 snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Snd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463, 487 socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 Sodipodi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 soft links . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 software development . . . . . . . . . . . . . . . . . 11 software, managing . . . . . . . . . . . . . . . . . . 705 software, proprietary . . . . . . . . . . . . . . 11, 16 software, sources of . . . . . . . . . . . . . . . . . . 731 solitaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 something, redirecting to nowhere . . . . . . 70 sorted order, listing les in . . . . . . . . . . . 139 sorted text, viewing lines of . . . . . . . . . . 226 sorting text . . . . . . . . . . . . . . . . . . . . . . . . . 320 sorting text in directory order . . . . . . . . 322 sorting text in numeric order . . . . . . . . . 322 sorting text regardless of case . . . . . . . . . 321 sorting text regardless of spacing. . . . . . 321 sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 Sound and MIDI Software for Linux . . 732 sound driver . . . . . . . . . . . . . . . . . . . . . . . . 463 sound editors, using other . . . . . . . . . . . . 496 sound eects, applying . . . . . . . . . . . . . . . 488 SOund eXchange . . . . . . . 466, 472, 488, 493 sound le, cutting out part of a . . . . . . . 488 sound le, displaying information about a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 sound le, pasting a selection into a . . . 488 sound le, playing a . . . . . . . . . . . . . . . . . 466 sound le, recording a. . . . . . . . . . . . . . . . 472 sound le, reversing the audio in a . . . . 493 sound les, converting . . . . . . . . . . . . . . . 493 sound les, editing . . . . . . . . . . . . . . . . . . . 487 sound les, manipulating selections from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 sound les, mixing together . . . . . . . . . . 488 sound tools, using other . . . . . . . . . . . . . . 474 sound, playing and recording . . . . . . . . . 463 soundcard, permitting user access to . . 718 SoundTracker . . . . . . . . . . . . . . . . . . . . . . . 469 source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 source code . . . . . . . . . . . . . . . . . . . . . . . . . . 15
source code, html . . . . . . . . . . . . . . . . . . . 223 source le . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 source package, installing a . . . . . . . . . . . 707 SourceForge . . . . . . . . . . . . . . . . . . . . . . . . . 732 sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 sources of Linux software and hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 space and tab characters, swapping . . . 309 space, typing . . . . . . . . . . . . . . . . . . . . . . . . . . 7 spaces, eliminating extra in text . . . . . . 305 spaces, in a le name . . . . . . . . . . . . . . . . 131 spacing text . . . . . . . . . . . . . . . . . . . . . . . . . 305 spacing, nding phrases in text regardless of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 spacing, sorting text regardless of . . . . . 321 spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 Spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 special characters, inserting in Emacs . . 239 special characters, inserting in Vi . . . . . 251 special characters, listing . . . . . . . . . . . . . 228 specialized elds, using Linux with . . . . . 12 specifying a command from your history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 specifying attributes in an X window . . 105 specifying le names with patterns . . . . 153 specifying key bindings in Lynx . . . . . . . 648 specifying mount points for certain devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 specifying the Macintosh disk to use . . 527 specifying the output of a command as an argument . . . . . . . . . . . . . . . . . . . . . . . . 65 specifying window font . . . . . . . . . . . . . . . 104 specifying window size and location . . . 102 specifying X window border width . . . . 104 specifying X window colors . . . . . . . . . . . 103 specifying X window font. . . . . . . . . . . . . 104 specifying X window title . . . . . . . . . . . . 105 speech synthesis . . . . . . . . . . . . . . . . . . . . . 496 spell checking . . . . . . . . . . . . . . . . . . . . . . . 275 spell checking les . . . . . . . . . . . . . . . . . . . 276 spell checking in Emacs . . . . . . . . . . . . . . 280 spell checking, interactive . . . . . . . . . . . . 278 spelling, keeping a word list for . . . . . . . 277 Splay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
Concept Index
781
splitting a le into smaller ones . . . . . . . 189 spool queue . . . . . . . . . . . . . . . . . . . . . . . . . 509 spreadsheets, converting . . . . . . . . . . . . . . 536 sql . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 squeezing duplicate characters in text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 ssc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 staircase eect. . . . . . . . . . . . . . . . . . . . . . . 703 Stallman, Richard . . . . . . . . . . . . . . . . . . . . 16 standard error . . . . . . . . . . . . . . . . . . . . . . . . 67 Standard Generalized Markup Language (sgml) . . . . . . . . . . . . . . . . . . . . . . . . . 388 standard input . . . . . . . . . . . . . . . . . . . . . . . 67 standard output . . . . . . . . . . . . . . . . . . . 67, 68 StarOce . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 start menu . . . . . . . . . . . . . . . . . . . . . . . . . . 101 start page . . . . . . . . . . . . . . . . . . . . . . 638, 643 start page, setting up a . . . . . . . . . . . . . . 658 STARTFILE . . . . . . . . . . . . . . . . . . . . . . . . . . 659 starting a ppp connection . . . . . . . . . . . . 600 starting a shell . . . . . . . . . . . . . . . . . . . . . . . 90 starting X . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 startup les, using . . . . . . . . . . . . . . . . . . . . 86 states, denition les for . . . . . . . . . . . . 366 stereograms, ascii . . . . . . . . . . . . . . . . . . . 435 Stettner, Heidi . . . . . . . . . . . . . . . . . . . . . . 624 sticky windows . . . . . . . . . . . . . . . . . . . . . . 108 stopping a job . . . . . . . . . . . . . . . . . . . . . . . . 73 stopping a ppp connection . . . . . . . . . . . . 600 stopping an audio cd . . . . . . . . . . . . . . . . 479 stopping X . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 storage, disk . . . . . . . . . . . . . . . . . . . . . . . . 501 storm petrel . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Streamer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 streaming mp3, playing . . . . . . . . . . . . . . 470 streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 streams, text . . . . . . . . . . . . . . . . . . . . . . . . 255 strings, displaying the text between . . . 220 strings, text . . . . . . . . . . . . . . . . . . . . . . . . . 333 Strunk, William . . . . . . . . . . . . . . . . . . . . . 286 stv0680b-001 chip . . . . . . . . . . . . . . . . . . 450 style, checking . . . . . . . . . . . . . . . . . . . . . . . 288 subdirectories . . . . . . . . . . . . . . . . . . . . . . . 125
subdirectories, copying . . . . . . . . . . . . . . . 143 substitution, command . . . . . . . . . . . . . . . . 65 Suetonius . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 suites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Sun Microsystems . . . . . . . . . . . . . . . . . . . 451 sunsite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 superuser . . . . . . . . . . . . . . . . . . . . . . . . 28, 167 superuser account . . . . . . . . . . . . . . . . . . . 699 superuser prompt . . . . . . . . . . . . . . . . . . . . . 53 surng the Web . . . . . . . . . . . . . . . . . . . . . 637 SuSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 SuSE Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 19 suspending a connection with a remote host . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672 suspending a job. . . . . . . . . . . . . . . . . . . . . . 71 svg format . . . . . . . . . . . . . . . . . . . . . . . . . . 438 swapping tab and space characters . . . . 309 Sweetcode . . . . . . . . . . . . . . . . . . . . . . . . . . 732 switching between consoles . . . . . . . . . . . . 33 switching between video modes . . . . . . . 117 symbolic link . . . . . . . . . . . . . . . . . . . . . . . . 135 symbolic links . . . . . . . . . . . . . . . . . . . . . . . 152 symlinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 synergy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 synonyms, of words . . . . . . . . . . . . . . . . . . 284 Synopsys. . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 system activity, listing . . . . . . . . . . . . . . . . 41 system bell . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 system bell, controlling in X . . . . . . . . . . 119 system dictionary . . . . . . . . . . . . . . . . . . . . 275 system manual, reading a page from the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 system, controlling power to the . . . . . . . 27 system, displaying how long it has been up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 system, displaying information about the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 system, listing who is logged in to a . . . 684 system, listing who is on the . . . . . . . . . . . 39 system, logging in to the . . . . . . . . . . . . . . 29 system, logging out of the . . . . . . . . . . . . . 31 system, powering up the . . . . . . . . . . . . . . 27 system, shutting down immediately . . . 703 system, shutting down the . . . . . . . . . . . . 703
782
T
tab and space characters, swapping . . . 309 tab characters, showing . . . . . . . . . . . . . . 217 tab completion . . . . . . . . . . . . . . . . . . . 61, 149 Tab Window Manager (twm) . . . . . . . . 121 table, making a . . . . . . . . . . . . . . . . . . . . . . 385 taking a screen shot in a console . . . . . . 442 taking a screen shot in x . . . . . . . . . . . . . 441 taking screen shots . . . . . . . . . . . . . . . . . . 441 Talk Filters . . . . . . . . . . . . . . . . . . . . . . . . . 586 tape archive . . . . . . . . . . . . . . . . . . . . . . . . . 200 Tapiir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497 tarballs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 target le . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 TblA Program to Format Tables . . . . 734 tcl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 tcp/ip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Tcsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94, 367 techne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Ted. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Tektronix 4014 . . . . . . . . . . . . . . . . . . . . . . 109 telephone codes . . . . . . . . . . . . . . . . . . . . . 290 teletype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 television tuner output, viewing as ascii . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 Telix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 telling others you are away . . . . . . . . . . . 551 temporary les, using a directory for . . 729 tenex C shell . . . . . . . . . . . . . . . . . . . . . . . . 94 terminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 terminal emulator . . . . . . . . . . . . . . . . . . . 109 terminal emulators, using other . . . . . . . 114 terminal screen, clearing the . . . . . . . . . . . 35 terminal screen, resetting the . . . . . . . . . . 36 terminal window, getting in X . . . . . . . . 109 terminal window, printing the contents of a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 terminal, clearing the . . . . . . . . . . . . . . . . . 54 terminal, denying messages to your . . . 690 terminals, virtual . . . . . . . . . . . . . . . . . . . . . 32
terminating a connetion with a remote host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 testing a scanner . . . . . . . . . . . . . . . . . . . . 444 testing your typing speed. . . . . . . . . . . . . 587 Tetris . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 TEX . . . . . . . . . . 328, 358, 372, 458, 733, 735 a TEX and L TEX les, distinguishing between . . . . . . . . . . . . . . . . . . . . . . . . 373 TEX Catalogue Online . . . . . . . . . . . . . . . 377 TEX document templates, using. . . . . . . 376 TEX le, determining format of a . . . . . 373 TEX le, processing a . . . . . . . . . . . . . . . . 374 TEX font, viewing a sample of a . . . . . . 399 TEX fonts, listing available . . . . . . . . . . . 398 TEX fonts, using . . . . . . . . . . . . . . . . . . . . . 398 TEX, getting started with . . . . . . . . . . . . 375 TEX, using . . . . . . . . . . . . . . . . . . . . . . . . . . 372 TEXbook, The . . . . . . . . . . . . . . . . . . 372, 736 TEXnicians . . . . . . . . . . . . . . . . . . . . . . . . . . 373 Texinfo . . . . . . . . . . . . . . . . . . . . 358, 376, 392 text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 text banners, outputting . . . . . . . . . . . . . 402 text between strings, displaying the . . . 220 text cut-ups . . . . . . . . . . . . . . . . . . . . . . . . . 591 text cut-ups, making simple . . . . . . . . . . 592 text editor . . . . . . . . . . . . . . . . . . . . . . . . . . 231 text editors, using other . . . . . . . . . . . . . . 263 text le, perusing a . . . . . . . . . . . . . . . . . . 213 text le, perusing from the bottom . . . . 214 text les, converting between dos and Linux . . . . . . . . . . . . . . . . . . . . . . . . . . 530 text les, including . . . . . . . . . . . . . . . . . . 261 text les, perusing multiple . . . . . . . . . . . 215 text fonts, outputting horizontal . . . . . . 401 text fonts, using . . . . . . . . . . . . . . . . . . . . . 400 Text Processor for Typesetters, The . . 734 text, adding line breaks to. . . . . . . . . . . . 308 text, adding margins to . . . . . . . . . . . . . . 308 text, analyzing . . . . . . . . . . . . . . . . . . . . . . 293 text, appending to a le . . . . . . . . . . . . . . 258 text, center-justifying . . . . . . . . . . . . . . . . 312 text, changing characters in . . . . . . . . . . 317 text, checking for dicult sentences . . . 289 text, checking for doubled words . . . . . . 288
Concept Index
783
checking for long sentences . . . . . . 289 checking for misused phrases . . . . 286 checking for readability . . . . . . . . . 288 columnating . . . . . . . . . . . . . . . . . . . . 322 columnating from separate les . . 323 concatenating . . . . . . . . . . . . . . . . . . 256 converting from proprietary formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 a text, converting to L TEX . . . . . . . . . . . . . 393 text, converting underlines in . . . . . . . . . 328 text, counting . . . . . . . . . . . . . . . . . . . . . . . 293 text, counting a selection of . . . . . . . . . . 295 text, counting selected word occurrences in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 text, counting the characters in a . . . . . 294 text, counting the lines in a . . . . . . . . . . 294 text, counting the words in a . . . . . . . . . 294 text, counting word occurrences in . . . . 299 text, cutting . . . . . . . . . . . . . . . . . . . . . . . . 254 text, decoding in rot13 . . . . . . . . . . . . . . 571 text, deleting characters in . . . . . . . . . . . 318 text, determining if two dier . . . . . . . . . 191 text, displaying . . . . . . . . . . . . . . . . . . . . . . 216 text, displaying non-printing characters in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 text, displaying the beginning part of . . 218 text, displaying the end part of . . . . . . . 218 text, displaying the hex values of . . . . . 221 text, displaying the literal characters of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 text, displaying the middle part of . . . . 219 text, double-spacing . . . . . . . . . . . . . . . . . 307 text, editing streams of . . . . . . . . . . . . . . 255 text, eliminating extra spaces in . . . . . . 305 text, encoding in rot13 . . . . . . . . . . . . . . 570 text, ltering into Morse code . . . . . . . . 584 text, ltering into Pig Latin . . . . . . . . . . 585 text, ltering out duplicate lines of . . . . 319 text, nding anagrams in . . . . . . . . . . . . . 588 text, nding palindromes in . . . . . . . . . . 589 text, nding relevancies in . . . . . . . . . . . . 301 text, nding similar or relevant . . . . . . . 301 text, formatting . . . . . . . . . . . . . . . . . . . . . 305 text, from PostScript . . . . . . . . . . . . . . . . 460 text, text, text, text, text, text, text,
text, inserting at the beginning of a le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 text, justifying . . . . . . . . . . . . . . . . . . . . . . 311 text, left-justifying . . . . . . . . . . . . . . . . . . . 311 text, listing all of the words in . . . . . . . . 297 text, listing in binary les . . . . . . . . . . . . 228 text, listing only the unique words in . . 298 text, listing the Misspellings in . . . . . . . 276 text, listing the urls in . . . . . . . . . . . . . . 659 text, listing words in . . . . . . . . . . . . . . . . . 297 text, listing words sorted alphabetically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 text, manipulating selections of . . . . . . . 253 text, matching lines beginning with certain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 text, matching lines ending with certain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 text, matching patterns of . . . . . . . . . . . . 335 text, numbering lines of . . . . . . . . . . . . . . 326 text, outputting a visual image of . . . . . 362 text, outputting in a dialect . . . . . . . . . . 586 text, outputting in a font. . . . . . . . . . . . . 361 text, outputting in columns . . . . . . . . . . 370 text, outputting in custom pages . . . . . . 362 text, outputting in landscape orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 text, outputting in vertical slices . . . . . . 369 text, outputting multiple copies of . . . . 370 text, outputting selected pages of . . . . . 371 text, outputting through a lter . . . . . . 371 text, outputting to PostScript . . . . . . . . 359 text, outputting with an underlay . . . . . 367 text, outputting with fancy headers . . . 368 text, outputting with indentation . . . . . 370 text, outputting with language highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 text, overstriked . . . . . . . . . . . . . . . . . . . . . 330 text, paginating . . . . . . . . . . . . . . . . . . . . . 312 text, paginating only part of some . . . . 315 text, paginating with non-printing characters . . . . . . . . . . . . . . . . . . . . . . 315 text, pasting . . . . . . . . . . . . . . . . . . . . . . . . 254 text, perusing . . . . . . . . . . . . . . . . . . . . . . . 211 text, perusing raw . . . . . . . . . . . . . . . . . . . 214
784
text, placing formfeeds in . . . . . . . . . . . . 316 text, placing in paginated columns . . . . 314 text, placing underlines in . . . . . . . . . . . . 328 text, preparing for printing . . . . . . . . . . . 522 text, removing columns from . . . . . . . . . 324 text, removing underlines from . . . . . . . 329 text, reversing . . . . . . . . . . . . . . . . . . . . . . . 330 text, reversing lines of. . . . . . . . . . . . . . . . 330 text, right-justifying . . . . . . . . . . . . . . . . . 311 text, scrolling in the console . . . . . . . . . . . 34 text, searching and replacing . . . . . . . . . 351 text, searching for a phrase in . . . . . . . . 334 text, searching in Vi . . . . . . . . . . . . . . . . . 354 text, searching through . . . . . . . . . . . . . . 333 text, sending from the Web to standard output. . . . . . . . . . . . . . . . . . . . . . . . . . 646 text, single-spacing . . . . . . . . . . . . . . . . . . 306 text, sorting . . . . . . . . . . . . . . . . . . . . . . . . . 320 text, sorting in directory order . . . . . . . . 322 text, sorting in numeric order . . . . . . . . . 322 text, sorting regardless of case . . . . . . . . 321 text, sorting regardless of spacing . . . . . 321 text, spacing . . . . . . . . . . . . . . . . . . . . . . . . 305 text, squeezing duplicate characters in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 text, transposing characters in . . . . . . . . 316 text, triple-spacing. . . . . . . . . . . . . . . . . . . 307 text, underlining. . . . . . . . . . . . . . . . . . . . . 327 text, viewing . . . . . . . . . . . . . . . . . . . . . . . . 211 text, viewing html-formatted . . . . . . . . 223 text, viewing nroff-formatted. . . . . . . . 224 text, viewing special types of . . . . . . . . . 223 text, viewing underlined . . . . . . . . . . . . . . 226 text, writing to les . . . . . . . . . . . . . . . . . . 258 texts, nding the dierences between . . 192 Tgif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 the arrival of Linux . . . . . . . . . . . . . . . . . . . 18 the penguin . . . . . . . . . . . . . . . . . . . . . . . . . . 20 the shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 the World Wide Web . . . . . . . . . . . . . . . . 637 themes, desktop . . . . . . . . . . . . . . . . . . . . . 732 Third Mind, The . . . . . . . . . . . . . . . . . . . . 591 Thompson, Ken . . . . . . . . . . . . . . . . . . . . . . 15
three-nger salute . . . . . . . . . . . . . . . . . . . . 28 ti-30 calculator, emulating the . . . . . . . 581 tiffg3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 Tik . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 tilde escapes . . . . . . . . . . . . . . . . . . . . . . . . 616 time, audible output of the . . . . . . . . . . . 539 time, displaying the . . . . . . . . . . . . . . . . . . 537 time, managing extra . . . . . . . . . . . . . . . . 583 time, setting the system . . . . . . . . . . . . . . 700 time, shutting down at a certain . . . . . . 704 timer, running a command on a. . . . . . . 556 timestamp, displaying . . . . . . . . . . . . . . . . 188 timestamps, le . . . . . . . . . . . . . . . . . . . . . 189 title bar . . . . . . . . . . . . . . . . . . . . . 95, 106, 108 tk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Tkpaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 token, using a . . . . . . . . . . . . . . . . . . . . . . . 254 Toms Window Manager (twm) . . . . . . 121 tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 tool, displaying available options of a . . . 37 tool, displaying the version of a . . . . . . . . 38 tool, nding the location of a . . . . . . . . . 185 tool, nding the right one . . . . . . . . . . . . . 44 tool, listing the usage of a . . . . . . . . . . . . . 46 toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 tools philosophy, unix and the . . . . . . . . . 22 tools, guides for . . . . . . . . . . . . . . . . . . . . . 734 top node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 Torvalds, Linus . . . . . . . . . . . . . . . . . . . 18, 20 Touch Tones, generating . . . . . . . . . . . . . 608 tracing the path to another host . . . . . . 686 tracking revisions to a le . . . . . . . . . . . . 202 tracks, splitting. . . . . . . . . . . . . . . . . . . . . . 474 transferring les to and from a remote host . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 transforming images . . . . . . . . . . . . . . . . . 421 translating common acronyms . . . . . . . . 292 transparencies . . . . . . . . . . . . . . . . . . . . . . . 380 transposing characters . . . . . . . . . . . . . . . . 62 transposing characters in text . . . . . . . . 316 trashcan directory . . . . . . . . . . . . . . . . . . . 150 treble, adjusting . . . . . . . . . . . . . . . . . . . . . 463 tree graphs, of directories . . . . . . . . . . . . 156
Concept Index
785
triple-spacing text . . . . . . . . . . . . . . . . . . . 307 troff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 TrueType fonts . . . . . . . . . . . . . . . . . . . . . . 403 tty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 ttyl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Turbolinux . . . . . . . . . . . . . . . . . . . . . . . . . . 732 turning o the system . . . . . . . . . . . . . . . . . 27 turning text into an image . . . . . . . . . . . 447 Tux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 twm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 type, determining a programs . . . . . . . . 188 type, determining le . . . . . . . . . . . . . . . . 187 typescript, making a . . . . . . . . . . . . . . . . . . 88 typescripts . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 typesetting and word processing . . . . . . 357 typesetting sheet music . . . . . . . . . . . . . . 391 typesetting system, selecting. . . . . . . . . . 358 typesetting systems, using other . . . . . . 391 typing a control character . . . . . . . . . . . . . 55 typing a long line . . . . . . . . . . . . . . . . . . . . . 66 typing at the command line . . . . . . . . . . . 54 typing speed, testing your . . . . . . . . . . . . 587 typographical conventions . . . . . . . . . . . . . . 6
U
uid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 umax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 undeleting les . . . . . . . . . . . . . . . . . . . . . . 150 undeleting mail . . . . . . . . . . . . . . . . . . . . . . 619 undergoing psychoanalysis . . . . . . . . . . . . 594 underlay, outputting text with an . . . . . 367 underlined text, viewing . . . . . . . . . . . . . . 226 underlines, converting in text . . . . . . . . . 328 underlines, placing in text . . . . . . . . . . . . 328 underlines, removing from text . . . . . . . 329 underlining text . . . . . . . . . . . . . . . . . 239, 327 underlining, backspace . . . . . . . . . . . 226, 327 underlining, etext-style . . . . . . . . . . . . . . . 327 underlining, overstrike-style . . . . . . 226, 327 underscores . . . . . . . . . . . . . . . . . . . . . . . . . 646 Underwood, Rebecca. . . . . . . . . . . . . . . . . 736 undoing a mistake at the command line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Unicode . . . . . . . . . . . . . . . . . . . . . . . . 115, 263 unics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 uniform resource locator (url). . . . . . . . 637 uniform resource name (urn) . . . . . . . . . 134 Uniplex Information and Computing System (unics). . . . . . . . . . . . . . . . . . . 15 United States Navy . . . . . . . . . . . . . 288, 700 UnitedLinux . . . . . . . . . . . . . . . . . . . . . . . . 732 units of measurement, converting an amount between . . . . . . . . . . . . . . . . . 567 University of Southern California-Berkeley . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16, 624 University of Washington . . . . . . . . . . . . 269 unix . . . . . 16, 18, 92, 93, 286, 338, 357, 542 unix and Linux history books . . . . . . . . 736 unix and the tools philosophy . . . . . . . . . 22 UNIX Environment, The . . . . . . . . 286, 736 unix games, playing classic . . . . . . . . . . . 583 UNIX Programming Environment, The . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 unix, early days of . . . . . . . . . . . . . . . . . . . . 15 unmounting a data cd . . . . . . . . . . . . . . . 507 unmounting a oppy disk . . . . . . . . . . . . 505 Unrtf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 unused les, nding in a directory tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 unzipping les . . . . . . . . . . . . . . . . . . . . . . . 535 upgrading a deb package . . . . . . . . . . . . . 711 upgrading an rpm package . . . . . . . . . . . 715 uploading a le to a remote host . . . . . . 675 url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 url, downloading an . . . . . . . . . . . . . . . . . 654 urls, listing in text . . . . . . . . . . . . . . . . . . 659 urn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Usenet, reading . . . . . . . . . . . . . . . . . . . . . . 679 user account, making a . . . . . . . . . . . . . . . 717 user accounts . . . . . . . . . . . . . . . . . . . . . . . . . 28 user activity, listing . . . . . . . . . . . . . . . . . . . 39 user group le . . . . . . . . . . . . . . . . . . . . . . . 163 user groups, for Linux . . . . . . . . . . . . . . . . . 14 user id (uid) . . . . . . . . . . . . . . . . . . . . . . . . 717 user privileges . . . . . . . . . . . . . . . . . . . . . . . . 28 user, chatting directly with a . . . . . . . . . 690 user, checking whether one is online . . . 683
786
username . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 username, displaying your . . . . . . . . . . . . . 39 users, administrating . . . . . . . . . . . . . . . . . 717 users, chatting with on irc . . . . . . . . . . . 692 users, chatting with other . . . . . . . . . . . . 688 users, displaying information about . . . 683 users, listing those online . . . . . . . . . . . . . 684 users, listing what they are doing . . . . . . 40 users, listing when they last logged in . . 41 users, listing which are on . . . . . . . . . . . . . 39 users, seeing which exist on the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 using a calculator . . . . . . . . . . . . . . . . . . . . 562 using a directory for mail . . . . . . . . . . . . 728 using a directory for personal binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 using a directory for personal lists and data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 using a directory for projects . . . . . . . . . 729 using a directory for temporary les . . . 729 using a le with spaces in its name . . . . 131 using a remote mail host . . . . . . . . . . . . . 621 using a token . . . . . . . . . . . . . . . . . . . . . . . . 254 using alias words . . . . . . . . . . . . . . . . . . . . . 82 using audio cds . . . . . . . . . . . . . . . . . . . . . 477 using basic command line editing keys . . 54 using basic Emacs editing keys . . . . . . . 237 using basic Lynx browsing keys . . . . . . . 643 using basic Mozilla browsing keys . . . . . 640 using basic Vi editing keys . . . . . . . . . . . 248 using calendars . . . . . . . . . . . . . . . . . . . . . . 539 using command history . . . . . . . . . . . . . . . 74 using console fonts . . . . . . . . . . . . . . . . . . . 400 using consoles and terminals . . . . . . . . . . . 32 using contact managers . . . . . . . . . . . . . . 546 using data cds . . . . . . . . . . . . . . . . . . . . . . 506 using dictionaries . . . . . . . . . . . . . . . . . . . . 282 using dos and Windows disks . . . . . . . . 525 using Emacs . . . . . . . . . . . . . . . . . . . . . . . . 232 using le compression . . . . . . . . . . . . . . . . 196 using fonts . . . . . . . . . . . . . . . . . . . . . . . . . . 395 using gpg encryption . . . . . . . . . . . . . . . . 572 using groff . . . . . . . . . . . . . . . . . . . . . . . . 383 using im services . . . . . . . . . . . . . . . . . . . . . 694
using Lynx . . . . . . . . . . . . . . . . . . . . . . . . . . 643 using Lynx with a mouse . . . . . . . . . . . . . 648 using LyX . . . . . . . . . . . . . . . . . . . . . . . . . . 378 using Macintosh disks . . . . . . . . . . . . . . . . 527 using mail attachments . . . . . . . . . . . . . . 628 using Mozilla . . . . . . . . . . . . . . . . . . . . . . . . 638 using mozilla for mail . . . . . . . . . . . . . . . . 621 using other audio compact disc tools . . 484 using other communications tools . . . . . 608 using other cross-platform conversion tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 using other font tools . . . . . . . . . . . . . . . . 403 using other image editors . . . . . . . . . . . . . 435 using other image import tools . . . . . . . 449 using other image viewers . . . . . . . . . . . . 418 using other mail user agents . . . . . . . . . . 631 using other mathematics tools . . . . . . . . 579 using other reminder tools . . . . . . . . . . . . 553 using other shells . . . . . . . . . . . . . . . . . . . . . 92 using other sound editors . . . . . . . . . . . . . 496 using other sound tools . . . . . . . . . . . . . . 474 using other terminal emulators . . . . . . . 114 using other text editors . . . . . . . . . . . . . . 263 using other Web browsers . . . . . . . . . . . . 667 using other window managers. . . . . . . . . 120 using other word processors and typesetting systems . . . . . . . . . . . . . . 391 using popular regexps for common situations . . . . . . . . . . . . . . . . . . . . . . . 340 using reference les . . . . . . . . . . . . . . . . . . 289 using rot13 encryption . . . . . . . . . . . . . . 569 using secure internet services . . . . . . . . . 676 using sgml . . . . . . . . . . . . . . . . . . . . . . . . . . 388 using shell scripts . . . . . . . . . . . . . . . . . . . . . 84 using shell startup les . . . . . . . . . . . . . . . . 86 using shell variables . . . . . . . . . . . . . . . . . . . 77 using TEX. . . . . . . . . . . . . . . . . . . . . . . . . . . 372 a using TEX and L TEX document templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 using TEX fonts . . . . . . . . . . . . . . . . . . . . . 398 using text fonts . . . . . . . . . . . . . . . . . . . . . . 400 using the gimp . . . . . . . . . . . . . . . . . . . . . . 434 using the help facilities . . . . . . . . . . . . . . . . 43 using Vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Concept Index
787
V
V.E.R.A. . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 validating html . . . . . . . . . . . . . . . . . . . . . 665 variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 variable, assigning a . . . . . . . . . . . . . . . . . . 78 variable, displaying the contents of a . . . 79 variable, referencing a . . . . . . . . . . . . . . . . . 78 variable, removing a . . . . . . . . . . . . . . . . . . 79 variables, listing . . . . . . . . . . . . . . . . . . . . . . 80 variables, shell . . . . . . . . . . . . . . . . . . . . . . . . 80 vector graphics, convert bitmaps to . . . 436 verifying an email address . . . . . . . . . . . . 627 Verilog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 version of a tool, displaying. . . . . . . . . . . . 38 vertical slices, outputting text in . . . . . . 369 vfat lesystem . . . . . . . . . . . . . . . . . . . . . . 529 vhdl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 vhsic Hardware Description Language (vhdl) . . . . . . . . . . . . . . . . . . . . . . . . . 367 Vi . . . . 54, 211, 213, 231, 264, 328, 634, 648 Vi, customizing . . . . . . . . . . . . . . . . . . . . . . 252 Vi, getting acquainted with . . . . . . . . . . . 245 Vi, inserting command output in . . . . . 251 Vi, inserting special characters in . . . . . 251 Vi, running a command in. . . . . . . . . . . . 251 Vi, running a tutorial . . . . . . . . . . . . . . . . 247 Vi, searching text in . . . . . . . . . . . . . . . . . 354 Vi, using . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Vi, using basic editing keys . . . . . . . . . . . 248 Vibro-Champ eect, adding to a sound le . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 video editing . . . . . . . . . . . . . . . . . . . . . . . . 438 video modes, switching between . . . . . . 117 video4linux devices, capturing images from . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 VideoLAN . . . . . . . . . . . . . . . . . . . . . . . . . . 419 View Mail (vm) . . . . . . . . . . . . . . . . . . . . . 635 viewing a character set . . . . . . . . . . . . . . . 228 viewing a les revision log . . . . . . . . . . . 205
viewing a mail folder . . . . . . . . . . . . . . . . . 622 viewing a sample of a TEX font . . . . . . . 399 viewing a site that requires authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647 viewing an animation or slide show . . . 417 viewing an html selection . . . . . . . . . . . . 647 viewing an image from the Web. . . . . . . 651 viewing an image in a Web browser . . . 412 viewing an image in X . . . . . . . . . . . . . . . 407 viewing C program source code . . . . . . . 224 viewing html-formatted text . . . . . . . . . 223 viewing images . . . . . . . . . . . . . . . . . . . . . . 407 viewing lines of sorted text . . . . . . . . . . . 226 viewing multiple Emacs buers at once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 viewing nroff-formatted text . . . . . . . . 224 viewing special types of text . . . . . . . . . . 223 viewing text . . . . . . . . . . . . . . . . . . . . . . . . . 211 viewing the ppp log . . . . . . . . . . . . . . . . . . 601 viewing underlined text . . . . . . . . . . . . . . 226 viewing your browser history . . . . . . . . . 657 viewing your command history . . . . . . . . 74 viewport . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 vim. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271, 311 vinyl records . . . . . . . . . . . . . . . . . . . . . . . . 474 virtual console number, getting the . . . . 33 virtual consoles . . . . . . . . . . . . . . . . . . . . . . . 32 virtual desktop . . . . . . . . . . . . . . . . . . . . . . 108 Virtual Reality Modeling Language (vrml97) . . . . . . . . . . . . . . . . . . . . . . . 367 virtual terminals . . . . . . . . . . . . . . . . . . . . . . 32 Visual Basic for Applications . . . . . . . . . 367 visual bell . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 visual image directory. . . . . . . . . . . . . . . . 409 vm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 vm/cms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 volume level, changing the. . . . . . . . . . . . 465 volume of a sound le, changing . . . . . . 489 volume, adjusting . . . . . . . . . . . . . . . . . . . . 463 vrml97 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 vt102/220 terminal emulation . . . . . . . 109 Vuksan, Vladimir . . . . . . . . . . . . . . . . . . . . 597
788
W
W3m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668 Walker, A.N. . . . . . . . . . . . . . . . . . . . . 24, 736 Wanderlust . . . . . . . . . . . . . . . . . . . . . . . . . 636 WarGames . . . . . . . . . . . . . . . . . . . . . . . . . . 585 Warnock, John . . . . . . . . . . . . . . . . . . . . . . 451 warping images . . . . . . . . . . . . . . . . . . . . . . 439 Washington, George . . . . . . . . . . . . . . . . . . 29 watching a command from time to time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 Web browser . . . . . . . . . . . . . . . . . . . . . . . . 637 Web browser, viewing an image in a . . 412 Web browsers, using other . . . . . . . . . . . . 667 Web logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 666 Web page . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 Web page, mailing a . . . . . . . . . . . . . . . . . 614 Web page, printing a. . . . . . . . . . . . . . . . . 514 Web page, reading the headers of a . . . 656 Web page, saving from Lynx . . . . . . . . . 645 Web page, searching the source of a . . . 643 Web pages, matching lines in . . . . . . . . . 350 Web site, archiving an entire . . . . . . . . . 654 Web site, archiving part of a . . . . . . . . . 655 Web site, mirroring an entire . . . . . . . . . 654 Web sites, maintaining a history list of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 Web trac, analyzing your . . . . . . . . . . . 666 Web, accessing in Emacs . . . . . . . . . . . . . 649 Web, getting les from the . . . . . . . . . . . 653 Web, the . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 Web, viewing an image from the . . . . . . 651 weblog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656 what every Linux user knows . . . . . . . . . . 27 what this book wont show you . . . . . . . . 10 what to try rst . . . . . . . . . . . . . . . . . . . . . . 12 What You See Is What You Get (wysiwyg) . . . . . . . . . . . . . . . . . . . . . . 25 Whats GNU: Texinfo . . . . . . . . . . . . . . . . 736 Wheeler-Smith Index . . . . . . . . . . . . . . . . 289 who this book assumes you are . . . . . . . . . 9 wildcard character . . . . . . . . . . . . . . . . . . . 153 Williams, Peter . . . . . . . . . . . . . . . . . . . . . . . 20 Wily . . . . . . . . . . . . . . . . . . . . . . . . . . . 120, 271 Winamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
window border . . . . . . . . . . . . . . . . . . . 95, 105 window border width, specifying . . . . . . 104 window colors, specifying . . . . . . . . . . . . . 103 window font, specifying . . . . . . . . . . . . . . 104 window geometry . . . . . . . . . . . . . . . . . . . . 102 Window Maker . . . . . . . . . . . . . 115, 121, 554 window manager . . . . . . . . . . . . . . . . . . . . . 96 window managers, using other . . . . . . . . 120 window outline . . . . . . . . . . . . . . . . . . . . . . 106 window size and location, specifying . . 102 window title, specifying . . . . . . . . . . . . . . 105 window, deiconifying a . . . . . . . . . . . . . . . 107 window, destroying a . . . . . . . . . . . . . . . . 108 window, getting information about a . . 107 window, iconifying a . . . . . . . . . . . . . . . . . 107 window, maximizing a . . . . . . . . . . . . . . . 106 window, minimizing a . . . . . . . . . . . . . . . . 107 window, moving a . . . . . . . . . . . . . . . . . . . 106 window, resizing a . . . . . . . . . . . . . . . . . . . 106 window, specifying attributes in . . . . . . 105 Windows disk, using . . . . . . . . . . . . . . . . . 525 Windows key . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Windows partitions, mounting . . . . . . . . 529 windows, in Emacs . . . . . . . . . . . . . . . . . . 244 windows, manipulating . . . . . . . . . . . . . . . 105 Windows, Microsoft . . . . . . . . . . . . . 129, 357 windows, sticky. . . . . . . . . . . . . . . . . . . . . . 108 Wirzenius, Lars . . . . . . . . . . . . . . . . . . . . . 734 wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 wm2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Wmdate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 Woods, Don . . . . . . . . . . . . . . . . . . . . . . . . . 583 word games, nding matches for . . . . . . 588 word lists and helpful les, consulting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 word lists, for spelling . . . . . . . . . . . . . . . . 277 word processing . . . . . . . . . . . . . . . . . . . . . 357 word processors, using other . . . . . . . . . . 391 word search, in Emacs . . . . . . . . . . . . . . . 353 Word Wide Web Consortium . . . . . . . . . 667 a Word, converting to L TEX . . . . . . . . . . . 532 Word, converting to plain text . . . . . . . . 533 word, nding the correct spelling of a . . 275 word, listing the antonyms of a . . . . . . . 285
Concept Index
789
word, listing the denitions of a . . . . . . 284 word, listing the hypernyms of a . . . . . . 285 word, listing the synonyms of a . . . . . . . 284 Word, Microsoft . . . 129, 391, 525, 531, 535 word, searching text for a . . . . . . . . . . . . 333 WordNet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 WordPerfect . . . . . . . . . . . . . . . . . . . . 357, 536 words, counting in a text . . . . . . . . . . . . . 294 words, listing all in text . . . . . . . . . . . . . . 297 words, listing in text . . . . . . . . . . . . . . . . . 297 words, listing in text sorted alphabetically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 words, listing only the unique in text . . 298 words, listing that match a pattern . . . 283 WordStar . . . . . . . . . . . . . . . . . . . . . . . 231, 264 workbench . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 WorkBone . . . . . . . . . . . . . . . . . . . . . . . . . . 485 working in groups . . . . . . . . . . . . . . . . . . . 163 working with linux . . . . . . . . . . . . . . . . . . . . . 1 WorkMan . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 world readable les . . . . . . . . . . . . . . . . . . 170 World Wide Web (www) . . . . . . . . . . . . 637 world writable les . . . . . . . . . . . . . . . . . . 170 wraparound, in an xterm . . . . . . . . . . . . . 112 write permission . . . . . . . . . . . . . . . . . . . . . 167 write protection . . . . . . . . . . . . . . . . . . . . . 169 write-abbrev-le . . . . . . . . . . . . . . . . . . . . . 243 write-protecting a le . . . . . . . . . . . . . . . . 169 Writers Workbench (wwb) . . . . . . . 23, 286 writing an audio cd-r. . . . . . . . . . . . . . . . 482 writing an sgml document . . . . . . . . . . . 389 writing html . . . . . . . . . . . . . . . . . . . . . . . . 661 writing text to les . . . . . . . . . . . . . . . . . . 258 wstf Index . . . . . . . . . . . . . . . . . . . . . . . . . 289 wtf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 wvWare. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 wwb . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23, 286 www . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637 wysiwyg . . . . . . . . . . . . . . . . . . . . . . . . 25, 391 wysiwym . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
X
client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 clients, manipulating windows of . . . 105 clients, running automatically . . . . . . 117 desktop, magnifying a portion of the . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 X Display Manager . . . . . . . . . . . . . . . . . . . 98 X font name . . . . . . . . . . . . . . . . . . . . . . . . 395 X font name, selecting . . . . . . . . . . . . . . . 397 X font, displaying the characters in an . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 X fonts, listing available . . . . . . . . . . . . . . 397 X fonts, using . . . . . . . . . . . . . . . . . . . . . . . 395 X MultiMedia System (xmms) . . . . . . . . 475 X selection . . . . . . . . . . . . . . . . . . . . . . . . . . 397 X server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 X terminal behavior, changing the default . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 X terminals . . . . . . . . . . . . . . . . . . . . . . . . . . 95 X Window Dump les, viewing . . . . . . . 420 X Window System . . . . . . . . . . . . . . . . . . . . 95 X, conguring . . . . . . . . . . . . . . . . . . . . . . . 116 X, running . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 X, running a program in . . . . . . . . . . . . . 101 X, starting . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 X, stopping . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Xawtv-Tools . . . . . . . . . . . . . . . . . . . . . . . . 475 Xcal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 Xcalc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581 XCDRoast . . . . . . . . . . . . . . . . . . . . . . . . . . 485 Xchat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 Xcoral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 xedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Xedit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 XEmacs . . . . . . . . . . . . . . . 232, 273, 632, 649 Xg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 XFree86 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Xli . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 Xloadimage . . . . . . . . . . . . . . . . . . . . . . . . . 420 xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 xmms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Xmodem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 Xmorph . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 Xpaint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 X X X X
790
Z
Zawinski, Jamie . . . . . . . . . . . . . . . . . . . . . 592 ZenIRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 zicq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 Zinf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 zip archives, managing . . . . . . . . . . . . . . . 533 Zip codes . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 Zip drives . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 zipping les . . . . . . . . . . . . . . . . . . . . . . . . . 534 Zippy the Pinhead . . . . . . . . . . . . . . . . . . . 588 Zmodem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 zombie process . . . . . . . . . . . . . . . . . . . . . . . 41 zork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583 Zsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94, 367
Y
yanking text . . . . . . . . . . . . . . . . . . . . . . . . Yellow Dog. . . . . . . . . . . . . . . . . . . . . . . . . . ymmv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ymodem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 732 292 608