ENGLISH

The Linux Command Line

Book information

ISBN
1593279523, 9781593279523, 9781593273897, 1593273894, 2011029198
Language
english
Format
PDF
Filesize
9 MB (9142350 bytes)
Edition
2
Pages
\505
Time added
2022-10-01 20:53:31

Description

Acknowledgments Introduction Why Use the Command Line? What This Book Is About Who Should Read This Book What’s in This Book How to Read This Book Prerequisites What’s New in the Second Edition Your Feedback Is Needed! Part I: Learning the Shell Chapter 1: What Is the Shell? Terminal Emulators Making Your First Keystrokes Command History Cursor Movement Try Some Simple Commands Ending a Terminal Session Summing Up Chapter 2: Navigation Understanding the File System Tree The Current Working Directory Listing the Contents of a Directory Changing the Current Working Directory Absolute Pathnames Relative Pathnames Some Helpful Shortcuts Summing Up Chapter 3: Exploring the System More Fun with ls Options and Arguments A Longer Look at Long Format Determining a File’s Type with file Viewing File Contents with less Taking a Guided Tour Symbolic Links Hard Links Summing Up Chapter 4: Manipulating Files and Directories Wildcards mkdir—Create Directories cp—Copy Files and Directories Useful Options and Examples mv—Move and Rename Files Useful Options and Examples rm—Remove Files and Directories Useful Options and Examples ln—Create Links Hard Links Symbolic Links Building a Playground Creating Directories Copying Files Moving and Renaming Files Creating Hard Links Creating Symbolic Links Removing Files and Directories Summing Up Chapter 5: Working with Commands What Exactly Are Commands? Identifying Commands type—Display a Command’s Type which—Display an Executable’s Location Getting a Command’s Documentation help—Get Help for Shell Builtins --help—Display Usage Information man—Display a Program’s Manual Page info—Display a Program’s Info Entry whatis—Display One-line Manual Page Descriptions apropos—Display Appropriate Commands Creating Our Own Commands with alias Summing Up README and Other Program Documentation Files Chapter 6: Redirection Standard Input, Output, and Error Redirecting Standard Output Redirecting Standard Error Redirecting Standard Output and Standard Error to One File Disposing of Unwanted Output Redirecting Standard Input cat: Concatenate Files Pipelines Filters tee: Read from Stdin and Output to Stdout and Files head/tail: Print First/Last Part of Files grep: Print Lines Matching a Pattern wc: Print Line, Word, and Byte Counts uniq: Report or Omit Repeated Lines Summing Up Chapter 7: Seeing the World as the Shell Sees It Expansion Pathname Expansion Tilde Expansion Command Substitution Brace Expansion Arithmetic Expansion Quoting Double Quotes Single Quotes Escaping Characters Backslash Escape Sequences Summing Up Parameter Expansion Chapter 8: Advanced Keyboard Tricks Command Line Editing Cursor Movement Modifying Text Cutting and Pasting (Killing and Yanking) Text Completion Using History Searching History History Expansion Summing Up Chapter 9: Permissions Owners, Group Members, and Everybody Else Reading, Writing, and Executing chmod: Change File Mode umask: Set Default Permissions Setting File Mode with the GUI Changing Identities su: Run a Shell with Substitute User and Group IDs sudo: Execute a Command As Another User chgrp: Change Group Ownership chown: Change File Owner and Group Exercising Our Privileges Changing Your Password Summing Up Some Special Permissions Chapter 10: Processes How a Process Works Viewing Processes Viewing Processes Dynamically with top Controlling Processes Interrupting a Process Putting a Process in the Background Returning a Process to the Foreground Stopping (Pausing) a Process Signals Sending Signals to Processes with kill Sending Signals to Multiple Processes with killall Shutting Down the System More Process-Related Commands Summing Up Part II: Configuration and the Environment Chapter 11: The Environment What Is Stored in the Environment? Examining the Environment Some Interesting Variables How Is the Environment Established? What’s in a Startup File? Modifying the Environment Which Files Should We Modify? Text Editors Using a Text Editor Activating Our Changes Summing Up Chapter 12: A Gentle Introduction to vi Why We Should Learn vi A Little Background Starting and Stopping vi Editing Modes Entering Insert Mode Saving Our Work Moving the Cursor Around Basic Editing Appending Text Opening a Line Deleting Text Cutting, Copying, and Pasting Text Joining Lines Search-and-Replace Searching Within a Line Searching the Entire File Global Search-and-Replace Editing Multiple Files Switching Between Files Opening Additional Files for Editing Copying Content from One File into Another Inserting an Entire File into Another Saving Our Work Summing Up Chapter 13: Customizing the Prompt Anatomy of a Prompt Trying Some Alternative Prompt Designs Adding Color Moving the Cursor Saving the Prompt Summing Up Part III: Common Tasks and Essential Tools Chapter 14: Package Management Packaging Systems How a Package System Works Package Files Repositories Dependencies High- and Low-Level Package Tools Common Package Management Tasks Finding a Package in a Repository Installing a Package from a Repository Installing a Package from a Package File Removing a Package Updating Packages from a Repository Upgrading a Package from a Package File Listing Installed Packages Determining Whether a Package Is Installed Displaying Information About an Installed Package Finding Which Package Installed a File Summing Up Chapter 15: Storage Media Mounting and Unmounting Storage Devices Viewing a List of Mounted File Systems Determining Device Names Creating New File Systems Manipulating Partitions with fdisk Creating a New File System with mkfs Testing and Repairing File Systems Moving Data Directly to and from Devices Creating CD-ROM Images Creating an Image Copy of a CD-ROM Creating an Image from a Collection of Files Writing CD-ROM Images Mounting an ISO Image Directly Blanking a Rewritable CD-ROM Writing an Image Summing Up Extra Credit Chapter 16: Networking Examining and Monitoring a Network ping traceroute ip netstat Transporting Files over a Network ftp lftp—a Better ftp wget Secure Communication with Remote Hosts ssh scp and sftp Summing Up Chapter 17: Searching for Files locate—Find Files the Easy Way find—Find Files the Hard Way xargs Improving Efficiency User-Defined Actions Predefined Actions Operators Tests find Options A Return to the Playground Summing Up Chapter 18: Archiving and Backup Compressing Files gzip bzip2 Archiving Files tar zip Synchronizing Files and Directories Using rsync over a Network Summing Up Chapter 19: Regular Expressions What Are Regular Expressions? grep Metacharacters and Literals The Any Character Anchors Bracket Expressions and Character Classes Negation Traditional Character Ranges POSIX Character Classes POSIX Basic vs. Extended Regular Expressions Alternation Quantifiers ? —Match an Element Zero or One Time * —Match an Element Zero or More Times +—Match an Element One or More Times { }—Match an Element a Specific Number of Times Putting Regular Expressions to Work Validating a Phone List with grep Finding Ugly Filenames with find Searching for Files with locate Searching for Text with less and vim Summing Up Chapter 20: Text Processing Applications of Text Documents Web Pages Email Printer Output Program Source Code Revisiting Some Old Friends cat uniq sort Slicing and Dicing cut—Remove Sections from Each Line of Files join—Join Lines of Two Files on a Common Field paste—Merge Lines of Files Comparing Text comm—Compare Two Sorted Files Line by Line diff—Compare Files Line by Line patch—Apply a diff to an Original Editing on the Fly tr—Transliterate or Delete Characters aspell—Interactive Spellchecker sed—Stream Editor for Filtering and Transforming Text Summing Up Extra Credit Chapter 21: Formatting Output Simple Formatting Tools nl—Number Lines fold—Wrap Each Line to a Specified Length fmt—A Simple Text Formatter pr—Format Text for Printing printf—Format and Print Data Document Formatting Systems groff Summing Up Chapter 22: Printing A Brief History of Printing Printing in the Dim Times Character-Based Printers Graphical Printers Printing with Linux Preparing Files for Printing pr—Convert Text Files for Printing Sending a Print Job to a Printer lpr—Print Files (Berkeley Style) lp—Print Files (System V Style) Another Option: a2ps Monitoring and Controlling Print Jobs lpstat—Display Print System Status lpq—Display Printer Queue Status lprm/cancel—Cancel Print Jobs Summing Up Chapter 23: Compiling Programs What Is Compiling? Are All Programs Compiled? Compiling a C Program Obtaining the Source Code Examining the Source Tree Building the Program Installing the Program Summing Up Part IV: Writing Shell Scripts Chapter 24: Writing Your First Script What Are Shell Scripts? How to Write a Shell Script Script File Format Executable Permissions Script File Location Good Locations for Scripts More Formatting Tricks Long Option Names Indentation and Line Continuation Summing Up Chapter 25: Starting a Project First Stage: Minimal Document Second Stage: Adding a Little Data Variables and Constants Assigning Values to Variables and Constants Here Documents Summing Up Chapter 26: Top-Down Design Shell Functions Local Variables Keep Scripts Running Summing Up Chapter 27: Flow Control: Branching with if if Statements Exit Status Using test File Expressions String Expressions Integer Expressions A More Modern Version of test (( ))—Designed for Integers Combining Expressions Control Operators: Another Way to Branch Summing Up Chapter 28: Reading Keyboard Input read—Read Values from Standard Input Options IFS Validating Input Menus Summing Up Extra Credit Chapter 29: Flow Control: Looping with while/until Looping while Breaking Out of a Loop until Reading Files with Loops Summing Up Chapter 30: Troubleshooting Syntactic Errors Missing Quotes Missing or Unexpected Tokens Unanticipated Expansions Logical Errors Defensive Programming Watch Out for Filenames Verifying Input Testing Test Cases Debugging Finding the Problem Area Tracing Examining Values During Execution Summing Up Chapter 31: Flow Control: Branching with case The case Command Patterns Performing Multiple Actions Summing Up Chapter 32: Positional Parameters Accessing the Command Line Determining the Number of Arguments shift—Getting Access to Many Arguments Simple Applications Using Positional Parameters with Shell Functions Handling Positional Parameters en Masse A More Complete Application Summing Up Chapter 33: Flow Control: Looping with for for: Traditional Shell Form for: C Language Form Summing Up Chapter 34: Strings and Numbers Parameter Expansion Basic Parameters Expansions to Manage Empty Variables Expansions That Return Variable Names String Operations Case Conversion Arithmetic Evaluation and Expansion Number Bases Unary Operators Simple Arithmetic Assignment Bit Operations Logic bc—An Arbitrary Precision Calculator Language Using bc An Example Script Summing Up Extra Credit Chapter 35: Arrays What Are Arrays? Creating an Array Assigning Values to an Array Accessing Array Elements Array Operations Outputting the Entire Contents of an Array Determining the Number of Array Elements Finding the Subscripts Used by an Array Adding Elements to the End of an Array Sorting an Array Deleting an Array Associative Arrays Summing Up Chapter 36: Exotica Group Commands and Subshells Process Substitution Traps Asynchronous Execution with wait Named Pipes Setting Up a Named Pipe Using Named Pipes Summing Up Index

Similar books