Transcription of THE LINUX ˚˛ ˇ ˝˛ COMMAND LINE - No Starch Press
1 You ve experienced the shiny, point-and-click surface of your LINUX computer now dive below and explore its depths with the power of the COMMAND LINUX COMMAND line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular LINUX shell. Along the way you ll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, COMMAND chaining, pattern matching with regular expressions, and addition to that practical knowledge, author William Shotts reveals the philosophy behind these tools and the rich heritage that your desktop LINUX machine has inherited from Unix supercomputers of you make your way through the book s short, easily digestible chapters, you ll learn how to.
2 Create and delete files, directories, and symlinks Administer your system, including networking, package installation, and process managementBANISH YOUR MOUSEBANISH YOUR MOUSE Use standard input and output, redirection, and pipelines Edit files with Vi, the world s most popular text editor Write shell scripts to automate common or boring tasks Slice and dice text files with cut, paste, grep, patch, and sedOnce you overcome your initial shell shock, you ll find that the COMMAND line is a natural and expressive way to communicate with your computer. Just don t be surprised if your mouse starts to gather THE AUTHORW illiam E. Shotts, Jr., has been a software professional and avid LINUX user for more than 15 years.
3 He has an extensive background in software development, including technical support, quality assurance, and documentation. He is also the creator of , a LINUX education and advocacy site featuring news, reviews, and extensive support for using the LINUX COMMAND IN :COMPUTERS/ LINUX $ ($ CDN) FINEST IN GEEK ENTERTAINMENT FSC LOGO I LIE FLAT. This book uses RepKover a durable binding that won t snap COMPLETE INTRODUCTIONTHE LINUXCOMMAND LINETHE LINUXCOMMAND LINEWILLIAM E. SHOTTS, LINUX COMMAND LINETHE LINUX COMMAND LINESHOTTSCONTENTS IN DETAILACKNOWLEDGMENTS xxiiiINTRODUCTIONxxvWhy Use the COMMAND line ?..xxviWhat This Book Is Should Read This s in This to Read This 1 LEARNING THE SHELL1 WHAT IS THE SHELL?
4 3 Terminal First Some Simple a Terminal the Filesystem Current Working the Contents of a the Current Working Helpful LINUX COMMAND line 2012 William E. Shotts, THE SYSTEM13 More Fun with and Longer Look at Long a File s Type with File Contents with Guided FILES AND Create Copy Files and Move and Rename Remove Files and Directories ..31ln Create s Build a and Renaming Hard Symbolic Files and WITH COMMANDS39 What Exactly Are Commands?..40 Identifying Display a COMMAND s Display an Executable s a COMMAND s Get Help for Shell - help Display Usage Display a Program s Manual Display Appropriate Display a Very Brief Description of a Display a Program s Info and Other Program Documentation Your Own Commands with Old Contents in DetailThe LINUX COMMAND line 2012 William E.
5 Shotts, Input, Output, and Standard Standard Standard Output and Standard Error to One of Unwanted Standard Report or Omit Repeated Print line , Word, and Byte Print Lines Matching a Print First/Last Part of Read from Stdin and Output to Stdout and THE WORLD AS THE SHELL SEES KEYBOARD TRICKS69 COMMAND line and Pasting (Killing and Yanking) in Detail xiThe LINUX COMMAND line 2012 William E. Shotts, , Group Members, and Everybody , Writing, and Change File File Mode with the Set Default Run a Shell with Substitute User and Group Execute a COMMAND as Another Change File Owner and Change Group Your Your a Process Processes with Processes Dynamically with a a Process in the a Process to the (Pausing) a Signals to Processes with Signals to Multiple Processes with Process-Related 2 CONFIGURATION AND THE ENVIRONMENT11 THE ENVIRONMENT109 What Is Stored in the Environment?
6 110 Examining the Interesting Is the Environment Established?..112 Login and Non-login s in a Startup File?..113xii Contents in DetailThe LINUX COMMAND line 2012 William E. Shotts, the Files Should We Modify?..115 Text a Text Our GENTLE INTRODUCTION TO VI121 Why We Should Learn Little and Stopping Insert Our the Cursor a , Copying, and Pasting and Within a the Entire Search and Multiple Between Additional Files for Content from One File into an Entire File into Our THE PROMPT139 Anatomy of a Some Alternative Prompt the the in Detail xiiiThe LINUX COMMAND line 2012 William E. Shotts, 3 COMMON TASKS AND ESSENTIAL TOOLS14 PACKAGE MANAGEMENT149 Packaging a Package System and Low-Level Package Package Management a Package in a a Package from a a Package from a Package a Packages from a a Package from a Package Installed Whether a Package Is Information About an Installed Which Package Installed a MEDIA159 Mounting and Unmounting Storage a List of Mounted Device New Partitions with a New Filesystem with and Repairing Floppy Data Directly to and from CD-ROM an Image Copy of a an Image from a Collection of CD-ROM an ISO Image a Rewritable an Contents in DetailThe LINUX COMMAND line 2012
7 William E. Shotts, and Monitoring a Send a Special Packet to a Network Trace the Path of a Network Examine Network Settings and Files over a Transfer Files with the File Transfer A Better Non-interactive Network Communication with Remote Securely Log in to Remote and sftp Securely Transfer FOR FILES187locate Find Files the Easy Find Files the Hard Return to the AND BACKUP201 Compressing Compress or Expand Higher Compression at the Cost of Tape Archiving Package and Compress Files and Remote File and Directory rsync over a EXPRESSIONS215 What Are Regular Expressions?..216grep Search Through and Any in Detail xvThe LINUX COMMAND line 2012 William E.
8 Shotts, Expressions and Character Character Character Basic vs. Extended Regular Match an Element Zero Times or One * Match an Element Zero or More + Match an Element One or More { } Match an Element a Specific Number of Regular Expressions to a Phone List with Ugly Filenames with for Files with for Text with less and PROCESSING233 Applications of Source Some Old Concatenate Files and Print on Standard Sort Lines of Text Report or Omit Repeated and Remove Sections from Each line of Merge Lines of Join Lines of Two Files on a Common Compare Two Sorted Files line by Compare Files line by Apply a diff to an on the Transliterate or Delete Stream Editor for Filtering and Transforming
9 Interactive Spell Contents in DetailThe LINUX COMMAND line 2012 William E. Shotts, OUTPUT267 Simple Formatting Number Wrap Each line to a Specified A Simple Text Format Text for Format and Print Formatting roff Family and A Document Formatting Brief History of in the Dim with Files for Convert Text Files for a Print Job to a Printer ..290lpr Print Files (Berkeley Style)..290lp Print Files (System V Style)..291 Another Option: and Controlling Print Display Print System Display Printer Queue and cancel Cancel Print PROGRAMS297 What Is Compiling?..298 Are All Programs Compiled?..299 Compiling a C the Source the Source the the in Detail xviiThe LINUX COMMAND line 2012 William E.
10 Shotts, 4 WRITING SHELL SCRIPTS24 WRITING YOUR FIRST SCRIPT309 What Are Shell Scripts?..309 How to Write a Shell File File Locations for Formatting Option and line A PROJECT315 First Stage: Minimal Stage: Adding a Little and Variables and Values to Variables and DESIGN325 Shell Scripts CONTROL: BRANCHING WITH IF333 Using Contents in DetailThe LINUX COMMAND line 2012 William E. Shotts, More Modern Version of (( )) Designed for Operators: Another Way to KEYBOARD INPUT347read Read Values from Standard Input Fields with CONTROL: LOOPING WITH WHILE AND out of a Files with or Unexpected the Problem Values During in Detail xixThe LINUX COMMAND line 2012 William E.