Skip to Content

Linux Shell Scripting Cookbook Table of Contents


Table of Contents

Preface
Chapter 1: Shell Something Out
Chapter 2: Have a Good Command
Chapter 3: File In, File Out
Chapter 4: Texting and Driving
Chapter 5: Tangled Web? Not At All!
Chapter 6: The Backup Plan
Chapter 7: The Old-boy Network
Chapter 8: Put on the Monitor's Cap
Chapter 9: Administration Calls
Index

  • Chapter 1: Shell Something Out
    • Introduction
    • Printing in the terminal
    • Playing with variables and environment variables
    • Doing math calculations with the shell
    • Playing with file descriptors and redirection
    • Arrays and associative arrays
    • Visiting aliases
    • Grabbing information about terminal
    • Getting, setting dates, and delays
    • Debugging the script
    • Functions and arguments
    • Reading the output of a sequence of commands
    • Reading "n" characters without pressing Return
    • Field separators and iterators
    • Comparisons and tests
    • Chapter 2: Have a Good Command
      • Introduction
      • Concatenating with cat
      • Recording and playback of terminal sessions
      • Finding files and file listing
      • Playing with xargs
      • Translating with tr
      • Checksum and verification
      • Sorting, unique and duplicates
      • Temporary file naming and random numbers
      • Splitting files and data
      • Slicing file names based on extension
      • Renaming and moving files in bulk
      • Spell checking and dictionary manipulation
      • Automating interactive input
      • Chapter 3: File In, File Out
        • Introduction
        • Generating files of any size
        • Intersection and set difference (A-B) on text files
        • Finding and deleting duplicate files
        • Making directories for a long path
        • File permissions, ownership, and sticky bit
        • Making files immutable
        • Generating blank files in bulk
        • Finding a symbolic link and its target
        • Enumerating file type statistics
        • Loopback files and mounting
        • Creating ISO files, Hybrid ISO
        • Finding difference between files, patching
        • head and tail – printing the last or first 10 lines
        • Listing only directories – alternative methods
        • Fast command-line navigation using pushd and popd
        • Counting number of lines, words, and characters in a file
        • Printing directory tree
        • Chapter 4: Texting and Driving
          • Introduction
          • Basic regular expression primer
          • Searching and mining "text" inside a file with grep
          • Column-wise cutting of a file with cut
          • Frequency of words used in a given file
          • Basic sed primer
          • Basic awk primer
          • Replacing strings from a text or file
          • Compressing or decompressing JavaScript
          • Iterating through lines, words, and characters in a file
          • Merging multiple files as columns
          • Printing the nth word or column in a file or line
          • Printing text between line numbers or patterns
          • Checking palindrome strings with a script
          • Printing lines in the reverse order
          • Parsing e-mail addresses and URLs from text
          • Printing n lines before or after a pattern in a file
          • Removing a sentence in a file containing a word
          • Implementing head, tail, and tac with awk
          • Text slicing and parameter operations
          • Chapter 5: Tangled Web? Not At All!
            • Introduction
            • Downloading from a web page
            • Downloading a web page as formatted plain text
            • A primer on cURL
            • Accessing Gmail from the command line
            • Parsing data from a website
            • Image crawler and downloader
            • Web photo album generator
            • Twitter command-line client
            • define utility with Web backend
            • Finding broken links in a website
            • Tracking changes to a website
            • Posting to a web page and reading response
            • Chapter 6: The Backup Plan
              • Introduction
              • Archiving with tar
              • Archiving with cpio
              • Compressing with gunzip (gzip)
              • Compressing with bunzip (bzip)
              • Compressing with lzma
              • Archiving and compressing with zip
              • squashfs – the heavy compression filesystem
              • Cryptographic tools and hashes
              • Backup snapshots with rsync
              • Version control based backup with Git
              • Cloning hard drive and disks with dd
              • Chapter 7: The Old-boy Network
                • Introduction
                • Basic networking primer
                • Let's ping!
                • Listing all the machines alive on a network
                • Transferring files
                • Setting up an Ethernet and wireless LAN with script
                • Password-less auto-login with SSH
                • Running commands on remote host with SSH
                • Mounting a remote drive at a local mount point
                • Multi-casting window messages on a network
                • Network traffic and port analysis
                • Chapter 8: Put on the Monitor's Cap
                  • Introduction
                  • Disk usage hacks
                  • Calculating execution time for a command
                  • Information about logged users, boot logs, and failure boot
                  • Printing the 10 most frequently-used commands
                  • Listing the top 10 CPU consuming process in a hour
                  • Monitoring command outputs with watch
                  • Logging access to files and directories
                  • Logfile management with logrotate
                  • Logging with syslog
                  • Monitoring user logins to find intruders
                  • Remote disk usage health monitor
                  • Finding out active user hours on a system
                  • Chapter 9: Administration Calls
                    • Introduction
                    • Gathering information about processes
                    • Killing processes and send or respond to signals
                    • which, whereis, file, whatis, and loadavg explained
                    • Sending messages to user terminals
                    • Gathering system information
                    • Using /proc – gathering information
                    • Scheduling with cron
                    • Writing and reading MySQL database from Bash
                    • User administration script
                    • Bulk image resizing and format conversion

                    Book backreference: 
                    Awards Voting Nominations Previous Winners
                    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                    Resources
                    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                    Open Source Content Management Customer Relationship Management e-Commerce e-Learning Java Linux Servers Networking & Telephony PHP Web Graphics & Video Web Development
                    Enterprise BPEL Microsoft Oracle SOA Web Services
                    Other Packt Books .Net Web Graphics & Video Beginner Guides Cookbooks