售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Bash Cookbook
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Sections
Getting ready
How to do it...
How it works...
There's more...
See also
Get in touch
Reviews
Crash Course in Bash
Getting started with Bash and CLI fundamentals
Your first Bash script with Vim
Creating and using basic variables
Hands-on variable assignment
Hidden Bash variables and reserved words
Conditional logic using if, else, and elseif
Evaluating binary numbers
Evaluating strings
Nested if statements
Case/switch statements and loop constructs
Basic case statement
Basic loops
For loop
Do while loop
Until loop
Using functions and parameters
Using a function with parameters within a for loop
Including source files
Including/importing a library script and using external functions
Retrieving return codes and output
Return code 101
Linking commands, pipes, and input/output
Redirection and pipe bonzanza
Getting program input parameters
Passing your program flags
Getting additional information about commands
Summary
Acting Like a Typewriter and File Explorer
Introduction
Basic searching for strings and files
Getting ready
How to do it...
How it works...
Using wildcards and regexes
Getting ready
How to do it...
How it works...
Math and calculations in script
Getting ready
How to do it...
How it works...
Striping/altering/sorting/deleting/searching strings with Bash only
Getting ready
How to do it...
How it works...
Using SED and AWK to remove/replace substrings
Getting ready
How to do it...
How it works...
Formatting your data/output using echo and printf
Getting ready
How to do it...
How it works...
Readying your script for different languages with internationalization
Getting ready
How to do it...
How it works...
Calculating statistics and reducing duplicates based on file contents
Getting ready
How to do it...
How it works...
Using file attributes with conditional logic
Getting ready
How to do it...
How it works...
Reading delimited data and altered output format
Getting ready
How to do it...
How it works...
Understanding and Gaining File System Mastery
Introduction
Viewing files from various angles – head, tail, less, and more
Getting ready
How to do it...
How it works...
Searching for files by name and/or extension
Getting ready
How to do it...
How it works...
Creating a diff of two files and patching
Getting ready
How to do it...
How it works...
Creating symbolic links and using them effectively
How to do it...
How it works...
Crawling filesystem directories and printing a tree
Getting ready
How to do it...
How it works...
Finding and deleting duplicate files or directories
Getting ready
How to do it...
How it works...
Joining and splitting files at arbitrary positions
Getting ready
How to do it...
How it works...
Generating datasets and random files of various size
Getting ready
How to do it...
How it works...
Making a Script Behave Like a Daemon
Introduction
Running a program continuously (forever) using looping constructs or recursion
Getting ready
How to do it...
How it works...
Keeping programs/scripts running after logoff
Getting ready
How to do it...
How it works...
Invoking commands when they require permissions
Getting ready
How to do it...
How it works...
Sanitizing user input and for repeatable results
Getting ready
How to do it...
How it works...
Making a simple multi-level user menu using select
Getting ready
How to do it...
How it works...
Generating and trapping signals for cleanup
Getting ready
How to do it...
How it works...
Using temporary files and lock files in your program
Getting ready
How to do it...
How it works...
Leveraging timeout when waiting for command completion
Getting ready
How to do it...
How it works...
Creating a file-in-file-out program and running processes in parallel
Getting ready
How to do it...
How it works...
Executing your script on startup
Getting ready
How to do it...
How it works...
Scripts for System Administration Tasks
Introduction
Gathering and aggregating system information
Getting ready
How to do it...
How it works...
Gathering network information and connectivity diagnostics
Getting ready
How to do it...
How it works...
Configuring basic network connectivity
Getting ready
How to do it...
How it works...
Monitoring directories and files
Getting ready
How to do it...
How it works...
Compressing and archiving files
Getting ready
How to do it...
How it works...
Rotating files from RAM to storage for log rotation
Getting ready
How to do it...
Adding configuration to /etc/logrotate.d/
How it works...
Using Linux iptables for a firewall
Getting ready
How to do it...
How it works...
Accessing SQL databases remotely or locally
Getting ready
How to do it...
How it works...
Creating SSH keys for password less remote access
Getting ready
How to do it...
Creating and configuring cron Jobs for task scheduling
How to do it...
How it works...
Creating users and groups systematically
How to do it...
How it works...
Scripts for Power Users
Introduction
Creating Syslog entries and generating an alarm
Getting ready
How to do it...
How it works...
Backing up and erasing media, disks, and partitions with DD
Getting ready
How to do it...
How it works...
Creating graphics and presentations on the CLI
Getting ready
How to do it...
How it works...
Checking for file integrity and tampering
Getting ready
How to do it...
How it works...
Mounting network file systems and retrieving files
Getting ready
How to do it...
How it works...
Browsing the web from the CLI
Getting ready
How to do it...
How it works...
Capturing network traffic headlessly
Getting ready
How to do it...
How it works...
Finding binary dependencies
Getting ready
How to do it...
How it works...
Fetching time from different locations
Getting ready
How to do it...
How it works...
Encrypting/decrypting files from a script
Getting ready
How to do it...
How it works...
Writing Bash to Win and Profit
Introduction
Creating a lame utility HTTP server
Getting ready
How to do it…
How it works…
Parsing RSS feeds and output HTML
Getting ready
How to do it…
How it works…
Scraping the web and collecting files
Getting ready
How to do it…
How it works…
Making a simple IRC chat bot logger
Getting ready
How to do it…
How it works…
Blocking IP addresses from failed SSH attempts
Getting ready
How to do it…
How it works…
Playing and managing audio from Bash
Getting ready
How to do it…
How it works…
Creating a simple NAT and DMZ firewall
Getting ready
How to do it…
How it works…
Parsing a GitHub project and generate a report
Getting ready
How to do it…
How it works…
Creating a poor man's incremental remote backup
Getting ready
How to do it…
How it works…
Using Bash scripts to monitor udev input
Getting ready
How to do it…
How it works…
Using Bash to monitor battery life and optimize it
Getting ready
How to do it…
How it works…
Using chroot and restricted Bash shells to secure scripts
Getting ready
How to do it…
How it works…
Advanced Scripting Techniques
Introduction
Calculating and reducing the runtime of a script
Getting ready
How to do it...
How it works...
Writing one-line conditional statements and loops
Getting ready
How to do it...
How it works...
Avoiding command not found warnings/errors and improving portability
Getting ready
How to do it...
How it works...
Creating a config file and using it in tandem with your scripts
Getting ready
How to do it...
How it works...
Improving your shell – GCC and command line colors
Getting ready
How to do it...
How it works...
Adding aliases, and altering user paths/variables
Getting ready
How to do it...
How it works...
Echoing output to raw terminal devices
Getting ready
How to do it...
How it works...
Creating simple frontend GUIs for Bash scripts
Getting ready
How to do it...
How it works...
Compiling and installing your own Bash shell
Getting ready
How to do it...
How it works...
Recording terminal sessions for automation
Getting ready
How to do it...
How it works...
Writing high-quality scripts by example
Getting ready
How to do it...
How it works...
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