Home > Store

Practical Guide to Linux Commands, Editors, and Shell Programming, A, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Practical Guide to Linux Commands, Editors, and Shell Programming, A, 3rd Edition

EPUB (Watermarked)

Not for Sale

Description

  • Copyright 2013
  • Dimensions: 7-3/8" x 9-1/8"
  • Edition: 3rd
  • EPUB (Watermarked)
  • ISBN-10: 0-13-308508-2
  • ISBN-13: 978-0-13-308508-2

The Most Useful Tutorial and Reference, with Hundreds of High-Quality Examples for Every Popular Linux Distribution

 

Linux is today’s dominant Internet server platform. System administrators and Web developers need deep Linux fluency, including expert knowledge of shells and the command line. This is the only guide with everything you need to achieve that level of Linux mastery. Renowned Linux expert Mark Sobell has brought together comprehensive, insightful guidance on the tools sysadmins, developers, and power users need most, and has created an outstanding day-to-day reference.

This title is 100 percent distribution and release agnostic. Packed with hundreds of high-quality, realistic examples, it presents Linux from the ground up: the clearest explanations and most useful information about everything from filesystems to shells, editors to utilities, and programming tools to regular expressions.

Use a Mac? You’ll find coverage of the Mac OS X command line, including OS X-only tools and utilities other Linux/UNIX titles ignore. Sobell presents a new MySQL chapter. There’s even an expert introduction to Python–today’s most valuable tool for automating complex, time-consuming administration tasks.

Sample Content

Table of Contents

Preface xxxvii

Chapter 1: Welcome to Linux and Mac OS X 1

The History of UNIX and GNU—Linux 3

What Is So Good About Linux? 6

Overview of Linux 11

Additional Features of Linux 16

Chapter Summary 18

Exercises 18

Part I: The Linux and Mac OS X Operating Systems 21

Chapter 2: Getting Started 23

Conventions Used in This Book 24

Logging In from a Terminal (Emulator) 26

Working from the Command Line 28

su/sudo: Curbing Your Power (root Privileges) 32

Where to Find Documentation 33

More About Logging In and Passwords 42

Chapter Summary 46

Exercises 46

Advanced Exercises 47

Chapter 3: The Utilities 49

Special Characters 50

Basic Utilities 51

Working with Files 53

| (Pipeline): Communicates Between Processes 60

Four More Utilities 61

Compressing and Archiving Files 63

Locating Utilities 68

Displaying User and System Information 70

Communicating with Other Users 74

Email 76

Chapter Summary 76

Exercises 79

Advanced Exercises 80

Chapter 4: The Filesystem 81

The Hierarchical Filesystem 82

Directory Files and Ordinary Files 83

Pathnames 87

Working with Directories 90

Access Permissions 98

ACLs: Access Control Lists 104

Links 109

Chapter Summary 119

Exercises 120

Advanced Exercises 122

Chapter 5: The Shell 125

The Command Line 126

Standard Input and Standard Output 133

Running a Command in the Background 146

Filename Generation/Pathname Expansion 148

Builtins 153

Chapter Summary 153

Exercises 155

Advanced Exercises 156

Part II: The Editors 157

Chapter 6: The vim Editor 159

History 160

Tutorial: Using vim to Create and Edit a File 161

Introduction to vim Features 168

Command Mode: Moving the Cursor 174

Input Mode 178

Command Mode: Deleting and Changing Text 179

Searching and Substituting 183

Miscellaneous Commands 190

Copying, Moving, and Deleting Text 190

Reading and Writing Files 193

Setting Parameters 194

Advanced Editing Techniques 199

Units of Measure 203

Chapter Summary 206

Exercises 211

Advanced Exercises 212

Chapter 7: The emacs Editor 213

History 214

Tutorial: Getting Started with emacs 216

Basic Editing Commands 223

Online Help 229

Advanced Editing 232

Major Modes: Language-Sensitive Editing 246

Customizing emacs 256

More Information 260

Chapter Summary 261

Exercises 269

Advanced Exercises 270

Part III: The Shells 273

Chapter 8: The Bourne Again Shell (bash) 275

Background 276

Startup Files 278

Commands That Are Symbols 281

Redirecting Standard Error 282

Writing and Executing a Simple Shell Script 284

Control Operators: Separate and Group Commands 289

Job Control 294

Manipulating the Directory Stack 297

Parameters and Variables 300

