The Linux Command Line
The Linux Command Line
Fifth Internet Edition
William Shotts
A Book
Copyright ?2008-2019, William E. Shotts, Jr.
This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License. To view a copy of this license, visit the link above or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042.
A version of this book is also available in printed form, published by No Starch Press. Copies may be purchased wherever fine books are sold. No Starch Press also offers electronic formats for popular e-readers. They can be reached at: .
Linux? is the registered trademark of Linus Torvalds. All other trademarks belong to their respective owners.
This book is part of the project, a site for Linux education and advocacy devoted to helping users of legacy operating systems migrate into the future. You may contact the project at .
Release History
Version 19.01A 19.01 17.10 16.07 13.07 09.12
Date January 28, 2019 January 17, 2019 October 19, 2017 July 28, 2016 July 6, 2013 December 14, 2009
Description Fifth Internet Edition (Corrected TOC) Fifth Internet Edition. Fourth Internet Edition. Third Internet Edition. Second Internet Edition. First Internet Edition.
Table of Contents
Introduction....................................................................................................xvi
Why Use the Command Line?......................................................................................xvi What This Book Is About..............................................................................................xvii Who Should Read This Book.......................................................................................xvii What's in This Book.....................................................................................................xviii How To Read This Book................................................................................................xix
Prerequisites............................................................................................................xix Why I Don't Call It "GNU/Linux"...........................................................................xix
What's New in the Fifth Internet Edition.........................................................................xx Acknowledgments..........................................................................................................xx
First Internet Edition..................................................................................................xx Second Internet Edition............................................................................................xxi Third Internet Edition................................................................................................xxi Fourth Internet Edition..............................................................................................xxi Fifth Internet Edition.................................................................................................xxi Your Feedback Is Needed!............................................................................................xxi Further Reading............................................................................................................xxi Colophon......................................................................................................................xxii
Part 1 ? Learning the Shell...............................................................1
1 ? What Is the Shell?......................................................................................2
Terminal Emulators..........................................................................................................2 Making Your First Keystrokes..........................................................................................2
Command History.......................................................................................................3 Cursor Movement.......................................................................................................3
A Few Words About Mice and Focus.....................................................................3 Try Some Simple Commands..........................................................................................4 Ending a Terminal Session..............................................................................................5
The Console Behind the Curtain...........................................................................5 Summing Up....................................................................................................................5 Further Reading...............................................................................................................6
2 ? Navigation...................................................................................................7
Understanding the File System Tree...............................................................................7 The Current Working Directory........................................................................................7 Listing the Contents of a Directory..................................................................................8
i
Changing the Current Working Directory........................................................................9 Absolute Pathnames..................................................................................................9 Relative Pathnames...................................................................................................9 Some Helpful Shortcuts............................................................................................11 Important Facts About Filenames........................................................................11
Summing Up..................................................................................................................12
3 ? Exploring the System..............................................................................13
Having More Fun with ls................................................................................................13 Options and Arguments............................................................................................14 A Longer Look at Long Format.................................................................................16
Determining a File's Type with file.................................................................................17 Viewing File Contents with less.....................................................................................17
What Is "Text"?.....................................................................................................17 Less Is More........................................................................................................19 Taking a Guided Tour.....................................................................................................19 Symbolic Links...............................................................................................................23 Hard Links.....................................................................................................................24 Summing Up..................................................................................................................24 Further Reading.............................................................................................................24
4 ? Manipulating Files and Directories........................................................25
Wildcards.......................................................................................................................25 Character Ranges................................................................................................27 Wildcards Work in the GUI Too............................................................................27
mkdir ? Create Directories.............................................................................................28 cp ? Copy Files and Directories....................................................................................28
Useful Options and Examples..................................................................................29 mv ? Move and Rename Files.......................................................................................30
Useful Options and Examples..................................................................................30 rm ? Remove Files and Directories...............................................................................31
Useful Options and Examples..................................................................................32 Be Careful with rm!..............................................................................................33
ln ? Create Links............................................................................................................33 Hard Links................................................................................................................33 Symbolic Links..........................................................................................................34
Let's Build a Playground................................................................................................34 Creating Directories..................................................................................................34 Copying Files............................................................................................................35 Moving and Renaming Files.....................................................................................36 Creating Hard Links..................................................................................................37 Creating Symbolic Links...........................................................................................38 Removing Files and Directories...............................................................................39 Creating Symlinks With The GUI.........................................................................41
Summing Up..................................................................................................................41 Further Reading.............................................................................................................41
5 ? Working with Commands........................................................................42
What Exactly Are Commands?......................................................................................42 Identifying Commands...................................................................................................43
ii
type ? Display a Command's Type...........................................................................43 which ? Display an Executable's Location...............................................................43 Getting a Command's Documentation..........................................................................44 help ? Get Help for Shell Builtins..............................................................................44 --help ? Display Usage Information..........................................................................45 man ? Display a Program's Manual Page................................................................46 apropos ? Display Appropriate Commands..............................................................47 whatis ? Display One-line Manual Page Descriptions..............................................48
The Most Brutal Man Page Of Them All..............................................................48 info ? Display a Program's Info Entry.......................................................................48 README and Other Program Documentation Files................................................50 Creating Our Own Commands with alias......................................................................50 Summing Up..................................................................................................................52 Further Reading.............................................................................................................52
6 ? Redirection................................................................................................54
Standard Input, Output, and Error.................................................................................54 Redirecting Standard Output.........................................................................................55 Redirecting Standard Error............................................................................................57
Redirecting Standard Output and Standard Error to One File.................................57 Disposing of Unwanted Output.................................................................................58
/dev/null In Unix Culture......................................................................................58 Redirecting Standard Input............................................................................................58
cat ? Concatenate Files............................................................................................59 Pipelines........................................................................................................................61
The Difference Between > and |..........................................................................61 Filters........................................................................................................................62 uniq - Report or Omit Repeated Lines......................................................................62 wc ? Print Line, Word, and Byte Counts...................................................................63 grep ? Print Lines Matching a Pattern......................................................................63 head / tail ? Print First / Last Part of Files................................................................64 tee ? Read from Stdin and Output to Stdout and Files............................................65 Summing Up..................................................................................................................66
Linux Is About Imagination..................................................................................66
7 ? Seeing the World as the Shell Sees It....................................................68
Expansion......................................................................................................................68 Pathname Expansion...............................................................................................69 Pathname Expansion of Hidden Files.................................................................70 Tilde Expansion........................................................................................................70 Arithmetic Expansion................................................................................................71 Brace Expansion......................................................................................................72 Parameter Expansion...............................................................................................73 Command Substitution.............................................................................................74
Quoting..........................................................................................................................75 Double Quotes..........................................................................................................76 Single Quotes...........................................................................................................78 Escaping Characters................................................................................................78 Backslash Escape Sequences............................................................................79
Summing Up..................................................................................................................79
iii
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- server setup basic settings crushftp
- the operating system linux and programming languages
- the linux command line
- netcat tutorial eindhoven university of technology
- linux administrator s quick reference card
- lab 1 packet sniffing and wireshark
- linux fundamentals university of chicago
- official user guide linux mint
- linux shell scripting tutorial v2
Related searches
- linux command line pdf
- linux command line commands
- linux command line cheat sheet
- linux command line in windows
- linux command line cheat sheets
- linux command line switches
- linux command line rename file
- linux command line tutorial
- linux command line base64 decode
- linux command line basics
- the linux command line pdf
- linux command line book