1. Trang chủ
  2. » Công Nghệ Thông Tin

Hệ điều hành linux (p1)

30 133 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 1,58 MB

Nội dung

ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > A Practical Guide to Linux® Commands, Editors, and Shell Programming By Mark G Sobell Publisher: Prentice Hall PTR Pub Date: July 01, 2005 ISBN: 0-13-147823-0 Pages: 1008 Table of Contents | Index The essential reference for core commands that Linux users need daily, along with superior tutorial on shell programming and much moreSystem administrators, software developers, quality assurance engineers and others working on a Linux system need to work from the command line in order to be effective Linux is famous for its huge number of command line utility programs, and the programs themselves are famous for their large numbers of options, switches, and configuration files But the truth is that users will only use a limited (but still significant) number of these utilities on a recurring basis, and then only with a subset of the most important and useful options, switches and configuration files This book cuts through all the noise and shows them which utilities are most useful, and which options most important And it contains examples, lot's and lot's of examples This is not just a reprint of the man pages And Linux is also famous for its "programmability." Utilities are designed, by default, to work wtih other utilities within shell programs as a way of automating system tasks This book contains a superb introduction to Linux shell programming And since shell programmers need to write their programs in text editors, this book covers the two most popular ones: vi and emacs < Day Day Up > Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > A Practical Guide to Linux® Commands, Editors, and Shell Programming By Mark G Sobell Publisher: Prentice Hall PTR Pub Date: July 01, 2005 ISBN: 0-13-147823-0 Pages: 1008 Table of Contents | Index Copyright Praise for Mark Sobell's Books Preface Command line interface (CLI) Linux distributions Overlap Audience Benefits Features Of This Book Contents Supplements Thanks Chapter Welcome to Linux Free beer The Gnu–Linux Connection The Heritage of Linux: Unix What is so good about linux? Overview of Linux Additional Features of Linux Chapter Summary Exercises Part I The Linux Operating System Chapter Getting Started Conventions Used in This Book Logging In Working with the Shell Curbing Your Power: Superuser Access Getting the Facts: Where to Find Documentation More About Logging In Chapter Summary Exercises Advanced Exercises Chapter Command Line Utilities Special Characters Basic Utilities Working with Files Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html | (Pipe): Communicates Between Processes Four More Utilities Compressing and Archiving Files Locating Commands Obtaining User and System Information Communicating with Other Users Email Chapter Summary Exercises Advanced Exercises Chapter The Linux Filesystem The Hierarchical Filesystem Directory and Ordinary Files Working with Directories touch Access peremissions Links Chapter summary Exercises ADVANCED EXERCISES Chapter The Shell The Command Line Standard Input and Standard Output Running a Program in the Background Filename Generation/Pathname Expansion Builtins Chapter Summary Exercises Advanced Exercises Part II The Editors Chapter The vim Editor History Tutorial: Creating and Editing a File with vim The compatible Parameter Introduction to vim Features Command Mode: Moving the Cursor Input Mode Command Mode: Deleting and Changing Text Searching and Substituting Miscellaneous Commands Yank, Put, and Delete Commands Reading and Writing Files Setting Parameters Advanced Editing Techniques Units of Measure Chapter Summary Exercises Advanced Exercises Chapter The emacs Editor History Tutorial: Getting Started with emacs Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Basic Editing Commands Online Help Advanced Editing Language-Sensitive Editing More Information Chapter Summary Exercises Advanced Exercises Part III THE SHELLS Chapter The Bourne Again Shell Background Shell Basics Parameters and Variables Processes History Aliases Functions Controlling bash Features and Options Processing The Command Line Chapter Summary Exercises Advanced Exercises Chapter The Tc Shell Assignment statement Part IV Programming Tools Chapter 10 Programming Tools Programming In C Using Shared Libraries make: Keeps a Set of Programs Current Debugging C Programs Threads System Calls Source Code Management Chapter Summary Exercises Advanced Exercises Chapter 11 Programming The Bourne Again Shell Control Structures file Descriptors Parameters And Variables Builtin Commands Expressions Shell Programs Chapter Summary Exercises Advanced Exercises Chapter 12 The gawk Pattern Processing Language Syntax Arguments Options Notes Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Language Basics Examples Error Messages Chapter Summary Exercises Advanced Exercises Chapter 13 The sed Editor Syntax Arguments Options Editor Basics Examples Chapter Summary Exercises Part V Command Reference Command Reference Utilities That Display and Manipulate Files Network Utilities Utilities That Display and Alter Status Utilities That Are Programming Tools Miscellaneous Utilities Standard Multiplicative Suffixes Common Options The sample Utility Part VI Appendixes Appendix A Regular Expressions Characters Delimiters Simple Strings Special Characters Rules Bracketing Expressions The Replacement String Extended Regular Expressions Appendix Summary Appendix B Help Solving A Problem Finding Linux-Related Information Specifying a Terminal Appendix C Keeping The System Up-To-Date yum: Updates And Installs Packages APT: An Alternative To yum BitTorrent Glossary Index < Day Day Up > Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Copyright Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests For more information, please contact: U.S Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the U.S., please contact: International Sales international@pearsoned.com Visit us on the Web: www.phptr.com Library of Congress Cataloging-in-Publication Data Sobell, Mark G A Practical Guide to Linux Commands, Editors, and Shell Programming / Mark G Sobell p cm Includes bibliographical references and index ISBN 0-13-147823-0 (alk paper) Linux Operating systems (Computers) I Title QA76.76.O63.S59483 2005 005.4'46—dc22 2005050051 Copyright © 2005 Mark Sobell All rights reserved Printed in the United States of America This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department One Lake Street Upper Saddle River, NJ 07458 Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts First printing, June 2005 Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Praise for Mark Sobell's Books "I keep searching for books that collect everything you want to know about a subject in one place, and keep getting disappointed Usually the books leave out some important topic, while others go too deep in some areas and must skim lightly over the others A Practical Guide to Red Hat® Linux® is one of those rare books that actually pulls it off Mark G Sobell has created a single reference for Red Hat Linux that cannot be beat! This marvelous text (with a 4-CD set of Linux Fedora Core included) is well worth the price This is as close to an "everything you ever needed to know" book that I've seen It's just that good and rates out of 5." —Ray Lodato Slashdot contributor "Mark Sobell has written a book as approachable as it is authoritative." —Jeffrey Bianchine Advocate, Author, Journalist "Excellent reference book, well suited for the sysadmin of a linux cluster, or the owner of a PC contemplating installing a recent stable linux Don't be put off by the daunting heft of the book Sobell has striven to be as inclusive as possible, in trying to anticipate your system administration needs." —Wes Boudville Inventor "A Practical Guide to Red Hat® Linux® is a brilliant book Thank you Mark Sobell." —C Pozrikidis University of California at San Diego "This book presents the best overview of the Linux operating system that I have found [It] should be very helpful and understandable no matter what the reader's background is: traditional UNIX user, new Linux devotee, or even Windows user Each topic is presented in a clear, complete fashion and very few assumptions are made about what the reader knows The book is extremely useful as a reference, as it contains a 70-page glossary of terms and is very well indexed It is organized in such a way that the reader can focus on simple tasks without having to wade through more advanced topics until they are ready." —Cam Marshall Marshall Information Service LLC Member of Front Range UNIX Users Group [FRUUG] Boulder, Colorado "Conclusively, this is THE book to get if you are a new Linux user and you just got into RH/Fedora world There's no other book that discusses so many different topics and in such depth." —Eugenia Loli-Queru Editor in Chief OSNews.com < Day Day Up > Page 10 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Audience This book is designed for a wide range of readers It does not require programming experience, although some experience using a general-purpose computer is helpful It is appropriate for the following readers:    Students taking a class in which they use Linux   Power users who want to explore the power of Linux from the command line   Professionals who use Linux at work  System administrators who need a deeper understanding of Linux and the tools that are available to them    Computer science students who are studying the Linux operating system   Programmers who need to understand the Linux programming environment  Technical executives who want to get a grounding in Linux < Day Day Up > Page 16 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Benefits A Practical Guide to Linux® Commands, Editors, and Shell Programming gives you an in-depth understanding of how to use Linux from the command line Regardless of your background, it offers the knowledge you need to get on with your work: You will come away from this book understanding how to use Linux, and this text will remain a valuable reference for years to come < Day Day Up > Page 17 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 18 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Features Of This Book This book is organized for ease of use in different situations For example, you can read it from cover to cover to learn command line Linux from the ground up Alternatively, once you are comfortable using Linux, you can use this book as a reference: Look up a topic of interest in the table of contents or index and read about it Or, refer to one of the utilities covered in Part V, "Command Reference." You can also think of this book as a catalog of Linux topics: Flip through the pages until a topic catches your eye The book also includes many pointers to Web sites where you can get additional information: Consider the Web an extension of this book A Practical Guide to Linux® Commands, Editors, and Shell Programming offers the following features:   Optional sections allow you to read the book at different levels, returning to more difficult material when you are ready to tackle it   Caution boxes highlight procedures that can easily go wrong, giving you guidance before you run into trouble   Tip boxes highlight places in the text where you can save time by doing something differently or when it may be useful or just interesting to have additional information    Security boxes point out ways that you can make a system more secure  The Supporting Web site at www.sobell.com includes corrections to the book, downloadable examples from the book, pointers to useful Web sites, and answers to even-numbered exercises    Concepts are illustrated by practical examples found throughout the book  The many useful URLs (Internet addresses) identify sites where you can obtain software and information    Chapter summaries review the important points covered in each chapter  Review exercises are included at the end of each chapter for readers who want to hone their skills Answers to even-numbered exercises are available at www.sobell.com   Important GNU tools, including gcc, gdb, GNU Configure and Build System, make, gzip, and many others, are described in detail   Pointers throughout the book provide help in obtaining online documentation from many sources, including the local system and the Internet Page 19 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 20 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 21 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Contents This section describes the information that each chapter covers and explains how that information can help you take advantage of the power of Linux You may want to review the table of contents for more detail   Chapter Welcome to Linux Presents background information on Linux This chapter covers the history of Linux, explains how the GNU Project helped Linux get started, and discusses some of Linux's important features that distinguish it from other operating systems Part I: The Linux Operating System tip: Experienced users may want to skim Part I If you have used a UNIX/Linux system before, you may want to skim or skip some or all of the chapters in Part I All readers should take a look at " Conventions Used in This Book" (page 22), which explains the typographic conventions that this book uses, and "Getting the Facts: Where to Find Documentation" (page 29), which points you toward both local and remote sources of Linux documentation Part I introduces Linux and gets you started using it   Chapter Getting Started Explains the typographic conventions that this book uses to make explanations clearer and easier to read This chapter provides basic information and explains how to log in, change your password, give Linux commands using the shell, and find system documentation   Chapter Command Line Utilities Explains the command line interface (CLI) and briefly introduces more than 30 command line utilities Working through this chapter gives you a feel for Linux and introduces some of the tools you will use day in and day out The utilities covered in this chapter include o o grep, which searches through files for strings of characters; o o unix2dos, which converts Linux text files to Windows format; o o tar, which creates archive files that can hold many other files; o o bzip2 and gzip, which compress files so that they take up less space on disk and allow you to transfer them over a network more quickly; and o o diff, which displays the differences between two text files   Chapter The Linux Filesystem Discusses the Linux hierarchical filesystem, covering files, Page 22 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 23 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Supplements The author's home page (www.sobell.com) contains downloadable listings of the longer programs from this book as well as pointers to many interesting and useful Linux-related sites on the World Wide Web, a list of corrections to the book, answers to even-numbered exercises, and a solicitation for corrections, comments, and suggestions < Day Day Up > Page 24 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 25 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html Thanks First and foremost I want to thank my editor at Prentice Hall PTR, Mark L Taub, who encouraged me and kept me on track Mark is unique in my experience: He is an editor who works with the tools I am writing about Because Mark runs Linux on his home computer, we could share experiences as I wrote His comments and direction were invaluable Thank you, Mark T A big "Thank You" to the folks who read through the drafts of the book and made comments that caused me to refocus parts of the book where things were not clear or were left out altogether: Lars Kellogg-Stedman, Harvard University; Jim A Lola, Principal Systems Consultant, Privateer Systems, LLC; Eric S Raymond, cofounder, Open Source Initiative; Scott Mann; Randall Lechlitner, Independent Computer Consultant; Jason Wertz, Computer Science Instructor, Montgomery County Community College; Justin Howell, Solano Community College; Ed Sawicki, The Accelerated Learning Center; David Mercer, Contechst; Jeffrey Bianchine, Advocate, Author, Journalist; John Kennedy; Chris Karr; and Jim Dennis, Starshine Technical Services Thanks to Molly Sharp of ContentWorks, the production manager who made sure the book came together as it was supposed to, and to Jill Hobbs, the copy editor who kept the various parts of the English language in their proper relative places Thanks also to the folks at Prentice Hall PTR who helped bring this book to life: Heather Fox, Publicist; Suzette Ciancio, Marketing Manager; Robin O'Brien, Executive Marketing Manager; Julie Nahil, Full-Service Production Manager; Noreen Regina, Editorial Assistant; and everyone else who worked behind the scenes to make this book happen I am also indebted to Denis Howe, the editor of The Free On-Line Dictionary of Computing (FOLDOC) Dennis has graciously permitted me to use entries from his compilation Be sure to visit the dictionary (www.foldoc.org) Dr Brian Kernighan and Rob Pike graciously allowed me to reprint the bundle script from their book, The UNIX Programming Environment (Prentice Hall, 1984) Parts of A Practical Guide to Linux® Commands, Editors, and Shell Programming have grown from my previous Linux books and I want to thank the people who helped with those books Thank you to David Chisnall, computer scientist extraordinaire; Carsten Pfeiffer, Software Engineer and KDE Developer; Aaron Weber, Ximian; Matthew Miller, Boston University; Cristof Falk, Software Developer at CritterDesign; Scott Mann, IBM, Systems Managment and Integration Professional; Steve Elgersma, Computer Science Department, Princeton University; Scott Dier, University of Minnesota; and Robert Haskins, Computer Net Works Thanks also to Dustin Puryear, Puryear Information Technology; Gabor Liptak, Independent Consultant; Bart Schaefer, Chief Technical Officer, iPost; Michael J Jordan, Web Developer, Linux Online Inc.; Steven Gibson, owner of SuperAnt.com; John Viega, founder and Chief Scientist, Secure Software, Inc.; K Rachael Treu, Internet Security Analyst, Global Crossing; Kara Pritchard, K & S Pritchard Enterprises, Inc.; Glen Wiley, Capitol One Finances; Karel Baloun, Senior Software Engineer, Looksmart, Ltd.; Matthew Whitworth; Dameon D Welch-Abernathy, Nokia Systems; Josh Simon, Consultant; Stan Isaacs; and Dr Eric H Herrin II, Vice President, Herrin Software Development, Inc And thanks to Doug Hughes, long-time system designer and administrator, who gave me a big hand with the sections on system administration, networks, the Internet, and programming More thanks go to consultants Lorraine Callahan and Steve Wampler; Ronald Hiller, Graburn Technology, Inc.; Charles A Plater, Wayne State University; Bob Palowoda; Tom Bialaski, Sun Microsystems; Roger Hartmuller, TIS Labs at Network Associates; Kaowen Liu; Andy Spitzer; Rik Schneider; Jesse St Laurent; Steve Bellenot; Ray W Hiltbrand; Jennifer Witham; Gert-Jan Hagenaars; Page 26 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 27 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Chapter Welcome to Linux IN THIS CHAPTER The GNU–Linux Connection The Heritage of Linux: UNIX What Is So Good About Linux? Overview of Linux 10 Additional Features of Linux 15 The Linux kernel was developed by Finnish undergraduate student Linus Torvalds, who used the Internet to make the source code immediately available to others for free Torvalds released Linux version 0.01 in September 1991 The new operating system came together through a lot of hard work Programmers around the world were quick to extend the kernel and develop other tools, adding functionality to match that already found in both BSD UNIX and System V UNIX (SVR4) as well as new functionality The Linux operating system, developed through the cooperation of many, many people around the world, is a product of the Internet and is a free operating system In other words, all the source code is free You are free to study it, redistribute it, and modify it As a result, the code is available free of cost—no charge for the software, source, documentation, or support (via newsgroups, mailing lists, and other Internet resources) As the GNU Free Software Definition (www.gnu.org/philosophy/free-sw.html) puts it: < Day Day Up > Page 28 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Free beer "Free software" is a matter of liberty, not price To understand the concept, you should think of "free" as in "free speech," not as in "free beer." < Day Day Up > Page 29 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Page 30 [...]... Up > Chapter 1 Welcome to Linux IN THIS CHAPTER The GNU Linux Connection 2 The Heritage of Linux: UNIX 5 What Is So Good About Linux? 6 Overview of Linux 10 Additional Features of Linux 15 The Linux kernel was developed by Finnish undergraduate student Linus Torvalds, who used the Internet to make the source code immediately available to others for free Torvalds released Linux version 0.01 in September... take advantage of the power of Linux You may want to review the table of contents for more detail   Chapter 1 Welcome to Linux Presents background information on Linux This chapter covers the history of Linux, explains how the GNU Project helped Linux get started, and discusses some of Linux' s important features that distinguish it from other operating systems Part I: The Linux Operating System tip:... a class in which they use Linux   Power users who want to explore the power of Linux from the command line   Professionals who use Linux at work  System administrators who need a deeper understanding of Linux and the tools that are available to them    Computer science students who are studying the Linux operating system   Programmers who need to understand the Linux programming environment... areas of the screen Linux was born and raised in this environment Naturally all of the original Linux tools were invoked from the command line The real power of Linux still lies in this environment, which explains why many Linux professionals work exclusively from the command line Using clear descriptions and lots of examples, this book shows you how to get the most out of your Linux system using the... http://www.processtext.com/abcchm.html < Day Day Up > Linux distributions A Linux distribution comprises the Linux kernel, utilities, and application programs Many distributions are available, including Debian, Red Hat, Fedora Core, SUSE, Mandriva (formerly Mandrake), KNOPPIX, and Slackware Although the distributions differ from one another in various ways, all of them rely on the Linux kernel, utilities, and applications... from cover to cover to learn command line Linux from the ground up Alternatively, once you are comfortable using Linux, you can use this book as a reference: Look up a topic of interest in the table of contents or index and read about it Or, refer to one of the utilities covered in Part V, "Command Reference." You can also think of this book as a catalog of Linux topics: Flip through the pages until... Preface A Practical Guide to Linux Commands, Editors, and Shell Programming explains how to work with the Linux operating system from the command line The first few chapters quickly bring readers with little computer experience up to speed The rest of the book is appropriate for more experienced computer users This book does not describe a particular release or distribution of Linux but rather pertains... a UNIX /Linux system before, you may want to skim or skip some or all of the chapters in Part I All readers should take a look at " Conventions Used in This Book" (page 22), which explains the typographic conventions that this book uses, and "Getting the Facts: Where to Find Documentation" (page 29), which points you toward both local and remote sources of Linux documentation Part I introduces Linux. .. unix2dos, which converts Linux text files to Windows format; o o tar, which creates archive files that can hold many other files; o o bzip2 and gzip, which compress files so that they take up less space on disk and allow you to transfer them over a network more quickly; and o o diff, which displays the differences between two text files   Chapter 4 The Linux Filesystem Discusses the Linux hierarchical... programming environment  Technical executives who want to get a grounding in Linux < Day Day Up > Page 16 ABC Amber CHM Converter Trial version, http://www.processtext.com/abcchm.html < Day Day Up > Benefits A Practical Guide to Linux Commands, Editors, and Shell Programming gives you an in-depth understanding of how to use Linux from the command line Regardless of your background, it offers the knowledge ... Chapter Welcome to Linux IN THIS CHAPTER The GNU Linux Connection The Heritage of Linux: UNIX What Is So Good About Linux? Overview of Linux 10 Additional Features of Linux 15 The Linux kernel was... The Heritage of Linux: Unix What is so good about linux? Overview of Linux Additional Features of Linux Chapter Summary Exercises Part I The Linux Operating System Chapter Getting Started Conventions... use Linux   Power users who want to explore the power of Linux from the command line   Professionals who use Linux at work  System administrators who need a deeper understanding of Linux

Ngày đăng: 03/12/2015, 17:59