The Linux Cookbook
Total Page:16
File Type:pdf, Size:1020Kb
The Linux Cookbook Tips and Techniques for Everyday Use Michael Stutz 2nd Edition Completely Revised and Expanded 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 12345678910–04 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 benefit 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 effort has been made to include only the best free software recipes for accomplishing tasks in the easiest and most efficient manner, and they are believed to be correct. Suggestions, comments, and field 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 (Addison–Wesley, 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 gener- ate typeset output. The Texinfo input files 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 Rokicki’s Dvips, gnu Ghostscript, and Angus Duggan’s PostScript Utilities. The sys- tem 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 first to apply the “open source” methodology of Linux to non-software works, and was one of the first reporters to cover Linux and the free software movement in the mainstream press. He has used Linux exclusively for over a decade. v 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 The Linux Cookbook, 2nd Edition 29 Mathematics............................................... 561 30 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 Won’t 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. What Every Linux User Knows ............ 27 2.1 Controlling Power to the System .......................... 27 2.1.1 Powering Up the System......................... 27 2.1.2 Turning Off the System.......................... 27 2.2 Using Your Account ..................................... 28 2.2.1 Logging In to the System ........................ 29 2.2.2 Logging Out of the System ...................... 31 2.3 Using Consoles and Terminals ............................ 32 2.3.1 Getting the Virtual Console Number ............. 33 2.3.2 Switching Between Consoles ..................... 33 2.3.3 Scrolling Text in the Console..................... 34 2.3.4 Clearing the Terminal Screen .................... 35 2.3.5 Resetting the Terminal Screen ................... 36 viii The Linux Cookbook, 2nd Edition 2.4 Running a Command .................................... 36 2.4.1 Displaying a Tool’s Available Options ............ 37 2.4.2 Displaying the Version of a Tool.................. 38 2.5 Changing Your Password ................................. 38 2.6 Listing User Activity..................................... 39 2.6.1 Displaying Your Username ....................... 39 2.6.2 Listing Who Is on the System .................... 39 2.6.3 Listing Who Is on and What They’re Doing....... 40 2.6.4 Listing the Last Time a User Logged In........... 41 2.7 Listing Processes ........................................ 41 2.7.1 Listing Your Current