Special Characters 315

Locale 316

Time 320

Processes 323

History 326

Aliases 342

Functions 346

Controlling bash: Features and Options 349

Processing the Command Line 354

Chapter Summary 364

Exercises 366

Advanced Exercises 368

Chapter 9: The TC Shell (tcsh) 369

Shell Scripts 370

Entering and Leaving the TC Shell 371

Features Common to the Bourne Again and TC Shells 373

Redirecting Standard Error 379

Working with the Command Line 380

Variables 385

Control Structures 398

Builtins 407

Chapter Summary 411

Exercises 412

Advanced Exercises 414

Part IV: Programming Tools 415

 

Chapter 10: Programming the Bourne Again Shell (bash) 417

Control Structures 418

File Descriptors 452

Parameters 458

Variables 467

Builtin Commands 476

Expressions 492

Implicit Command-Line Continuation 499

Shell Programs 500

Chapter Summary 510

Exercises 512

Advanced Exercises 514

Chapter 11: The Perl Scripting Language 517

Introduction to Perl 518

Variables 526

Control Structures 533

Working with Files 542

Sort 546

Subroutines 547

Regular Expressions 550

CPAN Modules 555

Examples 558

Chapter Summary 561

Exercises 562

Advanced Exercises 562

Chapter 12: The Python Programming Language 563

Introduction 564

Scalar Variables, Lists, and Dictionaries 568

Control Structures 574

Reading from and Writing to Files 579

Regular Expressions 583

Defining a Function 584

Using Libraries 585

Lambda Functions 589

List Comprehensions 590

Chapter Summary 591

Exercises 592

Advanced Exercises 592

Chapter 13: The MySQL Database Management System 595

Notes 596

Installing a MySQL Server and Client 599

Client Options 600

Setting Up MySQL 601

Creating a Database 603

Adding a User 604

Examples 605

Chapter Summary 617

Exercises 617

Chapter 14: The AWK Pattern Processing Language 619

Syntax 620

Arguments 620

Options 621

Notes 622

Language Basics 622

Examples 629

Advanced gawk Programming 646

Chapter Summary 651

Exercises 651

Advanced Exercises 652

Chapter 15: The sed Editor 653

Syntax 654

Arguments 654

Options 654

Editor Basics 655

Examples 658

Chapter Summary 669

Exercises 669

Part V: Secure Network Utilities 671

 

Chapter 16: The rsync Secure Copy Utility 673

Syntax 674

Arguments 674

Options 675

Examples 677

Chapter Summary 684

Exercises 685

Chapter 17: The OpenSSH Secure Communication Utilities 687

Introduction to OpenSSH 688

Running the ssh, scp, and sftp OpenSSH Clients 691

Tunneling/Port Forwarding 706

Chapter Summary 708

Exercises 709

Advanced Exercises 709

Part VI: Command Reference 711

Utilities That Display and Manipulate Files 713

Network Utilities 714

Utilities That Display and Alter Status 715

Utilities That Are Programming Tools 716

Miscellaneous Utilities 716

Standard Multiplicative Suffixes 717

Common Options 718

The sample Utility 718

sample: Brief description of what the utility does 719

aspell: Checks a file for spelling errors 721

at: Executes commands at a specified time 725

busybox: Implements many standard utilities 729

bzip2: Compresses or decompresses files 732

cal: Displays a calendar 734

cat: Joins and displays files 735

cd: Changes to another working directory 737

chgrp: Changes the group associated with a file 739

chmod: Changes the access mode (permissions) of a file 741

chown: Changes the owner of a file and/or the group the file is associated with 746

cmp: Compares two files 748

comm: Compares sorted files 750

configure: Configures source code automatically 752

cp: Copies files 754

cpio: Creates an archive, restores files from an archive, or copies a directory hierarchy 758

crontab: Maintains crontab files 763

cut: Selects characters or fields from input lines 766

date: Displays or sets the system time and date 769

dd: Converts and copies a file 772

df: Displays disk space usage 775

diff: Displays the differences between two text files 777

diskutil: Checks, modifies, and repairs local volumes (OS X) 782

ditto: Copies files and creates and unpacks archives (OS X) 785

dmesg: Displays kernel messages 787

dscl: Displays and manages Directory Service information (OS X) 788

du: Displays information on disk usage by directory hierarchy and/or file 791

echo: Displays a message 794

expand/unexpand: Converts TABs to SPACEs and SPACEs to TABs 796

