Quick Start Guide
IV The Bash Shell 189
17 Shell Basics 191
17.1 Starting a Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
17.2 Entering Commands .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
17.3 Working with Files and Directories ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 195
17.4 Becoming Root . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 199
17.5 File Access Permissions ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
17.6 Useful Features of the Shell .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 205
17.7 Editing Texts ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 208
17.8 Searching for Files or Contents .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
17.9 Viewing Text Files . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 211
17.10 Redirection and Pipes ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 211
17.11 Starting Programs and Handling Processes ... . . . . . . . . . . . . . . . . . . . . . . . . . 213
17.12 Important Linux Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
18 Bash and Bash Scripts 225
18.1 What is “The Shell”? .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
18.2 Writing Shell Scripts ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18.3 Redirecting Command Events . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 231
18.4 Using Aliases . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 232
18.5 Using Variables in Bash . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 232
18.6 Grouping And Combining Commands . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 235
18.7 Working with Common Flow Constructs ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 235
18.8 For More Information .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 236
A Help and Troubleshooting 237
A.1 Help and Documentation .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 237
A.2 Common Problems and Their Solutions .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
A.3 Legal Notice .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 269
A.4 GNU Free Documentation License .... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . 269










