Learn The Quick And Easy Way! Unix And Linux

3y ago
72 Views
4 Downloads
2.29 MB
44 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Genevieve Webb
Transcription

full EcolorI S U AQUIL QCUK S T AGRUIDT GVIVS UALKISCTARTE U InI D Easy visual approach uses pictures to guide you through Unix andLinux and show you what to do step by step. Concise steps and explanations let you get up and running in no time. Essential reference guide keeps you coming back again and again. Visit the companion Web site at peachpit.com/unixlinuxvqs5Deborah and Eric Ray have together published nearly 20 computingbooks since the mid-1990s. Deborah is Professor of Practice at UtahState University, where she teaches graduate and undergraduatecourses in technical communication for the English and Engineeringdepartments and uses online and broadcast technologies to reachstudents all over the United States. Eric is Director of Platform Engineering at Nexenta, aglobal leader in software-defined storage, and has two decades of high-profile experienceworking at high-tech corporations such as Sun Microsystems and Oracle Corporation.www.peachpit.comFOR COMPUTERS USING:Adobe Photoshop CC for Mac OS Xand Microsoft WindowsCATEGORY: Unix/LinuxUS 39.99 CAN 45.99 UK 21.99ISBN-13: 978-0-321-99754-8ISBN-10:0-321-99754-9Deborah and Eric Raydonatas1205 / ShutterstockAUTHOR PHOTOS:COVER IMAGES:95 3 9 9 9RAY&RAYLEVEL: Beginning / IntermediateVISU AL Q UI CK STA RT G UIDE Whether you’re new to Unix and Linux or you’ve been using thecommand line for years, this book has something for you—from howto create and edit directories and files to writing scripts, and much,much more!Peachpit PressUnix and LinuxFifth EditionFifth Edition Detailed code listings and scripting instructions help you leveragethe power of Unix and Linux to the fullest.Unix and LinuxLearn Unix and Linux—the quick and easy way!VIS U A L QU ICK S TA RT GU IDED E B O R A H S . R AYE R I C J . R AY780321 997548L E A R N T H E Q U I C K A N D E A S Y WAY !

V I S UA L Q U I C K S TA R T G U I D EUnix andLinuxFifth EditionDeborah Ray  Eric RayPeachpit Press

Visual QuickStart GuideUnix and Linux, Fifth EditionDeborah Ray and Eric RayPeachpit Presswww.peachpit.comTo report errors, please send a note to errata@peachpit.com.Peachit Press is a dvision of Pearson Education.Copyright 2015 by Deborah Ray and Eric RayEditor: Clifford ColbyDevelopment editor: Robyn G. ThomasSenior production editor: Lisa BraziealCopyeditor: Scout FestaTechnical editor: Bruce ByfieldCompositor: Danielle FosterIndexer: James MinkinCover design: RHDG / Riezebos Holzbaur Design Group, Peachpit PressInterior design: Peachpit PressLogo design: MINE www.minesf.comNotice of RightsAll rights reserved. No part of this book may be reproduced or transmitted in any form by any means,electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of thepublisher. For information on getting permission for reprints and excerpts, contact permissions@peachpit.com.Notice of LiabilityThe information in this book is distributed on an ”As Is” basis, without warranty. While every precaution hasbeen taken in the preparation of the book, neither the author, Adobe Systems, Inc., nor the publisher shall haveany liability to any person or entity with respect to any loss or damage caused or alleged to be caused directlyor indirectly by the instructions contained in this book or by the computer software and hardware productsdescribed in it.TrademarksVisual QuickStart Guide is a registered trademark of Peachpit Press, a division of Pearson Education.Many of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and Peachpit was aware of a trademark claim,the designations appear as requested by the owner of the trademark. All other product names and servicesidentified throughout this book are used in editorial fashion only and for the benefit of such companies with nointention of infringement of the trademark. No such use, or the use of any trade name, is intended to conveyendorsement or other affiliation with this book.ISBN 13: 978-0-321-99754-8ISBN 10:0-321-99754-9987654321Printed and bound in the United States of America