expr: Evaluates an expression 798

file: Displays the classification of a file 802

find: Finds files based on criteria 804

finger: Displays information about users 810

fmt: Formats text very simply 812

fsck: Checks and repairs a filesystem 814

ftp: Transfers files over a network 819

gawk: Searches for and processes patterns in a file 825

gcc: Compiles C and C++ programs 826

GetFileInfo: Displays file attributes (OS X) 831

grep: Searches for a pattern in files 833

gzip: Compresses or decompresses files 838

head: Displays the beginning of a file 841

join: Joins lines from two files based on a common field 843

kill: Terminates a process by PID 846

killall: Terminates a process by name 848

launchctl: Controls the launchd daemon (OS X) 850

less: Displays text files, one screen at a time 852

ln: Makes a link to a file 856

lpr: Sends files to printers 858

ls: Displays information about one or more files 861

make: Keeps a set of programs current 869

man: Displays documentation for utilities 875

mc: Manages files in a textual environment (aka Midnight Commander) 879

mkdir: Creates a directory 886

mkfs: Creates a filesystem on a device 887

mv: Renames or moves a file 890

nice: Changes the priority of a command 892

nl: Numbers lines from a file 894

nohup: Runs a command that keeps running after you log out 896

od: Dumps the content of a file 897

open: Opens files, directories, and URLs (OS X) 901

otool: Displays object, library, and executable files (OS X) 903

paste: Joins corresponding lines from files 905

pax: Creates an archive, restores files from an archive, or copies a directory hierarchy 907

plutil: Manipulates property list files (OS X) 913

pr: Paginates files for printing 915

printf: Formats string and numeric data 917

ps: Displays process status 921

renice: Changes the priority of a process 925

rm: Removes a file (deletes a link) 926

rmdir: Removes directories 928

rsync: Copies files and directory hierarchies securely over a network 929

scp: Securely copies one or more files to or from a remote system 930

screen: Manages several textual windows 931

sed: Edits a file noninteractively 937

SetFile: Sets file attributes (OS X) 938

sleep: Creates a process that sleeps for a specified interval 940

sort: Sorts and/or merges files 942

split: Divides a file into sections 951

ssh: Securely executes commands on a remote system 953

sshfs/curlftpfs: Mounts a directory on an OpenSSH or FTP server as a local directory 954

stat: Displays information about files 957

strings: Displays strings of printable characters from files 959

stty: Displays or sets terminal parameters 960

sysctl: Displays and alters kernel variables at runtime 964

tail: Displays the last part (tail) of a file 965

tar: Stores or retrieves files to/from an archive file 968

tee: Copies standard input to standard output and one or more files 973

telnet: Connects to a remote computer over a network 974

test: Evaluates an expression 978

top: Dynamically displays process status 981

touch: Creates a file or changes a file’s access and/or modification time 985

tr: Replaces specified characters 987

tty: Displays the terminal pathname 990

tune2fs: Changes parameters on an ext2, ext3, or ext4 filesystem 991

umask: Specifies the file-creation permissions mask 994

uniq: Displays unique lines from a file 996

w: Displays information about local system users 998

wc: Displays the number of lines, words, and bytes in one or more files 1000

which: Shows where in PATH a utility is located 1001

who: Displays information about logged-in users 1003

xargs: Converts standard input to command lines 1005

Part VII: Appendixes 1009

 

Appendix A: Regular Expressions 1011

Characters 1012

Delimiters 1012

Simple Strings 1012

Special Characters 1012

Rules 1015

Bracketing Expressions 1016

The Replacement String 1016

Extended Regular Expressions 1017

Appendix Summary 1019

Appendix B: Help 1021

Solving a Problem 1022

Finding Linux and OS X Related Information 1023

Specifying a Terminal 1024

Appendix C: Keeping the System Up-to-Date 1027

Using yum 1028

Using apt-get 1034

BitTorrent 1038

Appendix D: Mac OS X Notes 1041

Open Directory 1042

Filesystems 1043

Extended Attributes 1044

Activating the Terminal META Key 1049

Startup Files 1050

Remote Logins 1050

Many Utilities Do Not Respect Apple Human Interface Guidelines 1050

Installing Xcode and MacPorts 1050

Mac OS X Implementation of Linux Features 1051

 

Glossary 1053

File Tree Index 1105

Utility Index 1107

Main Index 1111

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020