ebook img

How Linux Works: What Every Super-User Should Know by Brian PDF

350 Pages·2005·5.22 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview How Linux Works: What Every Super-User Should Know by Brian

How Linux Works: What Every Super-User Should Know by Brian Ward ISBN:1593270356 No Starch Press © 2004 (347 pages) This guide describes the inner workings of a Linux system beginning with the file system and boot process and covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. Table of Contents How Linux Works—What Every Super-User Should Know Chapter 1 -The Basics Chapter 2 -Devices, Disks, Filesystems, and the Kernel Chapter 3 -How Linux Boots Chapter 4 -Essential System Files, Servers, and Utilities Chapter 5 -Configuring Your Network Chapter 6 -Network Services Chapter 7 -Introduction to Shell Scripts Chapter 8 -Development Tools Chapter 9 -Compiling Software From Source Code Chapter 10 -Maintaining the Kernel Chapter 11 -Configuring and Manipulating Peripheral Devices Chapter 12 -Printing Chapter 13 -Backups Chapter 14 -Sharing Files with Samba Chapter 15 -Network File Transfer Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars Back Cover How Linux Works: What Every Super-User Should Know Whether you’re a systems administrator or a home user, you need to understand how Linux internals work before you can really by Brian Ward ISBN:1593270356 master Linux—how it boots, how networking works, how to customize the kernel, and even what hardware to buy. No Starch Press © 2004 (347 pages) How Linux WorksT hcoisn gtauiindse tdhees kcrinibde so ft hinef oinrmneart iwonor nkionrgmsa ollfy a h Lainnduexd s dyostwenm f rboemgi nwniiznagr dws—ithk nthoew lfeildeg sey sthteamt c aonmde bs oforot mpr yoeceasrss aonfd experience doingc tohvienrgins gt haed vhaanrdce wda tyo.p Bicust siuncshte aasd noef tsweoerkkiningg ,t hfier erwigahltl si,n dceanvetalotipomn etnot mtoaokles, ydoeuvri csey smteamna wgeomrke, nyto, us hcealnl srceraidpt sH, oawnd Linux Works to ssehea hrionwg tpor iandtemrsin wisittehr SLainmubxa a.nd why each particular technique works. This book covers such need-to-know topics as: Table of Contents How Linux boots, with coverage of boot loaders and init How Linux Works—What Every Super-User Should Know ChaptHeor w1 ne-tTwhoer kBinagsi,c isnterfaces, firewalls, and servers work Chapter 2 -Devices, Disks, Filesystems, and the Kernel How development tools and shared libraries work Chapter 3 -How Linux Boots ChaptHeor w4 th-eE ksesrennetli aml Sanysatgeems dFeilveisc,e Ss,e rdveevrisc,e adnrdiv Uertsil,i taiensd processes, and how to build a custom kernel ChaptHeor w5 th-eC Loinnufixg uprriinngt inYgo usry sNteetmw owrkorks, with sections on cups, filters, and Ghostscript Chapter 6 -Network Services How shell scripts work Chapter 7 -Introduction to Shell Scripts WCihtha pittse rc 8omb-iDnaetvioelno pomf beanctk Tgoroolusnd theory and real-world examples, How Linux Works will show you how to run your system inCshtaepatde ro f9 ha-viCnogm ypoiulirn gsy Sstoeftmw aruren Fyrooum. Source Code Chapter 10 -Maintaining the Kernel About the Author Chapter 11 -Configuring and Manipulating Peripheral Devices BCrhiaanp tWera r1d2 h-aPs rbineteinng working with Linux since 1993, when he scraped together enough pennies for a secondhand 386. He has a PChh.Dap. tienr c1o3m-puBtaecrk sucpiesnce from the University of Chicago and currently lives in San Francisco. He is the author of the Linux Kernel HOWTO, The Book of VMware (No Starch Press), and The Linux Problem Solver (No Starch Press). Chapter 14 -Sharing Files with Samba Chapter 15 -Network File Transfer Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars How LHionwu Lixnux WWoroksr: Wkhsat— EveWry Shupear-tU sEer Svheourldy K nSowuper-User Should by Brian Ward ISBN:1593270356 Know No Starch Press © 2004 (347 pages) This guide describes the inner workings of a Linux system beginning with the file system and boot process and by Brian Wacorvdering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. Table of Contents How Linux Works—What Every Super-User Should Know Chapter 1 -The Basics Chapter 2 -Devices, Disks, Filesystems, and the Kernel ChNaOpt eSr T3AR-CHoHw PLiRnuExS BSoots ChSaapnte rF 4ran-cEisssceontial System Files, Servers, and Utilities Chapter 5 -Configuring Your Network ChCaoppteyr r6igh-t N©e t2w0o0rk4 S beyrv Bicerisan Ward. Chapter 7 -Introduction to Shell Scripts Chapter 8 -Development Tools All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, Chapter 9 -Compiling Software From Source Code electronic or mechanical, including photocopying, recording, or by any information storage or retrieval Chapter 10 -Maintaining the Kernel system, without the prior written permission of the copyright owner and the publisher. Chapter 11 -Configuring and Manipulating Peripheral Devices Chapter 12 -Printing Chapte Pr 1ri3nt-eBda coknu prescycled paper in the United States of America Chapter 14 -Sharing Files with Samba Ch1a p2t e3r 415 5- 6N e7t w8o 9rk 1 F0il e- T0r7an 0sf6e r05 04 Chapter 16 -User Environments No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Linux is Chapter 17 -Buying Hardware for Linux a registered trademark of Linus Torvalds. Other product and company names mentioned herein may be Chapter 18 -Further Directions the trademarks of their respective owners. Rather than use a trademark symbol with every occurrence of a Appendix A-Command Classification trademarked name, we are using the names only in an editorial fashion and to the benefit of the trademark Bibliography owner, with no intention of infringement of the trademark. Index List of Figures Publisher: William Pollock List of Tables List of Sidebars Managing Editor: Karol Jurado Cover and Interior Design: Octopod Studios Technical Reviewer: Scott Schwartz Copyeditor: Andy Carroll Compositor: Wedobooks Proofreader: Stephanie Provines Indexer: Brian Ward For information on book distributors 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];> http://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. Library of Congress Cataloguing-in-Publication Data Ward, Brian. How Linux works : what every super-user should know / Brian Ward. p. cm. Includes index. ISBN 1-59327-035-6 1. Linux. 2. Operating systems (Computers). I. Title. How Linux Works: What Every Super-User Should Know by Brian Ward ISBN:1593270356 QA76.76.O63 W3654 2004 No Starch Press © 2004 (347 pages) 005.4'32-T-hdisc g2u2ide describes the inner workings of a Linux system beginning with the file system and boot process and covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. 2004002692 Table of Contents How Linux Works—What Every Super-User Should Know Chapter 1 -The Basics Chapter 2 -Devices, Disks, Filesystems, and the Kernel Chapter 3 -How Linux Boots Chapter 4 -Essential System Files, Servers, and Utilities Chapter 5 -Configuring Your Network Chapter 6 -Network Services Chapter 7 -Introduction to Shell Scripts Chapter 8 -Development Tools Chapter 9 -Compiling Software From Source Code Chapter 10 -Maintaining the Kernel Chapter 11 -Configuring and Manipulating Peripheral Devices Chapter 12 -Printing Chapter 13 -Backups Chapter 14 -Sharing Files with Samba Chapter 15 -Network File Transfer Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars ChapteHorw 1Lin:u xT Whoreks : BWhaat sEviecry sSuper-User Should Know by Brian Ward ISBN:1593270356 No Starch Press © 2004 (347 pages) OverviewThis guide describes the inner workings of a Linux system beginning with the file system and boot process and covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. This chapter is a guide to the Unix commands and utilities that you must know to get anything out of this book. This is preliminary material, and you may already know a substantial amount. Even if you think Table of Contents you're up to speed, though, take a few seconds to flip through the sections just to make sure. How Linux Works—What Every Super-User Should Know ChYaopute rm 1ay- bTehe a Bsaksiincgs yourself, "I thought this was a book about Linux, not Unix?" Don't worry; this chapter is Chjuasptt egr e2ttin-gD eyvoicue sr,e Daidskys ,f oFril ewsoysrtkeimngs, wanitdh ththee K Lerinneulx system. Linux is a Unix flavor at heart. You will see the Chwaoprtedr "3Un-ixH"o iwn Ltihniusx cBhoaoptster more than "Linux" because you can take the information straight over to ChSaopltaerr i4s, B-SEsDse, natniadl Soytshteemr UFinleixs,- fSlaervvoerrse,d a nsdy sUtteilmitiess. Special care has been taken to avoid too many Linux- Chsappetecri f5ic u-sCeorn ifnigtuerrinfagc Yeo uerx Nteetnwsoiorkns, not only so you will have a better background with other operating Chsaypstteer m6s,- bNuett waolsrko Sbeervciaceusse these extensions tend to be extremely unstable. You will be able to adapt to Chnaepwte rL 7inu-xI nretrloedauscetiso nm tou cShhe mll Socrreip qtsuickly if you know the core that does not change. Chapter 8 -Development Tools ChAalpthteor u9gh- tChoem mpialinteg rSiaolf thwearree Fmroamy Ssoeuermce Cspodaerse, you need to convince yourself that Unix is not hard. Yes, Chmapotsetr r1e0p-orMtsai nfrtaoimnin tgh teh efi eKledrn aerle to the contrary, but in the end, Unix is nothing but a bunch of files and a few Chcaopmtemr 1a1nd-sC ofnofrig murainngi paundla Mtianngi ptuhloatsineg f iPleersip. hIef ryaol Due avircee sfamiliar with other operating systems, you shouldn't Chhaapvteer a1 2pr-oPbrilnetming. However, if you find the information in this preliminary chapter somewhat lacking, there Chaarpet ebro 1o3ks- Bwaictkhu pmsuch more detail for beginners, such as UNIX for the Impatient [Abrahams] and Learning Chthapet eUr N14IX- OShpaerirnagti nFigle sS wysithte Smam [Pbaeek]. Chapter 15 -Network File Transfer Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars 1.1A bouHto w/b Liinnu/xs Whorks: What Every Super-User Should Know by Brian Ward ISBN:1593270356 The shell is Noon eS toarfc thh Per emsso ©s t2 0im04 p(3o4r7t paanget sp)arts of a Unix system. A shell is a program that runs commands. For exampleT,h oisn geu iodef tdheesc srihbeesll 'tsh ed iuntnieers wiso rtkoin rgusn o tf hae L icnoumx smysatenmds b ethgaintn uinsge wrsit hty tphee .f iSleh seylsltse mal saon ds beorovte p arosc essms aanlld covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and programming environments. Unix programmers often break common tasks into little components and rely sharing printers with Samba. on the shell to manage tasks and to piece things together. TaMblea noyf Cimonptoerntatsnt parts of the system are actually shell scripts — text files that contain nothing but shell Hocwo mLinmuax nWdosr.k sIf— yWohua ht aEvveer yw Sourpkeer-dU sweirt hS hMouSld-D KOnoSw, shell scripts may seem similar to .BAT files, but the shell is Chfaapr tmer o1re -pTohwe eBrafsuilc.s Chapter 7 is a small guide to shell scripts, and you can peruse it anytime after finishing Chthapist ecr h2ap-teDre.vices, Disks, Filesystems, and the Kernel Chapter 3 -How Linux Boots ChAasp tyeor u4 pr-oEgssreenstsia tlh Sryosutegmh Fthileiss ,b Soeorvke,r sy,o aun dw Uillt illietiaersn how to manipulate commands with the shell. One of the Chbaepstet rt h5ing-sC oanbfioguurt inthge Y osuhre Nlle itsw othrkat if you make a mistake, you can look at what you typed, see what went Chwarpotenrg 6, an-dN etthweonrk t rSye ravgicaesin quickly. Do not be afraid to try new things. The only way to learn the shell is to Chuaspete irt .7 -Introduction to Shell Scripts Chapter 8 -Development Tools ChTahpeterre 9 are- Cmomanpyili ndgi fSfeorftewnatr eU Fnrioxm s hSoeullrsc,e bCuotd eall derive many of their features from the Bourne shell, or Ch/abpitenr /1s0h-. MEavinetaryin iUngn itxh es yKserteneml needs the Bourne shell to function correctly, as you will see throughout this Chbaopotekr. 11 -Configuring and Manipulating Peripheral Devices Chapter 12 -Printing Linux uses an enhanced version of this shell, called bash, or the "Bourne-again" shell. bash is the default Chapter 13 -Backups shell for most Linux distributions, and /bin/sh is normally some sort of link to bash on a Linux system. Chapter 14 -Sharing Files with Samba You should use the bash shell when running the examples in this book. Chapter 15 -Network File Transfer Chapter 16 -User Environments You may not have bash if you're using this chapter as a guide for a Unix account at an organization where Chapter 17 -Buying Hardware for Linux you are not the systems administrator. You can change your shell with chsh or ask your systems Chapter 18 -Further Directions administrator for help. Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars 1.2U singHo wth Leinu Sx Whoerklsl: What Every Super-User Should Know by Brian Ward ISBN:1593270356 When you inNsot aSltlaerdc hL Pinreusxs, © y 2o0u04 s(3e4t7 upapg eas) root (superuser) password, and hopefully you also made at least one more reTghuisla gru uidsee dre fsocrr ibyeosu trhsee ilnf.n Fero wr othrkiisn gcsh oafp at eLrin, uyxo suy sstheomu bldeg liongni ning wasit ht hthee r feilge uslyasrt eums earn.d boot process and covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. The first thing you need to do after logging in is to bring up a shell window. After starting a shell, its window contains a prompt at the top that usually ends with a dollar sign ($). On Red Hat Linux, the prompt looks Talbiklee [ofn Caomnet@enhtosst path]$. If you know Windows, you will find that the shell window looks vaguely similar Hotow tLhineu cx oWmormksa—nWd hparto Emveprty. Super-User Should Know Chapter 1 -The Basics ChapteNr o2te- YDoevuic mesa, yD ihskesa, rF itlhesey ssthemelsl , wainndd tohwe Kreerfneerlred to as the terminal window. The terminal window is the Chapter 3 -pHaorwt Loifn uthx eB ouostesr interface that accepts keystrokes from the windowing system and draws the Chapter 4 -cEhssaernatciatle Srsys otenm t hFiele ss,c Sreeervne.r sY, oanud c Uatnili ttihesink of the terminal as a middleman between the shell and Chapter 5 -tChoen fuigsuerrin.g Your Network Chapter 6 -Network Services ChNaopwte rt y7pe- tIhnter ofdoullcotiwonin tgo cShoemll mScarinpdts and press ENTER: Chapter 8 -Development Tools Chcaaptte r /9et-cC/opmapsilisngw dSoftware From Source Code Chapter 10 -Maintaining the Kernel Chapter 11 -Configuring and Manipulating Peripheral Devices ChTahpete cr o12m-mParinntdin pgrints a couple of lines that start with usernames, and then you get your shell prompt back. ChIfa pytoeur 1c3an-'Bt arcekaudp sthe text very well, manipulate the font settings to your liking. You're going to be spending Chaa pgtoeor d14 pa-rSth oarf inygo uFirle tsim weith w Siathm tbhais book in the shell, so you should be comfortable with it. Chapter 15 -Network File Transfer ChTahpete cr a1t6 c-oUmsemr Eannvdir oinsm ae gntrseat one to start with because it's one of the easiest Unix commands. Its syntax is Chaasp tfeorl l1o7w-s:Buying Hardware for Linux Chapter 18 -Further Directions Apcpaetnd fixi lAe-1C ofmimlaen2d C.la.ss.ification Bibliography Index LiWst ohfe Fnig yuoreus run this command, cat prints (and concatenates) the contents of file1,f ile2, and any Liastd odf itTiaobnleasl files you desire (denoted by ...) and exits. List of Sidebars If you do not specify any input files, cat reads from the standard input, which in this case is the keyboard. To see this at work, type cat and press ENTER. Unlike the earlier example, you do not get your shell prompt back because cat is still running. Now type some stuff (it doesn't matter what). After you press ENTER at the end of each line, cat repeats the line you typed. When you're sick of this, press CONTROL- D on a line by itself to terminate the cat command and return to the shell prompt. Note Do not confuse CONTROL-D and CONTROL-C. CONTROL-D on a line by itself stops the current standard input entry (and often terminates a program). CONTROL-C terminates a program regardless of its input or output. You have now experienced standard input (stdin) and output (stdout), two important components of the Unix shell environment. Standard input is a program's default input source. When you ran cat without any arguments, it didn't give up because there were no arguments; instead, cat switched to standard input instead of going after some files. Here, standard input was the stuff that came from your keyboard. Standard output, on the other hand, is where a program's output goes by default. In this case, that location is the terminal window running the shell. The best feature of standard input and output is that you can easily send them to places other than their defaults, as described in Section 1.14. 1.3B asicHo Cw Loinmuxm Woarknsd: Wshat Every Super-User Should Know by Brian Ward ISBN:1593270356 It's time to leNaor nSt sarocmh Per eostsh ©e r2 0U04n (i3x4 7c poamgesm) ands. Most of the following programs take multiple arguments, and some have sTohi sm gaunidye odepstciorinbess a tnhed ifnonremr waotsr ktihnagst oafn a u Lninaubxr sidysgteedm lbisetginingn inwgo wuiltdh bthee pfiolei nstylsetsesm. Tanhdi sb oiso ta p rsoimcespsl iafinedd covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and list; you don't need to know all of the details just yet. sharing printers with Samba. 1.3.1l s Table of Contents How Linux Works—What Every Super-User Should Know ChTahpete lr s1 co-mThme aBnasdic lsists the contents of a directory. The default is the current directory. Use ls -l for a Chdaepttaeirl e2d (-loDnegvi)c eliss, tDinisgk sa, nFdil elsyss te-mFs ,t oa nddi sthpela Kye rfnileel type information (for more on file types and the permissions China pttheer 3left- cHoolwu mLinnu,x s Beoeo tSsection 1.17). Here is a sample long listing: Chapter 4 -Essential System Files, Servers, and Utilities Chtaopttear l5 3-6C1o6nfiguring Your Network Ch-arpwte-r r6---rN-e-tw o1rk S ejruvisceesr users 3804 Apr 30 2000 abusive.c Ch-arpwte-r r7---rIn-t-ro d1u ct iojnu tso eSrhe ll S c riuptssers 4165 May 26 1999 battery.zip Ch-arpwte-r r8---rD-e-ve lo1p m ejnut sToeorls users 131219 Oct 26 2000 beav_1.40-13.tar.gz Ch-arpwte-r r9---rC-o-m p1ili ng jSoufstwearre Fr o mu Ssoeurrcse C o de 6255 May 30 1999 country.c Chdarpwtexr r1-0x-rM-axin ta2in i ngj uthsee Kre rn e l users 4096 Jul 17 20:00 cs335 Ch-arpwtexr r1-1x-rC-oxnf ig1u ri ngj uansde Mra n ip u lautisneg rPesr ip h er a l D e v7ic1e0s8 Feb 2 2001 dhry Ch-arpwte-r r1-2--rP-ri-nt in1g juser users 11309 Oct 20 1999 dhry.c Ch-arpwte-r r1-3--rB-a-ck u1ps juser users 56 Oct 6 1999 doit Chdarpwtexr r1-4x-rS-hxar in6g F iljesu wsiethr S a m b ausers 4096 Feb 20 13:51 dw Chdarpwtexr r1-5x-rN-extw o3rk Fijleu Tsraenrs fe r users 4096 May 2 2000 hough-stuff Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions 1.3.2c p Appendix A-Command Classification Bibliography InIdne xthe first form shown below, cp copies the contents of file1 to file2. In the second form, it copies all Lifsitl eosf Ftiog utrhees dir directory: List of Tables Licstp o ff iSlideeb1a rfsile2 cp file1 ... fileN dir 1.3.3m v In the first form below, mv renames file1 to file2. In the second form, it moves all files to the dir directory: mv file1 file2 mv file1 ... fileN dir 1.3.4t ouch The touch command creates a file. If the file already exists, touch does not change it, but it does update the timestamp you see with the long listing that you get with the ls -l command. touch file 1.3.5r m To delete (remove) a file, use rm. After you remove a file, it's gone. Do not expect to be able to "undelete" anything. rm file 1.3.6e cho How Linux Works: What Every Super-User Should Know The echo cobmy mBraiannd W parridn ts its arguments to the standard output: ISBN:1593270356 No Starch Press © 2004 (347 pages) This guide describes the inner workings of a Linux system beginning with the file system and boot process and echo Hello there. covering advanced topics such as networking, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. The echo command is very useful for finding expansions of shell wildcards and variables that you will Table of Contents encounter later in this chapter. How Linux Works—What Every Super-User Should Know Chapter 1 -The Basics Chapter 2 -Devices, Disks, Filesystems, and the Kernel Chapter 3 -How Linux Boots Chapter 4 -Essential System Files, Servers, and Utilities Chapter 5 -Configuring Your Network Chapter 6 -Network Services Chapter 7 -Introduction to Shell Scripts Chapter 8 -Development Tools Chapter 9 -Compiling Software From Source Code Chapter 10 -Maintaining the Kernel Chapter 11 -Configuring and Manipulating Peripheral Devices Chapter 12 -Printing Chapter 13 -Backups Chapter 14 -Sharing Files with Samba Chapter 15 -Network File Transfer Chapter 16 -User Environments Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Appendix A-Command Classification Bibliography Index List of Figures List of Tables List of Sidebars 1.4U singHo wD Liirneuxc Wtoorrkys: WChoatm Evmerya Snupders-User Should Know by Brian Ward ISBN:1593270356 Unix has a dNiroe Scttaorrcyh hPrieesrsa r©c 2h0y04 t h(3a47t psatgaerst)s at /, sometimes called the root. The directory separator is the slash (/), notT hthise g buiadcek dselsacsrhib e(s\ t)h. eT ihnenerer waorrek isnegsv eorf aal Lsintaunx dsaysrtde msu bbedgiirnencintgo rwieitsh itnh et hfiele rsoyostte dmir aencdt obroyo,t spurocche sass and /usr (you'll cloevaerrnin ga lal davbanocuetd t htoepmics isnu cShe acst inoent w2o.1rk)i.ng, firewalls, development tools, device management, shell scripts, and sharing printers with Samba. A directory specification is called a path, and one that starts at the root (such as /usr/lib) is a full or Taabbles ooflu Cteon pteanthts. Similarly, a filename with a full path in front (such as /usr/lib/libc.a) is a full Hopwa tLhinnuaxm Weo.rks—What Every Super-User Should Know Chapter 1 -The Basics ChTahpete pr 2ath- cDoemvicpeosn, eDnistk sid, eFinletsifyisetdem bsy, atwndo tdhoe tKse (r.ne.l) specifies the parent of your shell's current directory, and Choanpete dr o3t (-.)H sopwe Lciinfuiexs B tohoets current directory. For example, if the current working directory of your shell is Ch/aupsterr /4li-bE,s sthenet ipala Sthys .te.m/ Fbiilens, rSeefrevresrs t,o a n/du Ustrili/tibesin. A path beginning with .. or . is called a relative Chpaaptthenr a5me-.Configuring Your Network Chapter 6 -Network Services ChTahpete fr o7llo-wIinntgro sdeuccttiioonn tso dSehsecll rSibcreip tthse essential directory commands. Chapter 8 -Development Tools Ch1a.p4ter. 19c -dCompiling Software From Source Code Chapter 10 -Maintaining the Kernel Chapter 11 -Configuring and Manipulating Peripheral Devices The cd command changes the shell's current working directory to dir: Chapter 12 -Printing Chapter 13 -Backups Chcadp dteir r14 -Sharing Files with Samba Chapter 15 -Network File Transfer Chapter 16 -User Environments If you omit dir, the shell returns to your home directory. Chapter 17 -Buying Hardware for Linux Chapter 18 -Further Directions Ap1p.e4nd.ix2 Am -Ckodmmirand Classification Bibliography InTdhexe mkdir command creates a new directory, dir: List of Figures List of Tables mkdir dir List of Sidebars 1.4.3r mdir The rmdir command removes the directory dir: rmdir dir If dir isn't empty, this command fails. However, if you're impatient, you probably don't want to laboriously delete all the files and subdirectories inside dir first. You can use rm -rf dir to delete a directory and its contents, but be careful. This is one of the few commands that can do serious damage, especially if you run it as the superuser. The -r option specifies recursive delete, and -f forces the delete operation. Don't use the -rf flags with wildcards such as a star (*). Above all, always double-check your command. 1.4.4S hell Wildcards The shell is capable of matching simple patterns with files in the current working directory. The simplest of these is the star character (*), which means match any number of arbitrary characters. For example, the following command prints a list of files in the current directory: echo * After matching files to wildcards, the shell substitutes the filenames for the wildcard in the command line and then runs the revised command line. Here are some more wildcard examples: at* matches all files starting with at;* at matches files that end with at; and *at* matches any files that contains at. If no files match a wildcard, the shell does no substitution, and the command runs with literal characters such as * (for example, try a command such as echo *dfkdsafh).

Description:
List of Sidebars HOWTO, The Book of VMware (No Starch Press), and The Linux Problem Solver (No Starch Press) Overview. This chapter is a guide to the Unix commands and utilities that you must know to get anything out of this book.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.