Bash Notes for Professionals book

    Amazing collection of free programming books

    收集中
    免費
    Amazing collection of free programming books

    The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified

    Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners

    https://goalkicker.com/

    章節目錄

    • 1-1
      Content list
    • 1-2
      About
    • 1-3
      Chapter 1: Getting started with Bash
    • 1-4
      Section 1.1: Hello World
    • 1-5
      Section 1.2: Hello World Using Variables
    • 1-6
      Section 1.3: Hello World with User Input
    • 1-7
      Section 1.4: Importance of Quoting in Strings
    • 1-8
      Section 1.5: Viewing information for Bash built-ins
    • 1-9
      Section 1.6: Hello World in "Debug" mode
    • 1-10
      Section 1.7: Handling Named Arguments
    • 1-11
      Chapter 2: Script shebang
    • 1-12
      Section 2.1: Env shebang
    • 1-13
      Section 2.2: Direct shebang
    • 1-14
      Section 2.3: Other shebangs
    • 1-15
      Chapter 3: Navigating directories
    • 1-16
      Section 3.1: Absolute vs relative directories
    • 1-17
      Section 3.2: Change to the last directory
    • 1-18
      Section 3.3: Change to the home directory
    • 1-19
      Section 3.4: Change to the Directory of the Script
    • 1-20
      Chapter 4: Listing Files
    • 1-21
      Section 4.1: List Files in a Long Listing Format
    • 1-22
      Section 4.2: List the Ten Most Recently Modified Files
    • 1-23
      Section 4.3: List All Files Including Dotfiles
    • 1-24
      Section 4.4: List Files Without Using `ls`
    • 1-25
      Section 4.5: List Files
    • 1-26
      Section 4.6: List Files in a Tree-Like Format
    • 1-27
      Section 4.7: List Files Sorted by Size
    • 1-28
      Chapter 5: Using cat
    • 1-29
      Section 5.1: Concatenate files
    • 1-30
      Section 5.2: Printing the Contents of a File
    • 1-31
      Section 5.3: Write to a file
    • 1-32
      Section 5.4: Show non printable characters
    • 1-33
      Section 5.5: Read from standard input
    • 1-34
      Section 5.6: Display line numbers with output
    • 1-35
      Section 5.7: Concatenate gzipped files
    • 1-36
      Chapter 6: Grep
    • 1-37
      Section 6.1: How to search a file for a pattern
    • 1-38
      Chapter 7: Aliasing
    • 1-39
      Section 7.1: Bypass an alias
    • 1-40
      Section 7.2: Create an Alias
    • 1-41
      Section 7.3: Remove an alias
    • 1-42
      Section 7.4: The BASH_ALIASES is an internal bash assoc array
    • 1-43
      Section 7.5: Expand alias
    • 1-44
      Section 7.6: List all Aliases
    • 1-45
      Chapter 8: Jobs and Processes
    • 1-46
      Section 8.1: Job handling
    • 1-47
      Section 8.2: Check which process running on specific port
    • 1-48
      Section 8.3: Disowning background job
    • 1-49
      Section 8.4: List Current Jobs
    • 1-50
      Section 8.5: Finding information about a running process
    • 1-51
      Section 8.6: List all processes
    • 1-52
      Chapter 9: Redirection
    • 1-53
      Section 9.1: Redirecting standard output
    • 1-54
      Section 9.2: Append vs Truncate
    • 1-55
      Section 9.3: Redirecting both STDOUT and STDERR
    • 1-56
      Section 9.4: Using named pipes
    • 1-57
      Section 9.5: Redirection to network addresses
    • 1-58
      Section 9.6: Print error messages to stderr
    • 1-59
      Section 9.7: Redirecting multiple commands to the same file
    • 1-60
      Section 9.8: Redirecting STDIN
    • 1-61
      Section 9.9: Redirecting STDERR
    • 1-62
      Section 9.10: STDIN, STDOUT and STDERR explained
    • 1-63
      Chapter 10: Control Structures
    • 1-64
      Section 10.1: Conditional execution of command lists
    • 1-65
      Section 10.2: If statement
    • 1-66
      Section 10.3: Looping over an array
    • 1-67
      Section 10.4: Using For Loop to List Iterate Over Numbers
    • 1-68
      Section 10.5: continue and break
    • 1-69
      Section 10.6: Loop break
    • 1-70
      Section 10.7: While Loop
    • 1-71
      Section 10.8: For Loop with C-style syntax
    • 1-72
      Section 10.9: Until Loop
    • 1-73
      Section 10.10: Switch statement with case
    • 1-74
      Section 10.11: For Loop without a list-of-words parameter
    • 1-75
      Chapter 11: true, false and : commands
    • 1-76
      Section 11.1: Infinite Loop
    • 1-77
      Section 11.2: Function Return
    • 1-78
      Section 11.3: Code that will always/never be executed
    • 1-79
      Chapter 12: Arrays
    • 1-80
      Section 12.1: Array Assignments
    • 1-81
      Section 12.2: Accessing Array Elements
    • 1-82
      Section 12.3: Array Modification
    • 1-83
      Section 12.4: Array Iteration
    • 1-84
      Section 12.5: Array Length
    • 1-85
      Section 12.6: Associative Arrays
    • 1-86
      Section 12.7: Looping through an array
    • 1-87
      Section 12.8: Destroy, Delete, or Unset an Array
    • 1-88
      Section 12.9: Array from string
    • 1-89
      Section 12.10: List of initialized indexes
    • 1-90
      Section 12.11: Reading an entire file into an array
    • 1-91
      Section 12.12: Array insert function
    • 1-92
      Chapter 13: Associative arrays
    • 1-93
      Section 13.1: Examining assoc arrays
    • 1-94
      Chapter 14: Functions
    • 1-95
      Section 14.1: Functions with arguments
    • 1-96
      Section 14.2: Simple Function
    • 1-97
      Section 14.3: Handling flags and optional parameters
    • 1-98
      Section 14.4: Print the function definition
    • 1-99
      Section 14.5: A function that accepts named parameters
    • 1-100
      Section 14.6: Return value from a function
    • 1-101
      Section 14.7: The exit code of a function is the exit code of its last command
    • 1-102
      Chapter 15: Bash Parameter Expansion
    • 1-103
      Section 15.1: Modifying the case of alphabetic characters
    • 1-104
      Section 15.2: Length of parameter
    • 1-105
      Section 15.3: Replace pattern in string
    • 1-106
      Section 15.4: Substrings and subarrays
    • 1-107
      Section 15.5: Delete a pattern from the beginning of a string
    • 1-108
      Section 15.6: Parameter indirection
    • 1-109
      Section 15.7: Parameter expansion and filenames
    • 1-110
      Section 15.8: Default value substitution
    • 1-111
      Section 15.9: Delete a pattern from the end of a string
    • 1-112
      Section 15.10: Munging during expansion
    • 1-113
      Section 15.11: Error if variable is empty or unset
    • 1-114
      Chapter 16: Copying (cp)
    • 1-115
      Section 16.1: Copy a single file
    • 1-116
      Section 16.2: Copy folders
    • 1-117
      Chapter 17: Find
    • 1-118
      Section 17.1: Searching for a file by name or extension
    • 1-119
      Section 17.2: Executing commands against a found file
    • 1-120
      Section 17.3: Finding file by access / modification time
    • 1-121
      Section 17.4: Finding files according to size
    • 1-122
      Section 17.5: Filter the path
    • 1-123
      Section 17.6: Finding files by type
    • 1-124
      Section 17.7: Finding files by specific extension
    • 1-125
      Chapter 18: Using sort
    • 1-126
      Section 18.1: Sort command output
    • 1-127
      Section 18.2: Make output unique
    • 1-128
      Section 18.3: Numeric sort
    • 1-129
      Section 18.4: Sort by keys
    • 1-130
      Chapter 19: Sourcing
    • 1-131
      Section 19.1: Sourcing a file
    • 1-132
      Section 19.2: Sourcing a virtual environment
    • 1-133
      Chapter 20: Here documents and here strings
    • 1-134
      Section 20.1: Execute command with here document
    • 1-135
      Section 20.2: Indenting here documents
    • 1-136
      Section 20.3: Create a file
    • 1-137
      Section 20.4: Here strings
    • 1-138
      Section 20.5: Run several commands with sudo
    • 1-139
      Section 20.6: Limit Strings
    • 1-140
      Chapter 21: Quoting
    • 1-141
      Section 21.1: Double quotes for variable and command substitution
    • 1-142
      Section 21.2: Dierence between double quote and single quote
    • 1-143
      Section 21.3: Newlines and control characters
    • 1-144
      Section 21.4: Quoting literal text
    • 1-145
      Chapter 22: Conditional Expressions
    • 1-146
      Section 22.1: File type tests
    • 1-147
      Section 22.2: String comparison and matching
    • 1-148
      Section 22.3: Test on exit status of a command
    • 1-149
      Section 22.4: One liner test
    • 1-150
      Section 22.5: File comparison
    • 1-151
      Section 22.6: File access tests
    • 1-152
      Section 22.7: Numerical comparisons
    • 1-153
      Chapter 23: Scripting with Parameters
    • 1-154
      Section 23.1: Multiple Parameter Parsing
    • 1-155
      Section 23.2: Argument parsing using a for loop
    • 1-156
      Section 23.3: Wrapper script
    • 1-157
      Section 23.4: Accessing Parameters
    • 1-158
      Section 23.5: Split string into an array in Bash
    • 1-159
      Chapter 24: Bash history substitutions
    • 1-160
      Section 24.1: Quick Reference
    • 1-161
      Section 24.2: Repeat previous command with sudo
    • 1-162
      Section 24.3: Search in the command history by pattern
    • 1-163
      Section 24.4: Switch to newly created directory with !#:N
    • 1-164
      Section 24.5: Using !$
    • 1-165
      Section 24.6: Repeat the previous command with a substitution
    • 1-166
      Chapter 25: Math
    • 1-167
      Section 25.1: Math using dc
    • 1-168
      Section 25.2: Math using bash capabilities
    • 1-169
      Section 25.3: Math using bc
    • 1-170
      Section 25.4: Math using expr
    • 1-171
      Chapter 26: Bash Arithmetic
    • 1-172
      Section 26.1: Simple arithmetic with (( ))
    • 1-173
      Section 26.2: Arithmetic command
    • 1-174
      Section 26.3: Simple arithmetic with expr
    • 1-175
      Chapter 27: Scoping
    • 1-176
      Section 27.1: Dynamic scoping in action
    • 1-177
      Chapter 28: Process substitution
    • 1-178
      Section 28.1: Compare two files from the web
    • 1-179
      Section 28.2: Feed a while loop with the output of a command
    • 1-180
      Section 28.3: Concatenating files
    • 1-181
      Section 28.4: Stream a file through multiple programs at once
    • 1-182
      Section 28.5: With paste command
    • 1-183
      Section 28.6: To avoid usage of a sub-shell
    • 1-184
      Chapter 29: Programmable completion
    • 1-185
      Section 29.1: Simple completion using function
    • 1-186
      Section 29.2: Simple completion for options and filenames
    • 1-187
      Chapter 30: Customizing PS1
    • 1-188
      Section 30.1: Colorize and customize terminal prompt
    • 1-189
      Section 30.2: Show git branch name in terminal prompt
    • 1-190
      Section 30.3: Show time in terminal prompt
    • 1-191
      Section 30.4: Show a git branch using PROMPT_COMMAND
    • 1-192
      Section 30.5: Change PS1 prompt
    • 1-193
      Section 30.6: Show previous command return status and time
    • 1-194
      Chapter 31: Brace Expansion
    • 1-195
      Section 31.1: Modifying filename extension
    • 1-196
      Section 31.2: Create directories to group files by month and year
    • 1-197
      Section 31.3: Create a backup of dotfiles
    • 1-198
      Section 31.4: Use increments
    • 1-199
      Section 31.5: Using brace expansion to create lists
    • 1-200
      Section 31.6: Make Multiple Directories with Sub-Directories
    • 1-201
      Chapter 32: getopts : smart positional-parameter parsing
    • 1-202
      Section 32.1: pingnmap
    • 1-203
      Chapter 33: Debugging
    • 1-204
      Section 33.1: Checking the syntax of a script with "-n"
    • 1-205
      Section 33.2: Debugging using bashdb
    • 1-206
      Section 33.3: Debugging a bash script with "-x"
    • 1-207
      Chapter 34: Pattern matching and regular expressions
    • 1-208
      Section 34.1: Get captured groups from a regex match against a string
    • 1-209
      Section 34.2: Behaviour when a glob does not match anything
    • 1-210
      Section 34.3: Check if a string matches a regular expression
    • 1-211
      Section 34.4: Regex matching
    • 1-212
      Section 34.5: The * glob
    • 1-213
      Section 34.6: The ** glob
    • 1-214
      Section 34.7: The ? glob
    • 1-215
      Section 34.8: The [ ] glob
    • 1-216
      Section 34.9: Matching hidden files
    • 1-217
      Section 34.10: Case insensitive matching
    • 1-218
      Section 34.11: Extended globbing
    • 1-219
      Chapter 35: Change shell
    • 1-220
      Section 35.1: Find the current shell
    • 1-221
      Section 35.2: List available shells
    • 1-222
      Section 35.3: Change the shell
    • 1-223
      Chapter 36: Internal variables
    • 1-224
      Section 36.1: Bash internal variables at a glance
    • 1-225
      Section 36.2: $@
    • 1-226
      Section 36.3: $#
    • 1-227
      Section 36.4: $HISTSIZE
    • 1-228
      Section 36.5: $FUNCNAME
    • 1-229
      Section 36.6: $HOME
    • 1-230
      Section 36.7: $IFS
    • 1-231
      Section 36.8: $OLDPWD
    • 1-232
      Section 36.9: $PWD
    • 1-233
      Section 36.10: $1 $2 $3 etc..
    • 1-234
      Section 36.11: $*
    • 1-235
      Section 36.12: $!
    • 1-236
      Section 36.13: $?
    • 1-237
      Section 36.14: $$
    • 1-238
      Section 36.15: $RANDOM
    • 1-239
      Section 36.16: $BASHPID
    • 1-240
      Section 36.17: $BASH_ENV
    • 1-241
      Section 36.18: $BASH_VERSINFO
    • 1-242
      Section 36.19: $BASH_VERSION
    • 1-243
      Section 36.20: $EDITOR
    • 1-244
      Section 36.21: $HOSTNAME
    • 1-245
      Section 36.22: $HOSTTYPE
    • 1-246
      Section 36.23: $MACHTYPE
    • 1-247
      Section 36.24: $OSTYPE
    • 1-248
      Section 36.25: $PATH
    • 1-249
      Section 36.26: $PPID
    • 1-250
      Section 36.27: $SECONDS
    • 1-251
      Section 36.28: $SHELLOPTS
    • 1-252
      Section 36.29: $_
    • 1-253
      Section 36.30: $GROUPS
    • 1-254
      Section 36.31: $LINENO
    • 1-255
      Section 36.32: $SHLVL
    • 1-256
      Section 36.33: $UID
    • 1-257
      Chapter 37: Job Control
    • 1-258
      Section 37.1: List background processes
    • 1-259
      Section 37.2: Bring a background process to the foreground
    • 1-260
      Section 37.3: Restart stopped background process
    • 1-261
      Section 37.4: Run command in background
    • 1-262
      Section 37.5: Stop a foreground process
    • 1-263
      Chapter 38: Case statement
    • 1-264
      Section 38.1: Simple case statement
    • 1-265
      Section 38.2: Case statement with fall through
    • 1-266
      Section 38.3: Fall through only if subsequent pattern(s) match
    • 1-267
      Chapter 39: Read a file (data stream, variable) line-by-line (and/or field-by-field)?
    • 1-268
      Section 39.1: Looping through a file line by line
    • 1-269
      Section 39.2: Looping through the output of a command field by field
    • 1-270
      Section 39.3: Read lines of a file into an array
    • 1-271
      Section 39.4: Read lines of a string into an array
    • 1-272
      Section 39.5: Looping through a string line by line
    • 1-273
      Section 39.6: Looping through the output of a command line by line
    • 1-274
      Section 39.7: Read a file field by field
    • 1-275
      Section 39.8: Read a string field by field
    • 1-276
      Section 39.9: Read fields of a file into an array
    • 1-277
      Section 39.10: Read fields of a string into an array
    • 1-278
      Section 39.11: Reads file (/etc/passwd) line by line and field by field
    • 1-279
      Chapter 40: File execution sequence
    • 1-280
      Section 40.1: .profile vs .bash_profile (and .bash_login)
    • 1-281
      Chapter 41: Splitting Files
    • 1-282
      Section 41.1: Split a file
    • 1-283
      Chapter 42: File Transfer using scp
    • 1-284
      Section 42.1: scp transferring file
    • 1-285
      Section 42.2: scp transferring multiple files
    • 1-286
      Section 42.3: Downloading file using scp
    • 1-287
      Chapter 43: Pipelines
    • 1-288
      Section 43.1: Using |&
    • 1-289
      Section 43.2: Show all processes paginated
    • 1-290
      Section 43.3: Modify continuous output of a command
    • 1-291
      Chapter 44: Managing PATH environment variable
    • 1-292
      Section 44.1: Add a path to the PATH environment variable
    • 1-293
      Section 44.2: Remove a path from the PATH environment variable
    • 1-294
      Chapter 45: Word splitting
    • 1-295
      Section 45.1: What, when and Why?
    • 1-296
      Section 45.2: Bad eects of word splitting
    • 1-297
      Section 45.3: Usefulness of word splitting
    • 1-298
      Section 45.4: Splitting by separator changes
    • 1-299
      Section 45.5: Splitting with IFS
    • 1-300
      Section 45.6: IFS & word splitting
    • 1-301
      Chapter 46: Avoiding date using printf
    • 1-302
      Section 46.1: Get the current date
    • 1-303
      Section 46.2: Set variable to current time
    • 1-304
      Chapter 47: Using "trap" to react to signals and system events
    • 1-305
      Section 47.1: Introduction: clean up temporary files
    • 1-306
      Section 47.2: Catching SIGINT or Ctl+C
    • 1-307
      Section 47.3: Accumulate a list of trap work to run at exit
    • 1-308
      Section 47.4: Killing Child Processes on Exit
    • 1-309
      Section 47.5: react on change of terminals window size
    • 1-310
      Chapter 48: Chain of commands and operations
    • 1-311
      Section 48.1: Counting a text pattern ocurrence
    • 1-312
      Section 48.2: transfer root cmd output to user file
    • 1-313
      Section 48.3: logical chaining of commands with && and ||
    • 1-314
      Section 48.4: serial chaining of commands with semicolon
    • 1-315
      Section 48.5: chaining commands with |
    • 1-316
      Chapter 49: Type of Shells
    • 1-317
      Section 49.1: Start an interactive shell
    • 1-318
      Section 49.2: Detect type of shell
    • 1-319
      Section 49.3: Introduction to dot files
    • 1-320
      Chapter 50: Color script output (cross-platform)
    • 1-321
      Section 50.1: color-output.sh
    • 1-322
      Chapter 51: co-processes
    • 1-323
      Section 51.1: Hello World
    • 1-324
      Chapter 52: Typing variables
    • 1-325
      Section 52.1: declare weakly typed variables
    • 1-326
      Chapter 53: Jobs at specific times
    • 1-327
      Section 53.1: Execute job once at specific time
    • 1-328
      Section 53.2: Doing jobs at specified times repeatedly using systemd.timer
    • 1-329
      Chapter 54: Handling the system prompt
    • 1-330
      Section 54.1: Using the PROMPT_COMMAND envrionment variable
    • 1-331
      Section 54.2: Using PS2
    • 1-332
      Section 54.3: Using PS3
    • 1-333
      Section 54.4: Using PS4
    • 1-334
      Section 54.5: Using PS1
    • 1-335
      Chapter 55: The cut command
    • 1-336
      Section 55.1: Only one delimiter character
    • 1-337
      Section 55.2: Repeated delimiters are interpreted as empty fields
    • 1-338
      Section 55.3: No quoting
    • 1-339
      Section 55.4: Extracting, not manipulating
    • 1-340
      Chapter 56: Bash on Windows 10
    • 1-341
      Section 56.1: Readme
    • 1-342
      Chapter 57: Cut Command
    • 1-343
      Section 57.1: Show the first column of a file
    • 1-344
      Section 57.2: Show columns x to y of a file
    • 1-345
      Chapter 58: global and local variables
    • 1-346
      Section 58.1: Global variables
    • 1-347
      Section 58.2: Local variables
    • 1-348
      Section 58.3: Mixing the two together
    • 1-349
      Chapter 59: CGI Scripts
    • 1-350
      Section 59.1: Request Method: GET
    • 1-351
      Section 59.2: Request Method: POST /w JSON
    • 1-352
      Chapter 60: Select keyword
    • 1-353
      Section 60.1: Select keyword can be used for getting input argument in a menu format
    • 1-354
      Chapter 61: When to use eval
    • 1-355
      Section 61.1: Using Eval
    • 1-356
      Section 61.2: Using Eval with Getopt
    • 1-357
      Chapter 62: Networking With Bash
    • 1-358
      Section 62.1: Networking commands
    • 1-359
      Chapter 63: Parallel
    • 1-360
      Section 63.1: Parallelize repetitive tasks on list of files
    • 1-361
      Section 63.2: Parallelize STDIN
    • 1-362
      Chapter 64: Decoding URL
    • 1-363
      Section 64.1: Simple example
    • 1-364
      Section 64.2: Using printf to decode a string
    • 1-365
      Chapter 65: Design Patterns
    • 1-366
      Section 65.1: The Publish/Subscribe (Pub/Sub) Pattern
    • 1-367
      Chapter 66: Pitfalls
    • 1-368
      Section 66.1: Whitespace When Assigning Variables
    • 1-369
      Section 66.2: Failed commands do not stop script execution
    • 1-370
      Section 66.3: Missing The Last Line in a File
    • 1-371
      Appendix A: Keyboard shortcuts
    • 1-372
      Section A.1: Editing Shortcuts
    • 1-373
      Section A.2: Recall Shortcuts
    • 1-374
      Section A.3: Macros
    • 1-375
      Section A.4: Custome Key Bindings
    • 1-376
      Section A.5: Job Control
    • 1-377
      Credits
    • 1-378
      You may also like

    常見問答

    您可以透過手機、平板或是電腦登入 HiSKIO 平台,在【我的學習】>【我的書籍】頁面,選擇想看的電子書。

    猜你喜歡

    用戶評價

    | 收集中

    銷售方案