DedicationAcknowledgmentsTo Simon Hayes, who helped develop thisbook’s first edition—the foundation for thisbook’s long-term success.This book came together with the invaluable assistance of a number of verytalented and supportive people. Thanks toClifford Colby for his continued confidenceand support; it’s always a treat to work withyou! Our thanks to Robyn Thomas as well,who was a delight to work with and helpedtremendously in pulling the various piecestogether. Scout Festa was really helpful ascopyeditor and was a great proofreader.Lisa Brazieal did a great job in production,even with our special needs. And our special thanks to Bruce Byfield, whose carefulattention to detail and deep knowledge ofthe idiosyncrasies of Unix and Linux helpediron out technical rough spots. Thanks, all!

Table of ContentsIntroduction . . . . . . . . . . . . . . . . . . . . . ixChapter 1Getting Started with Unix and Linux . . . . . . . . 1Accessing a Unix System . . . . . . . . . . . . . . . . . . . 3Connecting to the Unix or Linux System . . . . . . . . . . 8Logging In . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Changing Your Password with passwd . . . . . . . . . . 13Listing Directories and Files with ls . . . . . . . . . . . . 15Changing Directories with cd . . . . . . . . . . . . . . . . 17Finding Yourself with pwd . . . . . . . . . . . . . . . . . . 18Piping Input and Output . . . . . . . . . . . . . . . . . . . 19Redirecting Output . . . . . . . . . . . . . . . . . . . . . . 21Using Wildcards . . . . . . . . . . . . . . . . . . . . . . . 23Viewing File Contents with more . . . . . . . . . . . . . . 24Displaying File Contents with cat . . . . . . . . . . . . . 25Exploring the System . . . . . . . . . . . . . . . . . . . . .27Getting Help with man . . . . . . . . . . . . . . . . . . . . 28Logging Out . . . . . . . . . . . . . . . . . . . . . . . . . 30Chapter 2Using Directories and Files . . . . . . . . . . . . 31Creating Directories with mkdir . . . . . . . . . . . . . . 32Creating Files with touch . . . . . . . . . . . . . . . . . . 34Copying Directories and Files with cp . . . . . . . . . . . 36Listing Directories and Files with ls(More Goodies) . . . . . . . . . . . . . . . . . . . . . . 38Moving Files with mv . . . . . . . . . . . . . . . . . . . . . 41Removing Files with rm . . . . . . . . . . . . . . . . . . . .42Removing Directories with rmdir . . . . . . . . . . . . . 44Finding Forgotten Files with find . . . . . . . . . . . . . 46Locating Lost Files with locate . . . . . . . . . . . . . . 48Linking with ln (Hard Links) . . . . . . . . . . . . . . . . 49Linking with ln -s (Soft Links) . . . . . . . . . . . . . . . . 51Chapter 3Working with Your Shell . . . . . . . . . . . . . . 53Discovering Which Shell You’re Using . . . . . . . . . . 54Understanding Shells and Options . . . . . . . . . . . . 55Changing Your Shell with chsh . . . . . . . . . . . . . . . 57Changing Your Shell Temporarily . . . . . . . . . . . . . 59Using Completion in the bash Shell . . . . . . . . . . . . . 61Viewing Session History in the bash Shell . . . . . . . . 62Using Completion in the zsh Shell . . . . . . . . . . . . . 64ivTable of Contents

