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

OReilly linux in a nutshell 4th edition jun 2003 ISBN 0596004826

2K 371 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 2.049
Dung lượng 5,98 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Linux in a Nutshell are the immeasurable utilities and commands that make Linux one of the most powerful and flexible systems available.. In addition to the tools and features written sp

Trang 1

rolled into one: sed, gawk, RCS, CVS, vi,

Emacs, bash, tcsh, regular expressions,

package management, bootloaders, and

Trang 2

desktop environments are all covered in this clear, to-the-point volume, along with core command-line utilities.

Trang 7

Section 19.4 Customizing Menus

Section 19.5 The WinList: Switching the Focus

Colophon

Index

Trang 8

Published by O'Reilly & Associates, Inc., 1005 Gravenstein

Highway North, Sebastopol, CA 95472

O'Reilly & Associates books may be purchased for educational,business, or sales promotional use Online editions are also

available for most titles (http://safari.oreilly.com) For moreinformation, contact our corporate/institutional sales

department: (800) 998-9938 or corporate@oreilly.com

Nutshell Handbook, the Nutshell Handbook logo, and the

O'Reilly logo are registered trademarks of O'Reilly & Associates,Inc Many of the designations used by manufacturers and

sellers to distinguish their products are claimed as trademarks.Where those designations appear in this book, and O'Reilly &Associates, Inc was aware of a trademark claim, the

designations have been printed in caps or initial caps The

association between the image of an Arabian horse and the

topic of Linux is a trademark of O'Reilly & Associates, Inc

While every precaution has been taken in the preparation of thisbook, the publisher and authors assume no responsibility forerrors or omissions, or for damages resulting from the use ofthe information contained herein

Trang 9

This is a book about Linux, a freely available clone of the Unixoperating system whose uses range from embedded systemsand personal data assistants (PDAs) to corporate servers, webservers, and massive clusters that perform some of the world'smost difficult computations

Linux in a Nutshell are the immeasurable utilities and

commands that make Linux one of the most powerful and

flexible systems available

In addition to the tools and features written specifically for it,Linux has inherited many from the Free Software Foundation'sGNU project, the Berkeley Software Distribution (BSD), the XWindow System (XFree86), and contributions from major

corporations as well as the companies that created the majorLinux distributions More recent projects extend Linux in

exciting ways, some through changes to the kernel and somethrough libraries and applications that radically change the

user's experience; the GNOME and KDE desktops are the mostprominent examples

This book is a quick reference for the basic commands and

features of the Linux operating system As with other books inO'Reilly's "In a Nutshell" series, this book is geared toward

users who know what they want to do and have some idea how

Trang 10

to do it, but can't always remember the correct command oroption.

Trang 11

The Internet is full of information about Linux One of the bestresources is the Linux Documentation Project at

http://www.tldp.org (or one of the dozens of mirror sites

around the world), which has numerous short guides calledHOWTOs, along with some full manuals For online informationabout the GNU utilities covered in this book, consult

http://www.gnu.org (also widely mirrored) The Free SoftwareFoundation, which is in charge of the GNU project, publishes itsdocumentation in a number of hard-copy and online books

about various tools

Each distribution maintains its own web site, and contains

documentation for the software it provides as well as guides tomaintaining your system under that distribution

Web Sites

As befits a hot phenomenon, Linux is the central subject of

Trang 12

articles posted elsewhere and threaded discussions (which can

be a useful service) Among the sites frequented by Linux usersare:

http://www.lwn.net

Linux Weekly News, a site with weekly in-depth articles andfrequent news updates

Trang 13

the Linux community, written and published by a number ofLinux activists With both print editions and web sites, theyoffer articles ranging from novice questions and answers to

popular:

comp.os.linux.announce

A moderated newsgroup containing announcements of newsoftware, distributions, bug reports, and goings-on in theLinux community All Linux users should read this group.Submissions may be mailed to linux-

announce@news.ornl.gov

comp.os.linux.help

General questions and answers about installing or usingLinux

