
Linux Shell Scripting Cookbook.
Title:
Linux Shell Scripting Cookbook.
Author:
Lakshman, Sarath.
ISBN:
9781849513777
Personal Author:
Physical Description:
1 online resource (491 pages)
Contents:
Linux Shell Scripting Cookbook -- Table of Contents -- Linux Shell Scripting Cookbook -- Credits -- About the Author -- About the Reviewers -- www.PacktPub.com -- Support files, eBooks, discount offers, and more -- Why Subscribe? -- Free Access for Packt account holders -- Preface -- What this book covers -- What you need for this book -- Who this book is for -- Conventions -- Reader feedback -- Customer support -- Errata -- Piracy -- Questions -- 1. Shell Something Out -- Introduction -- Printing in the terminal -- How to do it... -- There's more... -- Escaping newline in echo -- Printing colored output -- Playing with variables and environment variables -- Getting ready -- How to do it... -- There's more... -- Finding length of string -- Identifying the current shell -- Check for super user -- Modifying the Bash prompt string (username@hostname:~) -- Doing math calculations with the shell -- Getting ready -- How to do it... -- Playing with file descriptors and redirection -- Getting ready -- How to do it... -- There's more... -- Redirection from file to command -- Redirecting from a text block enclosed within a script -- Custom file descriptors -- Arrays and associative arrays -- Getting ready -- How to do it... -- There's more... -- Defining associative arrays -- Listing of array indexes -- Visiting aliases -- Getting ready -- How to do it... -- There's more... -- Escaping aliases -- Grabbing information about terminal -- Getting ready -- How to do it... -- Getting, setting dates, and delays -- Getting ready -- How to do it... -- There's more... -- Producing delays in a script -- Debugging the script -- Getting ready -- How to do it... -- There's more... -- Shebang hack -- Functions and arguments -- How to do it... -- There's more... -- Recursive function -- Exporting functions -- Reading command return value (status).
Passing arguments to commands -- Reading the output of a sequence of commands -- Getting ready -- How to do it... -- There's more... -- Spawning a separate process with subshell -- Subshell quoting to preserve spacing and newline character -- Reading "n" characters without pressing Return -- Getting ready -- How to do it... -- Field separators and iterators -- Getting ready -- How to do it... -- Comparisons and tests -- Getting ready -- How to do it... -- 2. Have a Good Command -- Introduction -- Concatenating with cat -- Getting ready -- How to do it... -- How it works… -- There's more... -- Squeezing blank lines -- Displaying tabs as ^I -- Line numbers -- Recording and playback of terminal sessions -- Getting ready -- How to do it... -- How it works... -- Finding files and file listing -- Getting ready -- How to do it... -- There's more... -- Search based on file name or regular expression match -- Negating arguments -- Search based on the directory depth -- Search based on file type -- Search on up file times -- Search based on file size -- Deleting based on the file matches -- Match based on the file permissions and ownership -- Executing commands or actions with find -- Skip specified directories from the find -- Playing with xargs -- Getting ready -- How to do it... -- How it works… -- There's more... -- Passing formatted arguments to a command by reading stdin -- Using xargs with find -- Counting number of lines of C code in a source code directory over many C files. -- While and subshell trick with stdin -- Translating with tr -- Getting ready -- How to do it... -- How it works… -- There's more... -- Deleting characters using tr -- Complementing character set -- Squeezing characters with tr -- Character classes -- Checksum and verification -- Getting ready -- How to do it... -- How it works... -- There's more... -- Checksum for directories.
Sorting, unique and duplicates -- Getting ready -- How to do it... -- How it works… -- There's more... -- Sort according to the keys or columns -- uniq -- String pattern generation with uniq -- Temporary file naming and random numbers -- How to do it... -- How it works… -- Splitting files and data -- How to do it... -- There's more… -- Specifying filename prefix for the split files -- Slicing filenames based on extension -- How to do it… -- How it works.. -- Renaming and moving files in bulk -- Getting ready -- How to do it... -- How it works… -- Spell checking and dictionary manipulation -- How to do it... -- How it works... -- Automating interactive input -- Getting ready -- How to do it... -- How it works… -- There's more... -- Automating with expect -- 3. File In, File Out -- Introduction -- Generating files of any size -- How to do it... -- Intersection and set difference (A-B) on text files -- Getting ready -- How to do it... -- Finding and deleting duplicate files -- Getting ready -- How to do it... -- How it works... -- See also -- Making directories for a long path -- Getting ready -- How to do it... -- File permissions, ownership, and sticky bit -- Getting ready -- How to do it... -- There's more... -- Changing ownership -- Setting the sticky bit -- Applying permissions recursively to files -- Applying ownership recursively -- Running an executable as a different user (setuid) -- Making files immutable -- Getting ready -- How to do it... -- Generating blank files in bulk -- Getting ready -- How to do it... -- Finding a symbolic link and its target -- Getting ready -- How to do it... -- Enumerating file type statistics -- Getting ready -- How to do it... -- How it works... -- Loopback files and mounting -- Getting ready -- How to do it... -- There's more... -- Mounting ISO files as loopback -- Flush changes immediately with sync.
Creating ISO files, Hybrid ISO -- Getting ready -- How to do it... -- There's more... -- Hybrid ISO that boots off flash drive or hard disk -- Burning an ISO from command line -- Playing with CD Rom tray -- Finding difference between files, patching -- How to do it... -- There's more... -- Generating diff against directories -- head and tail - printing the last or first 10 lines -- How to do it... -- Listing only directories - alternative methods -- Getting ready -- How to do it... -- Fast command-line navigation using pushd and popd -- Getting ready -- How to do it... -- There's more... -- Most frequently used directory switching -- Counting number of lines, words, and characters in a file -- Getting ready -- How to do it... -- There's more... -- Print length of longest length line -- Printing directory tree -- Getting ready -- How to do it... -- There's more... -- HTML output for tree -- 4. Texting and Driving -- Introduction -- Basic regular expression primer -- Getting ready -- How to do it... -- How it works... -- There's more... -- Treatment of special characters -- Searching and mining "text" inside a file with grep -- Getting ready -- How to do it... -- There's more... -- Recursively search many files -- Ignoring case of pattern -- grep by matching multiple patterns -- Include and exclude files (wild card pattern) in grep search -- Using grep with xargs with zero-byte suffix -- Silent output for grep -- Print lines before and after text matches -- Column-wise cutting of a file with cut -- Getting ready -- How to do it... -- There's more... -- Specifying range of characters or bytes as fields -- Frequency of words used in a given file -- Getting ready -- How to do it... -- How it works... -- See also -- Basic sed primer -- How to do it… -- There's more... -- Removing blank lines -- Matched string notation (&) -- Substring match notation (\1).
Combination of multiple expressions -- Quoting -- Basic awk primer -- How to do it… -- How it works… -- There's more… -- Special variables -- Passing a variable value from outside to awk -- Reading a line explicitly using getline -- Filtering lines processed by awk with filter patterns -- Setting delimiter for fields -- Reading command output from awk -- Using loop inside awk -- Replacing strings from a text or file -- Getting ready -- How to do it... -- There's more... -- Making replacement saved in the file -- See also -- Compressing or decompressing JavaScript -- Getting ready -- How to do it... -- How it works... -- See also -- Iterating through lines, words, and characters in a file -- Getting ready -- How to do it... -- How it works... -- See also -- Merging multiple files as columns -- How to do it... -- See also -- Printing the nth word or column in a file or line -- Getting ready -- How to do it... -- See also -- Printing text between line numbers or patterns -- Getting ready -- How to do it... -- See also -- Checking palindrome strings with a script -- Getting ready -- How to do it... -- How it works... -- There's more... -- Simplest and direct method -- See also -- Printing lines in the reverse order -- Getting ready -- How to do it... -- How it works... -- See also -- Parsing e-mail addresses and URLs from text -- Getting ready -- How to do it... -- How it works... -- See also -- Printing n lines before or after a pattern in a file -- Getting ready -- How to do it... -- See also -- Removing a sentence in a file containing a word -- Getting ready -- How to do it... -- How it works... -- See also -- Implementing head, tail, and tac with awk -- Getting ready -- How to do it... -- How it works... -- See also -- Text slicing and parameter operations -- How to do it... -- See also -- 5. Tangled Web? Not At All! -- Introduction.
Downloading from a web page.
Abstract:
This book is written in cookbook style and it offers learning through recipes with examples and illustrations. Each recipe contains step-by-step instructions about everything necessary to execute a particular task. The book is designed so that you can read it from start to end for beginner's or just open up any chapter and start following the recipes as a reference for advanced users. If you are a beginner or an intermediate user who wants to master the skill of quickly writing scripts to perform various tasks without reading the entire man pages, this book is for you. You can start writing scripts and one-liners by simply looking at the similar recipe and its descriptions without any working knowledge of shell scripting or Linux. Intermediate/advanced users as well as system adminstrators/ developers and programmers can use this book as a reference when they face problems while coding.
Local Note:
Electronic reproduction. Ann Arbor, Michigan : ProQuest Ebook Central, 2017. Available via World Wide Web. Access may be limited to ProQuest Ebook Central affiliated libraries.
Genre:
Electronic Access:
Click to View