Viewing Session History in the zsh Shell . . . . . . . . . 65Changing Your Identity with su . . . . . . . . . . . . . . .67Fixing Terminal Settings with stty . . . . . . . . . . . . 69Exiting the Shell . . . . . . . . . . . . . . . . . . . . . . . .70Chapter 4Creating and Editing Files . . . . . . . . . . . . . 71Choosing an Editor: nano/pico or vi /vim . . . . . . . . . 72Starting nano and Dabbling with It . . . . . . . . . . . . . 75Saving in nano . . . . . . . . . . . . . . . . . . . . . . . . .76Cutting and Pasting Text Blocks in nano . . . . . . . . . .77Checking Spelling in nano . . . . . . . . . . . . . . . . . .78Getting Help in nano . . . . . . . . . . . . . . . . . . . . .79Exiting nano . . . . . . . . . . . . . . . . . . . . . . . . . 80Starting vi (or vim) and Dabbling with It . . . . . . . . . . 81Saving in vi . . . . . . . . . . . . . . . . . . . . . . . . . 83Adding and Deleting Text in vi . . . . . . . . . . . . . . 84Importing Files into vi . . . . . . . . . . . . . . . . . . . 85Searching and Replacing in vi . . . . . . . . . . . . . . . 86Exiting vi . . . . . . . . . . . . . . . . . . . . . . . . . . . 88Chapter 5Controlling Ownership and Permissions . . . . . 89Understanding File Ownership and Permissions . . . . 90Finding Out Who Owns What . . . . . . . . . . . . . . . . 91Finding Out Which Group You’re In . . . . . . . . . . . . 94Changing the Group Association of Files andDirectories with chgrp . . . . . . . . . . . . . . . . . . 96Changing Ownership of Files and Directorieswith chown . . . . . . . . . . . . . . . . . . . . . . . . . 98Changing Permissions with chmod . . . . . . . . . . . . 100Translating Mnemonic Permissions toNumeric Permissions . . . . . . . . . . . . . . . . . . 103Changing Permission Defaults with umask . . . . . . . . 105Chapter 6Manipulating Files . . . . . . . . . . . . . . . . 107Counting Files and Their Contents with wc . . . . . . . 108Viewing File Beginnings with head . . . . . . . . . . . . 109Viewing File Endings with tail . . . . . . . . . . . . . . 110Finding Text with grep . . . . . . . . . . . . . . . . . . . .111Using Regular Expressions with grep . . . . . . . . . . . 112Using Other Examples of Regular Expressions . . . . . 114Making Global Changes with sed . . . . . . . . . . . . . 115Changing Files with awk . . . . . . . . . . . . . . . . . . 116Comparing Files with cmp . . . . . . . . . . . . . . . . . . 118Finding Differences in Files with diff . . . . . . . . . . . 119Finding Differences in Files with sdiff . . . . . . . . . . 120Sorting Files with sort . . . . . . . . . . . . . . . . . . . 121Table of Contentsv

Eliminating Duplicates with uniq . . . . . . . . . . . . . 122Redirecting to Multiple Locations with tee . . . . . . . . 123Changing with tr . . . . . . . . . . . . . . . . . . . . . . 124Formatting with fmt . . . . . . . . . . . . . . . . . . . . 126Splitting Files with split . . . . . . . . . . . . . . . . . . 128Chapter 7Getting Information About the System . . . . . 131Getting System Information with uname . . . . . . . . . 132Viewing File Systems with df . . . . . . . . . . . . . . . 133Determining Disk Usage with du . . . . . . . . . . . . . 136Finding Out File Types with file . . . . . . . . . . . . . 137Finding Out About Users with finger . . . . . . . . . . 138Learning Who Else Is Logged In with who . . . . . . . . . 141Learning Who Else Is Logged In with w . . . . . . . . . . 142Getting Information About Your Userid with id . . . . . 144Chapter 8Configuring Your Unix or Linux Environment . . 145Understanding Your Unix or Linux Environment . . . . 146Discovering Your Current Environment . . . . . . . . . 148Adding or Changing Variables . . . . . . . . . . . . . . 150Looking at Your zsh Configuration Files . . . . . . . . . 152Adding to Your zsh Path . . . . . . . . . . . . . . . . . . 156Changing Your zsh Prompt . . . . . . . . . . . . . . . . 158Looking at Your bash Configuration Files . . . . . . . . . 161Adding to Your bash Path . . . . . . . . . . . . . . . . . 164Changing Your bash Prompt . . . . . . . . . . . . . . . . 167Setting Aliases with alias . . . . . . . . . . . . . . . . . 169Chapter 9Running Scripts and Programs . . . . . . . . . . 171Running a Command . . . . . . . . . . . . . . . . . . . . 172Scheduling Onetime Jobs with at . . . . . . . . . . . . 173Scheduling Regularly Occurring Jobs with cron . . . . 176Suspending Jobs . . . . . . . . . . . . . . . . . . . . . . 178Checking Job Status with jobs . . . . . . . . . . . . . . 179Running Jobs in the Background with bg . . . . . . . . 180Running Jobs in the Foreground with fg . . . . . . . . . 181Controlling Job Priority with nice . . . . . . . . . . . . . 182Timing Jobs with time . . . . . . . . . . . . . . . . . . . 183Finding Out What Processes Are Running with ps . . . 185Deleting Processes with kill . . . . . . . . . . . . . . . 187Chapter 10Writing Basic Scripts . . . . . . . . . . . . . . . 189Creating a Shell Script . . . . . . . . . . . . . . . . . . . 191Running a Shell Script . . . . . . . . . . . . . . . . . . . 193Making a Script Executable . . . . . . . . . . . . . . . . 194Getting a Head Start on Scripts with history . . . . . . 196viTable of Contents