comp.os.linux.admin

Discussions relating to systems administration under Linux

comp.os.linux.development

Trang 14

devoted to so-called "peer-directed" projects, particularly thoseinvolving free software Some of its channels are designed toprovide online Linux support services

Internet relay chat is a network service that allows you to talk

Trang 15

support multiple channels where different groups of people typetheir thoughts Whatever you type in a channel is seen by allother users of that channel

Linux User Groups

Many Linux User Groups around the world offer direct support

to users Typically, Linux User Groups engage in such activities

as installation days, talks and seminars, demonstration nights,and purely social events Linux User Groups are a great way of

Trang 16

Groups of Linux Users Everywhere:

http://www.ssc.com/glue/groups

LUGregistry: http://www.linux.org/users

Trang 17

is used to show arguments and variables that should bereplaced with user-supplied values Italic is also used toindicate filenames and directories and to highlight

comments in examples

Constant Width

is used to show the contents of files or the output fromcommands

Constant Width Bold

is used in examples to show commands or other text thatshould be typed literally by the user

Constant Width Italic

is used in examples to show text that should be replacedwith user-supplied values

%, $

are used in some examples as the tcsh shell prompt (%) and as the Bourne or bash shell prompt ($).

Trang 18

surround optional elements in a description of syntax (Thebrackets themselves should never be typed.) Note that

many commands show the argument [files] If a filename is

omitted, standard input (e.g., the keyboard) is assumed.End with an end-of-file character

EOF

indicates the end-of-file character (normally Ctrl-D)

|

is used in syntax descriptions to separate items for whichonly one alternative may be chosen at a time

This icon indicates a note, which is an important aside to its nearby text.

This icon indicates a warning.

A final word about syntax In many cases, the space between

an option and its argument can be omitted In other cases, thespacing (or lack of spacing) must be followed strictly For

example, -wn (no intervening space) might be interpreted

differently from -w n It's important to notice the spacing used

in option syntax

Trang 19

We have tested and verified all of the information in this book

to the best of our ability, but you may find that features havechanged (or even that we have made mistakes!) Please let usknow about any errors you find, as well as your suggestions forfuture editions, by writing:

bookquestions@oreilly.com

For more information about books, conferences, Resource

Centers, and the O'Reilly Network, see the O'Reilly web site at:

http://www.oreilly.com

Trang 20

This fourth edition of Linux in a Nutshell is the result of the

cooperative efforts of many people Thanks to Andy Oram forhis editorial skills, as well as for pitching in to check existingchapters and update and write new material as needed

For technical review, thanks go to Matt Welsh of Running Linux and Installation and Getting Started Guide fame, Michael K.

Johnson of Red Hat Software, Robert J Chassell, Phil Hughes of

Linux Journal, Laurie Lynne Tucker, Arnold Robbins, Julian T J.

Midgley, Matthias Kalle Dalheimer, Terry Dawson, Doug Moreen,Ron Passerini, and Mark Stone

Trang 21

It is hard to chart the rise of Linux over its twelve years of

existence without risking the appearance of exaggeration andhyperbole During the past five years alone, Linux has grownfrom a student/hacker playground to an upstart challenger inthe server market to a well-respected system taking its rightfulplace in educational and corporate networks Many serious

analysts claim that its trajectory has just begun, and that it willeventually become the world's most widespread operating

system

Linux was first developed by Linus Torvalds at the University ofHelsinki in Finland From his current location in Silicon Valley,Linus continues to centrally coordinate improvements The

Linux kernel continues to develop under the dedicated

cultivation of a host of other programmers and hackers all overthe world, joined by members of programming teams at majorcomputer companies, all connected through the Internet

By "kernel," we mean the core of the operating system itself,not the applications (such as the compiler, shells, and so forth)that run on it Today, the term "Linux" is often used to mean asoftware environment with a Linux kernel along with a large set

of applications and other software components In this largermeaning, many people prefer the term GNU/Linux, which

