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

LINUX: Rute User''''s Tutorial and Exposition docx

660 250 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 660
Dung lượng 4,4 MB

Nội dung

LINUX: Rute User’s Tutorial and Exposition Paul Sheer August 14, 2001 Pages up to and including this page are not included by Prentice Hall. 2 “The reason we don’t sell billions and billions of Guides,” continued Harl, after wiping his mouth, “is the expense. What we do is we sell one Guide billions and billions of times. We exploit the multidimensional nature of the Universe to cut down on manufacturing costs. And we don’t sell to penniless hitchhikers. What a stupid notion that was! Find the one section of the market that, more or less by definition, doesn’t have any money, and try to sell to it. No. We sell to the affluent business traveler and his vacationing wife in a billion, billion different futures. This is the most radical, dynamic and thrusting business venture in the entire multidimensional infinity of space-time-probability ever.” . . . Ford was completely at a loss for what to do next. “Look,” he said in a stern voice. But he wasn’t certain how far saying things like “Look” in a stern voice was necessarily going to get him, and time was not on his side. What the hell, he thought, you’re only young once, and threw himself out of the window. That would at least keep the element of surprise on his side. . . . In a spirit of scientific inquiry he hurled himself out of the window again. Douglas Adams Mostly Harmless Strangely, the thing that least intrigued me was how they’d managed to get it all done. I suppose I sort of knew. If I’d learned one thing from traveling, it was that the way to get things done was to go ahead and do them. Don’t talk about going to Borneo. Book a ticket, get a visa, pack a bag, and it just happens. Alex Garland The Beach vi Chapter Summary 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Computing Sub-basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 PC Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4 Basic Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6 Editing Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7 Shell Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8 Streams and sed — The Stream Editor . . . . . . . . . . . . . . . . . . . 73 9 Processes, Environment Variables . . . . . . . . . . . . . . . . . . . . . . 81 10 Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 11 User Accounts and Ownerships . . . . . . . . . . . . . . . . . . . . . . . 101 12 Using Internet Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 13 LINUX Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 14 Permission and Modification Times . . . . . . . . . . . . . . . . . . . . . 123 15 Symbolic and Hard Links . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 16 Pre-installed Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 131 17 Overview of the UNIX Directory Layout . . . . . . . . . . . . . . . . . . 135 18 UNIX Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 19 Partitions, File Systems, Formatting, Mounting . . . . . . . . . . . . . . 153 20 Advanced Shell Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 21 System Services and lpd . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 22 Trivial Introduction to C . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 23 Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 24 Source and Binary Packages . . . . . . . . . . . . . . . . . . . . . . . . . 237 25 Introduction to IP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 26 TCP and UDP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 vii Chapter Summary 27 DNS and Name Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . 273 28 Network File System, NFS . . . . . . . . . . . . . . . . . . . . . . . . . . 285 29 Services Running Under inetd . . . . . . . . . . . . . . . . . . . . . . . 291 30 exim and sendmail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 31 lilo, initrd, and Booting . . . . . . . . . . . . . . . . . . . . . . . . . 317 32 init, ?getty, and UNIX Run Levels . . . . . . . . . . . . . . . . . . . . 325 33 Sending Faxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 34 uucp and uux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 35 The LINUX File System Standard . . . . . . . . . . . . . . . . . . . . . . 347 36 httpd — Apache Web Server . . . . . . . . . . . . . . . . . . . . . . . . 389 37 crond and atd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 38 postgres SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 39 smbd — Samba NT Server . . . . . . . . . . . . . . . . . . . . . . . . . . 425 40 named — Domain Name Server . . . . . . . . . . . . . . . . . . . . . . . 437 41 Point-to-Point Protocol — Dialup Networking . . . . . . . . . . . . . . 453 42 The LINUX Kernel Source, Modules, and Hardware Support . . . . . . 463 43 The X Window System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 44 UNIX Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 A Lecture Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 B LPI Certification Cross-Reference . . . . . . . . . . . . . . . . . . . . . . 531 C RHCE Certification Cross-Reference . . . . . . . . . . . . . . . . . . . . 543 D LINUX Advocacy FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 E The GNU General Public License Version 2 . . . . . . . . . . . . . . . . 573 Index 581 viii Contents Acknowledgments xxxi 1 Introduction 1 1.1 What This Book Covers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Read This Next. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.3 What Do I Need to Get Started? . . . . . . . . . . . . . . . . . . . . . . . 1 1.4 More About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.5 I Get Frustrated with UNIX Documentation That I Don’t Understand . . 2 1.6 LPI and RHCE Requirements . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.7 Not RedHat: RedHat-like . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.8 Updates and Errata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Computing Sub-basics 5 2.1 Binary, Octal, Decimal, and Hexadecimal . . . . . . . . . . . . . . . . . . 5 2.2 Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4 Login and Password Change . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.5 Listing Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.6 Command-Line Editing Keys . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.7 Console Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.8 Creating Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.9 Allowable Characters for File Names . . . . . . . . . . . . . . . . . . . . 12 2.10 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3 PC Hardware 15 3.1 Motherboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2 Master/Slave IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 ix Contents 3.3 CMOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.4 Serial Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.5 Modems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4 Basic Commands 25 4.1 The ls Command, Hidden Files, Command-Line Options . . . . . . . . 25 4.2 Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.3 Wildcards, Names, Extensions, and glob Expressions . . . . . . . . . . . 29 4.3.1 File naming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 4.3.2 Glob expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 4.4 Usage Summaries and the Copy Command . . . . . . . . . . . . . . . . . 33 4.5 Directory Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 4.6 Relative vs. Absolute Pathnames . . . . . . . . . . . . . . . . . . . . . . . . 34 4.7 System Manual Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.8 System info Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.9 Some Basic Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.10 The mc File Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.11 Multimedia Commands for Fun . . . . . . . . . . . . . . . . . . . . . . . 40 4.12 Terminating Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.13 Compressed Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.14 Searching for Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.15 Searching Within Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.16 Copying to MS-DOS and Windows Formatted Floppy Disks . . . . . . . 44 4.17 Archives and Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 4.18 The PATH Where Commands Are Searched For . . . . . . . . . . . . . . 46 4.19 The Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 5 Regular Expressions 49 5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 5.2 The fgrep Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 5.3 Regular Expression \{ \} Notation . . . . . . . . . . . . . . . . . . . . . 51 5.4 + ? \< \> ( ) | Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.5 Regular Expression Subexpressions . . . . . . . . . . . . . . . . . . . . . 52 x Contents 6 Editing Text Files 53 6.1 vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.2 Syntax Highlighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.3 Editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 6.3.1 Cooledit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.3.2 vi and vim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 6.3.3 Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 6.3.4 Other editors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 7 Shell Scripting 61 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 7.2 Looping: the while and until Statements . . . . . . . . . . . . . . . . . 62 7.3 Looping: the for Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 63 7.4 breaking Out of Loops and continueing . . . . . . . . . . . . . . . . . 65 7.5 Looping Over Glob Expressions . . . . . . . . . . . . . . . . . . . . . . . 66 7.6 The case Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 7.7 Using Functions: the function Keyword . . . . . . . . . . . . . . . . . 67 7.8 Properly Processing Command-Line Args: shift . . . . . . . . . . . . . 68 7.9 More on Command-Line Arguments: $@ and $0 . . . . . . . . . . . . . . 70 7.10 Single Forward Quote Notation . . . . . . . . . . . . . . . . . . . . . . . . 70 7.11 Double-Quote Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 7.12 Backward-Quote Substitution . . . . . . . . . . . . . . . . . . . . . . . . . 71 8 Streams and sed — The Stream Editor 73 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 8.2 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 8.3 Piping Using | Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 8.4 A Complex Piping Example . . . . . . . . . . . . . . . . . . . . . . . . . . 75 8.5 Redirecting Streams with >& . . . . . . . . . . . . . . . . . . . . . . . . . 75 8.6 Using sed to Edit Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 8.7 Regular Expression Subexpressions . . . . . . . . . . . . . . . . . . . . . 77 8.8 Inserting and Deleting Lines . . . . . . . . . . . . . . . . . . . . . . . . . 79 9 Processes, Environment Variables 81 9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 9.2 ps — List Running Processes . . . . . . . . . . . . . . . . . . . . . . . . . 82 9.3 Controlling Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 xi Contents 9.4 Creating Background Processes . . . . . . . . . . . . . . . . . . . . . . . . 83 9.5 killing a Process, Sending Signals . . . . . . . . . . . . . . . . . . . . . 84 9.6 List of Common Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 9.7 Niceness of Processes, Scheduling Priority . . . . . . . . . . . . . . . . . 87 9.8 Process CPU/Memory Consumption, top . . . . . . . . . . . . . . . . . 88 9.9 Environments of Processes . . . . . . . . . . . . . . . . . . . . . . . . . . 90 10 Mail 97 10.1 Sending and Reading Mail . . . . . . . . . . . . . . . . . . . . . . . . . . 99 10.2 The SMTP Protocol — Sending Mail Raw to Port 25 . . . . . . . . . . . . 99 11 User Accounts and Ownerships 101 11.1 File Ownerships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 11.2 The Password File /etc/passwd . . . . . . . . . . . . . . . . . . . . . . 102 11.3 Shadow Password File: /etc/shadow . . . . . . . . . . . . . . . . . . . 103 11.4 The groups Command and /etc/group . . . . . . . . . . . . . . . . . 104 11.5 Manually Creating a User Account . . . . . . . . . . . . . . . . . . . . . . 105 11.6 Automatically: useradd and groupadd . . . . . . . . . . . . . . . . . . 106 11.7 User Logins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 11.7.1 The login command . . . . . . . . . . . . . . . . . . . . . . . . . 106 11.7.2 The set user, su command . . . . . . . . . . . . . . . . . . . . . . . 107 11.7.3 The who, w, and users commands to see who is logged in . . . . 108 11.7.4 The id command and effective UID . . . . . . . . . . . . . . . . . 109 11.7.5 User limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 12 Using Internet Services 111 12.1 ssh, not telnet or rlogin . . . . . . . . . . . . . . . . . . . . . . . . . 111 12.2 rcp and scp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 12.3 rsh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 12.4 FTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 12.5 finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 12.6 Sending Files by Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 12.6.1 uuencode and uudecode . . . . . . . . . . . . . . . . . . . . . . 114 12.6.2 MIME encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . 115 xii [...]... 173 20.4 Built-in Commands 175 20.5 Trapping Signals — the trap Command 176 xiv Contents 20.6 Internal Settings — the set Command 20.7 Useful Scripts and Commands 20.7.1 chroot 20.7.2 if conditionals 20.7.3 patching and diffing 20.7.4 Internet connectivity... are not expected to write nifty shell scripts to do tricky things, or understand the subtle or advanced features of many standard services, let alone be knowledgeable of the enormous numbers of non-standard and useful applications out there To be blunt: you can pass these courses and still be considered quite incapable by the standards of companies that do system integration &System integration is my... a distribution like Mandrake, which is rpm based and viewed by many as being better than RedHat In short, brand names no longer have any meaning in the Free software community (Note that the same applies to the word U NIX which we take to mean the common denominator between all the U NIX variants, including RISC, mainframe, and PC variants of both System V and BSD.) 1.8 Updates and Errata Corrections... process 27.3 Configuring Your Local Machine 27.4 Reverse Lookups 27.5 Authoritative for a Domain 27.6 The host, ping, and whois Command 27.7 The nslookup Command 27.7.1 NS, MX, PTR, A and CNAME records 27.8 The dig Command 28 Network File System, NFS 28.1 Software 28.2 Configuration Example 28.3 Access Permissions 28.4 Security 28.5... 462 42 The L INUX Kernel Source, Modules, and Hardware Support 463 42.1 Kernel Constitution 463 42.2 Kernel Version Numbers 464 42.3 Modules, insmod Command, and Siblings 464 42.4 Interrupts, I/O Ports, and DMA Channels 466 42.5 Module Options and Device Configuration 467 42.5.1 Five... and since it is rather tedious to convert between decimal and binary, computer scientists have come up with new bases to represent numbers: these are “base sixteen” and “base eight,” known as hexadecimal and octal, respectively Hexadecimal numbers use 5 2.1 Binary, Octal, Decimal, and Hexadecimal 2 Computing Sub-basics the digits 0 through 9 and the letters A through F, whereas octal numbers use only... 31 lilo, initrd, and Booting 31.1 Usage 31.2 Theory 31.2.1 Kernel boot sequence 31.2.2 Master boot record 31.2.3 Booting partitions 31.2.4 Limitations 31.3 lilo.conf and the lilo Command 31.4 Creating Boot Floppy Disks 31.5 SCSI Installation Complications and initrd 31.6 Creating an initrd... 35.4.5 /usr/bin : Most user commands 364 35.4.6 /usr/include : Directory for standard include files 365 35.4.7 /usr/lib : Libraries for programming and packages 365 35.4.8 /usr/lib : Alternate format libraries (optional) 366 35.4.9 /usr/local : Local hierarchy 366 35.4.10 /usr/sbin : Non-essential standard system binaries 367... 188 190 190 191 21 System Services and lpd 21.1 Using lpr 21.2 Downloading and Installing 21.3 LPRng vs Legacy lpr-0.nn 21.4 Package Elements 21.4.1 Documentation files 21.4.2 Web pages, mailing lists, and download points 21.4.3 User programs 21.4.4 Daemon and administrator programs ... 469 42.6 Configuring Various Devices 470 42.6.1 Sound and pnpdump 470 42.6.2 Parallel port 472 42.6.3 NIC — Ethernet, PCI, and old ISA 472 42.6.4 PCI vendor ID and device ID 474 42.6.5 PCI and sound 474 42.6.6 Commercial sound drivers . LINUX: Rute User’s Tutorial and Exposition Paul Sheer August 14, 2001 Pages up to and including this page are not included by Prentice Hall. 2 “The reason we don’t sell billions and billions. login command . . . . . . . . . . . . . . . . . . . . . . . . . 106 11.7.2 The set user, su command . . . . . . . . . . . . . . . . . . . . . . . 107 11.7.3 The who, w, and users commands to see. host, ping, and whois Command . . . . . . . . . . . . . . . . . . . 281 27.7 The nslookup Command . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 27.7.1 NS, MX, PTR, A and CNAME records

Ngày đăng: 27/06/2014, 11:20

TỪ KHÓA LIÊN QUAN

w