Embedding Commands . . . . . . . . . . . . . . . . . . 197Looping Your Scripts . . . . . . . . . . . . . . . . . . . . 199Creating If-Then Statements . . . . . . . . . . . . . . . . 201Accepting Command-Line Arguments inYour Scripts . . . . . . . . . . . . . . . . . . . . . . . . 204Accepting Input While a Script Is Running . . . . . . . .206Debugging Scripts . . . . . . . . . . . . . . . . . . . . .208Chapter 11Sending and Reading Email . . . . . . . . . . . 209Choosing an Email Program and Getting Started . . . . 210Reading Email with alpine . . . . . . . . . . . . . . . . 212Sending Email with alpine . . . . . . . . . . . . . . . . 214Customizing alpine . . . . . . . . . . . . . . . . . . . . 216Reading Email with mutt . . . . . . . . . . . . . . . . . . 218Sending Email with mutt . . . . . . . . . . . . . . . . . .220Reading Email with mail . . . . . . . . . . . . . . . . . . 222Sending Email with mail . . . . . . . . . . . . . . . . . . 223Creating a Signature File . . . . . . . . . . . . . . . . . . 225Automatically Forwarding Incoming Messages . . . . . 227Announcing an Absence with vacation . . . . . . . . . 228Configuring procmail . . . . . . . . . . . . . . . . . . . 230Managing Email with procmail . . . . . . . . . . . . . . 232Chapter 12Accessing the Internet . . . . . . . . . . . . . . 235Getting Familiar with Internet Lingo . . . . . . . . . . . 236Logging In to Remote Systems with ssh . . . . . . . . . 238Logging In to Remote Systems with telnet . . . . . . . 239Communicating with Others Using write . . . . . . . . 241Communicating with Others Using talk . . . . . . . . . 242Getting Files from the Internet with ftp . . . . . . . . . 243Sharing Files on the Internet with ftp . . . . . . . . . . 247Surfing the Web with links . . . . . . . . . . . . . . . . 249Surfing the Web with lynx . . . . . . . . . . . . . . . . . 251Downloading Websites with wget . . . . . . . . . . . . . 253Checking Connections with ping . . . . . . . . . . . . . 254Tracing Connections with traceroute . . . . . . . . . . 255Matching Domain Names with IP Addresses . . . . . . 257Chapter 13Working with Encoded andCompressed Files . . . . . . . . . . . . . . . . . 259Encoding Files with uuencode . . . . . . . . . . . . . . .260Decoding Files with uudecode . . . . . . . . . . . . . . . 263Archiving with tar . . . . . . . . . . . . . . . . . . . . . 264Unarchiving Files with tar . . . . . . . . . . . . . . . . . 266Compressing Files with compress . . . . . . . . . . . . 267Table of Contentsvii