acknowledges the central role played by tools from the FreeSoftware Foundation's GNU project in the development of thekernel

Linux systems cannot be technically referred to as a "version ofUnix," as they have not undergone the required tests and

licensing.[1] However, Linux offers all the common programminginterfaces of standard Unix systems, and as you can see fromthis book, all the common Unix utilities have been

reimplemented on Linux It is a powerful, robust, fully usable

Trang 22

[1] Before an operating system can be called "Unix," it must be branded by The Open Group.

The historical impact of Linux goes beyond its role as a

challenge to all versions of Unix as well as Microsoft Windows,particularly on servers Linux's success has also inspired

countless other free software or open source (defined at

http://opensource.org) projects, including Samba, GNOME, and

a mind-boggling collection of innovative projects that you canbrowse at numerous sites like SourceForge

(http://sourceforge.net) As both a platform for other

developers and a development model, Linux gave a tremendousboost to the GNU project, and has also become a popular

platform for Java development In short, Linux is a central

participant in the most exciting and productive free softwaremovement ever seen

If you haven't obtained Linux yet, or have it but don't knowexactly how to get started using it, see Other Resources in thepreface

Trang 23

Linux is, first of all, free software: anyone can download thesource from the Internet or buy it on a low-cost CD-ROM ButLinux is becoming well known because it's more than free

softwareit's unusually good software You can get more fromyour hardware with Linux and be assured of fewer crashes;

even its security is better than many commercial alternatives

Linux first appeared in organizations as ad hoc installations byhackers running modest web servers or development systems

at universities and research institutions, but now extends

deeply into corporations around the world People deployingLinux for mission-critical systems tend to talk about its amplepractical advantages, such as the ability to deliver a lot of bangfor the buck and the ease of deploying other powerful tools onLinux such as Apache, Samba, and Java environments Theyalso cite Linux's ability to grow and sprout new features of

interest to large numbers of users But these advantages can betraced back to the concept of software freedom, which is theroot of the broad wave of innovation driving Linux

As free software, Linux revives the grand creativity and the

community of sharing that Unix was long known for The

unprecedented flexibility and openness of Unixwhich newcomersusually found confusing and frustrating, but eventually foundthey couldn't live withoutcontinually inspired extensions, newtools like Perl, and experiments in computer science that

sometimes ended up in mainstream commercial computer

systems

Many programmers fondly remember the days when AT&T

provided universities with Unix source code at no charge, andthe University of Berkeley started distributing its version in anymanner that allowed people to get it For these older hackers,Linux brings back the spirit of working togetherall the more so

Trang 24

or whose prior experience has been constricted by trying to

explore and adapt proprietary operating systems, now is thetime to discover the wonders of freely distributable source codeand infinitely adaptable interfaces

The economic power behind Linux's popularity is its support for

an enormous range of hardware People who are accustomed toMS-DOS and Microsoft Windows are often amazed at how muchfaster their hardware appears to work with Linuxit makes

efficient use of its resources

For the first several years, users were attracted to Linux for avariety of financial and political reasons, but soon they

discovered an unexpected benefit: Linux works better than

many commercial systems With the Samba file and print

server, for instance, Linux serves a large number of end-userPCs without crashing With the Apache web server, it providesmore of the useful features web administrators want than

competing products do Embedded versions of the Linux kernelare in growing use because, although they are larger than themost stripped-down operating systems, they deliver a range ofpowerful features within a remarkably small footprint

Opinions still differ on how suitable Linux is as a general-purpose desktop system But the tremendous advances in

usability and stability of the desktop software and its

applications are undisputed Soon (if not today), one will findLinux in many offices and other end-user environments

Meanwhile, the strides made by Linux in everyday computingtasks are reflected in the new audio and CD-related commandsfound in this edition

Trang 25

While it is convenient to download one or two new programsover the Internet and fairly feasible to download something aslarge as the Linux kernel, getting an entire working system overthe Internet is difficult without a high-speed Internet

connection Over the years, therefore, commercial and

noncommercial packages called distributions have emerged.

The first distribution consisted of approximately 50 diskettes, atleast one of which would usually turn out to be bad and have to

be replaced When CD-ROM drives became widespread, Linuxreally took off

After getting Linux, the average user is concerned next withsupport While Usenet newsgroups offer very quick responsesand meet the needs of many intrepid users, you can also buysupport from the vendors of the major distributions and a

number of independent experts Linux is supported at least aswell as commercial software When you buy a distribution from

a vendor, you typically are entitled to a period of free support aswell

Intel's x86 family and other compatible chips are still by far themost common hardware running Linux, but Linux is also nowcommercially available on a number of other hardware systems,notably the PowerPC, the 64-bit Intel Itanium processor, SunMicrosystems' SPARC, and the Alpha (created by Digital

Equipment Corporation)

Trang 26

Linux commands are not the same as standard Unix ones

They're better! This is because most of them are provided bythe GNU project run by the Free Software Foundation (FSF).GNU means "GNU's Not Unix"the first word of the phrase is

expanded with infinite recursion

Benefiting from years of experience with standard Unix utilitiesand advances in computer science, programmers on the GNUproject have managed to create versions of standard tools thathave more features, run faster and more efficiently, and lackthe bugs and inconsistencies that persist in the original

standard versions

While GNU provided the programming utilities and standard

commands like grep, many of the system and network

administration tools on Linux came from the Berkeley SoftwareDistribution (BSD) In addition, some people wrote tools thatspecifically allow Linux to deal with special issues such as

filesystems This book documents all the standard Unix

commands that are commonly available on most Linux

distributions

The third type of software most commonly run on Linux is the XWindow System, ported by the XFree86 project to standardIntel chips While this book cannot cover the wide range of

utilities that run on X, we briefly cover some of the useful

customizations you can make to your KDE, GNOME, or fvwm2

desktop

Trang 27

This book does not cover the graphical tools contained in mostdistributions of Linux Many of these, to be sure, are quite

useful and can form the basis of everyday work Examples ofthese tools include OpenOffice (the open source version of theStarOffice suite distributed by Sun Microsystems), Evolution (amail, calendar, and office productivity tool from Ximian), Mozilla(the open source cousin of the Netscape web browser), and theGIMP (a graphic image manipulation program and the

inspiration for the GNOME project) But they are not Linux-specific, and their graphical models do not fit well into the

format of this book

Trang 28

applications, the core of Linux use is the text manipulation andadministration done from the command line, within scripts, or

using text editors such as vi and Emacs Linux is still mostly a

command-driven system, and this book continues to focus onthis level of usage In your day-to-day work, you'll likely findyourself moving back and forth between graphical programsand the commands listed in this book

Every distribution of Linux is slightly different, but you'll findthat the commands we document are the ones you use most ofthe time, and that they work the same on all distributions Basiccommands, programming utilities, system administration, andnetwork administration are all covered However, some areaswere so big that we had to leave them out The many

applications that depend on the X Window System didn't makethe cut Nor did the many useful programming languages likeJava, Perl, and Python with which users can vastly expand thecapabilities of their systems XML isn't covered here either

These subjects would stretch the book out of its binding

Linux in a Nutshell doesn't teach you Linuxit is, after all, a quick

referencebut novices as well as highly experienced users willfind it of great value When you have some idea of what

command you want but aren't sure just how it works or whatcombinations of options give you the exact output required, thisbook is the place to turn It can also be an eye-opener, makingyou aware of options that you never knew about before

Once you're over the hurdle of installing Linux, the first thingyou need to do is get to know the common utilities run from theshell prompt If you know absolutely nothing about Unix, werecommend you read a basic guide (introductory chapters in the

Trang 29

Intel systems, including LILO (Linux Loader), GRUB (the GRandUnified Bootloader), and Loadlin Chapter 5 covers the Red Hat

package manager (rpm)which is supported by many

distributions, including Red Hat, SuSE, Mandrake, and

Calderaand the Debian package manager Package managersare useful for installing and updating software; they make sureyou have all the files you need in the proper versions

All commands are interpreted by the shell The shell is simply a

program that accepts commands from the user and executesthem Different shells sometimes use slightly different syntax to

mean the same thing Under Linux, two popular shells are bash and tcsh (which on Linux has supplanted the older csh), and

they differ in subtle ways (One of the nice things about Linuxand other Unix systems is that you have a variety of shells tochoose from, each with strengths and weaknesses.) We offer anintroduction to shells in Chapter 6, thorough coverage of bash

in Chapter 7, and a guide to tcsh in Chapter 8 You may decide

to read these after you've used Linux for a while, because theymostly cover powerful, advanced features that you'll want whenyou're a steady user

To get any real work done, you'll have to learn some big,

comprehensive utilities, notably an editor and some scripting

tools Two major editors are used on Linux: vi and Emacs.

Emacs is covered in Chapter 10 and vi in Chapter 11 Chapter

12 and Chapter 13 cover two classic Unix tools for manipulating

text files on a line-by-line basis: sed and gawk (the GNU

version of the traditional awk) O'Reilly offers separate books

Trang 30

excellent built-in tutorial, though; to invoke it, press Ctrl-H

followed by t for "tutorial.")

CVS (Concurrent Versions System) and RCS (Revision ControlSystem) manage files so you can retrieve old versions and

maintain different versions simultaneously Originally used byprogrammers who have complicated requirements for buildingand maintaining applications, these tools have turned out to bevaluable for anyone who maintains files of any type, particularlywhen coordinating a team of people CVS has become a

doesn't have everything the manual pages have; but you'll findthat it has what you need 95% of the time

Trang 31

Some distributions contain the source code for Linux; it is alsoeasily available for download at http://www.kernel.org and

elsewhere Source code is similarly available for all the utilities

on Linux (unless your vendor offers a commercial application orlibrary as a special enhancement) You may never bother

looking at the source code, but it's key to Linux's strength

Under the Linux license, the source code has to be provided bythe vendor, and it permits those who are competent at suchthings to fix bugs, provide advice about the system's

functioning, and submit improvements that benefit everyone.The license is the GNU project's well-known General Public

License, also known as the GPL or "copyleft," invented and

popularized by the Free Software Foundation

The FSF, founded by Richard Stallman, is a phenomenon thatmany people might believe to be impossible if it did not exist.(The same goes for Linux, in fact15 years ago, who would haveimagined a robust operating system developed by collaboratorsover the Internet and made freely redistributable?) One of themost popular editors on Unix, GNU Emacs, comes from the FSF

So do gcc and g++ (C and C++ compilers), which for a while

set the standard in the industry for optimization and fast code.One of the largest projects within GNU is the GNOME desktop,which encompasses several useful general-purpose libraries andapplications that use these libraries to provide consistent

behavior and interoperability

Dedicated to the sharing of software, the FSF provides all itscode and documentation on the Internet and allows anyonewith a whim for enhancements to alter the source code One ofits projects is the Debian distribution of Linux

To prevent hoarding, the FSF requires that the source code forall enhancements be distributed under the same GPL that it

Trang 32

improvements and share them with others The only thing

someone cannot do is add enhancements and then try to sellthe product as commercial softwarethat is, to withhold the

source code That would be taking advantage of the FSF andthe users You can find the GPL in any software covered by thatlicense, or online at http://www.gnu.org/copyleft/gpl.html

As we said earlier, many Linux tools come from BSD instead ofGNU BSD is also free software The license is significantly

different, but that probably don't concern you as a user Theeffect of the difference is that companies are permitted to

incorporate the software into their proprietary products, a

practice that is severely limited by the GNU license

Trang 33

If you're just beginning to work on a Linux system, the

abundance of commands might prove daunting To help orientyou, the following lists present a sampling of commands onvarious topics

Ngày đăng: 26/03/2019, 16:32

TỪ KHÓA LIÊN QUAN