Uncompressing Files with uncompress . . . . . . . . . . 268Zipping a File or Directory with gzip . . . . . . . . . . . 269Unzipping a gzip File with gunzip . . . . . . . . . . . . 270Zipping Files and Directories with zip . . . . . . . . . . 271Unzipping Zipped Files with unzip . . . . . . . . . . . . 272Combining Commands . . . . . . . . . . . . . . . . . . . 273Chapter 14Using Handy Utilities . . . . . . . . . . . . . . . 275Calendaring with cal . . . . . . . . . . . . . . . . . . . . 276Calculating with bc . . . . . . . . . . . . . . . . . . . . . 278Evaluating Expressions with expr . . . . . . . . . . . . . 279Converting with units . . . . . . . . . . . . . . . . . . .280Looking It Up with look . . . . . . . . . . . . . . . . . . 281Keeping a Record of Your Session with script . . . . . 282Getting Back to Your Place with screen . . . . . . . . . 284Acting On Found Files with xargs . . . . . . . . . . . . 286Chapter 15Being Root . . . . . . . . . . . . . . . . . . . . 287Acting Like root with sudo . . . . . . . . . . . . . . . . . 288Becoming root with su . . . . . . . . . . . . . . . . . . . 291Starting, Stopping, and Restarting Daemons . . . . . . 292Changing the System Configuration . . . . . . . . . . . 294Monitoring the System . . . . . . . . . . . . . . . . . . .296Keeping Up with watch . . . . . . . . . . . . . . . . . . .299Checking Boot Messages with dmesg . . . . . . . . . . 300Setting the Date and Time . . . . . . . . . . . . . . . . . 302Chapter 16Sensational Unix Tricks . . . . . . . . . . . . . . 303Cleaning Up HTML Documents with tidy . . . . . . . . 304Searching and Replacing Throughout MultipleDocuments with sed . . . . . . . . . . . . . . . . . . . 307Generating Reports with awk . . . . . . . . . . . . . . . 310Using Input to Customize Your Environment . . . . . . . 311Using ROT13 Encoding with sed . . . . . . . . . . . . . . 313Embedding ROT13 Encoding in a Shell Script . . . . . . 315Making Backups with rsync . . . . . . . . . . . . . . . . 318Using Advanced Redirection with stderr . . . . . . . . 320Appendix A Unix and Linux Reference . . . . . . . . . . . . 323Appendix B What’s What and What’s Where . . . . . . . . . 339Appendix C Commands, Flag

CATEGORY: Unix/Linux LEVEL: Beginning / Intermediate AUTHOR PHOTOS: Deborah and Eric Ray COVER IMAGES: donatas1205 / Shutterstock ISBN-13: ISBN-10: 978-0-321-99754-8 0-321-99754-9 9 780321 997548 53999 Peachpit Press US 39.99 CAN 45.99 UK 21.99 www.peachpit.com DEBORAH S. RAY ERIC J. RAY Unix and Linux Fifth Edition VISUAL QUICKSTART GUIDE .

Related Documents:

Silat is a combative art of self-defense and survival rooted from Matay archipelago. It was traced at thé early of Langkasuka Kingdom (2nd century CE) till thé reign of Melaka (Malaysia) Sultanate era (13th century). Silat has now evolved to become part of social culture and tradition with thé appearance of a fine physical and spiritual .

May 02, 2018 · D. Program Evaluation ͟The organization has provided a description of the framework for how each program will be evaluated. The framework should include all the elements below: ͟The evaluation methods are cost-effective for the organization ͟Quantitative and qualitative data is being collected (at Basics tier, data collection must have begun)

̶The leading indicator of employee engagement is based on the quality of the relationship between employee and supervisor Empower your managers! ̶Help them understand the impact on the organization ̶Share important changes, plan options, tasks, and deadlines ̶Provide key messages and talking points ̶Prepare them to answer employee questions

Dr. Sunita Bharatwal** Dr. Pawan Garga*** Abstract Customer satisfaction is derived from thè functionalities and values, a product or Service can provide. The current study aims to segregate thè dimensions of ordine Service quality and gather insights on its impact on web shopping. The trends of purchases have

On an exceptional basis, Member States may request UNESCO to provide thé candidates with access to thé platform so they can complète thé form by themselves. Thèse requests must be addressed to esd rize unesco. or by 15 A ril 2021 UNESCO will provide thé nomineewith accessto thé platform via their émail address.

Chính Văn.- Còn đức Thế tôn thì tuệ giác cực kỳ trong sạch 8: hiện hành bất nhị 9, đạt đến vô tướng 10, đứng vào chỗ đứng của các đức Thế tôn 11, thể hiện tính bình đẳng của các Ngài, đến chỗ không còn chướng ngại 12, giáo pháp không thể khuynh đảo, tâm thức không bị cản trở, cái được

Food outlets which focused on food quality, Service quality, environment and price factors, are thè valuable factors for food outlets to increase thè satisfaction level of customers and it will create a positive impact through word ofmouth. Keyword : Customer satisfaction, food quality, Service quality, physical environment off ood outlets .

More than words-extreme You send me flying -amy winehouse Weather with you -crowded house Moving on and getting over- john mayer Something got me started . Uptown funk-bruno mars Here comes thé sun-the beatles The long And winding road .