Library

12 Remarkable Free Shell Scripting Books

Last Updated on March 19, 2024

A shell script is a computer program designed to be run by the Unix shell, a command line interpreter. It is a text file containing a sequence of shell commands and constructs that perform a routine task. This sequence is typically executed by entering the name of the script on the command line. Alternatively, a script can be initialised using cron, a time-based job scheduler. It makes little sense to continually type a sequence of commands at a command prompt, particularly if they are long, complex, or difficult to remember. Scripting offers the virtue of alleviating this unnecessary burden.

A shell is a user interface for access to an operating system’s services. It translates command lines typed at a terminal into system actions. The shell has built-in functions, which it performs directly, but most commands execute external programs. Linux has a wide range of text shells, such as Bash (Bourne Again SHell), Korn shell, C shell, tcsh, zsh, and the Bourne sh.

The main advantage of writing a shell script is that the commands and syntax are identical to typing them on the command line. In this way, the user does not have to learn a new language. Shell scripts enable lengthy and repetitive sequences of commands to be formed into a single, simple command. It enables new commands to be created, and enable external programs to be wrapped into an environment you can control. Shell scripts are often used in system administration, system boot scripts, application startup scripts, automation, package installation tools, and so much more.

A few of the books featured in this article are not specifically about shell scripting. However, they offer an excellent introduction to using the command line and are recommended for anyone wanting to fully exploit shell scripting.

The focus of this article is to select the finest shell scripting books which are available to download for free. Many of the books featured here can also be freely distributed. So get reading, learning and sharing.

1. Conquering the Command Line

By Mark Bates (HTML; 155 pages)Conquering the Command Line

Conquering the Command Line offers the reader the opportunity to master and conquer the most valuable and useful command line tools for Unix and Linux based systems.

In this book the reader not only learns the most useful command line tools, but also the most helpful options and flags for those tools. Conquering the Command Line is not a rehash of the manual pages of each tool, but a human-readable walk-through of these tools to make you instantly more productive in your daily development life.

Chapters cover:

  • Basics and Navigation – provides a firm grasp on the basics of how to use the Unix (or Linux) command line
  • Ack/Ag – looks at two tools that can help make searching a large number of files fast and easy
  • cURL – a tool for working with URLs. cURL queries a URL from the command line
  • Find – looks at some of the most useful features of the find command
  • Grep – a tool for searching files for search terms, similar to ack or ag
  • Ps – looks at the most useful flags and options to use with ps
  • Sed – a stream editor that lets you quickly edit files or streams using pattern matching and replacements
  • Tar – quickly join together multiple files into one larger file, while still preserving meta-data such as Unix permissions
  • Extras – contains a few little extra commands

2. Advanced Bash Scripting Guide

By Mendel Cooper (PDF, HTML; 945 pages)Advanced Bash Scripting Guide

Advanced Bash-Scripting Guide is an in-depth exploration of the art of scripting. Almost the complete set of commands, utilities, and tools is available for invocation by a shell script.

The book explains:

  • Basics such as special characters, quoting, exit and exit status
  • Beyond the Basics including loops and branches, command substitution, arithmetric expansion, recess time
  • Commands – Internal commands and builtins; External filters, programs and commands; System and Administrative Commands
  • Advanced topics: Regular Expressons, Here Documents, I/O Redirection, Subshells, Restricted Shells, Process Substitution, Functions, Aliases, List Constructs, Arrays, Indirect References, /dev and /proc, Of Zeros and Nulls, Debugging, Options, Gotchas, Scripting with Style

3. Bash Guide for Beginners

By Machtelt Garrels (PDF, HTML; 165 pages)Bash Guide for Beginners

Everybody working on a UNIX or UNIX-like system who wants to make life easier on themselves, power users and sysadmins alike, can benefit from reading this book.

Explores:

  • Bash scripts
  • Writing and debugging scripts
  • The bash environment: Shell initialization files, Variables, Quoting characters, Shell expansion, aliases
  • Regular expressions
  • sed stream editor
  • awk programming language
  • Conditional statements (if, if/then/else, if/then/elif/else, Nested if statements, Boolean operations)
  • Writing interactive scripts
  • Repetitive tasks
  • Functions
  • Catching signals

4. Learn Vimscript the Hard Way

By Steve Losh (HTML; 241 pages)Learn Vimscript the Hard Way

Learn Vimscript the Hard Way is a book for users of the Vim text editor who want to learn how to customize it.

Sections cover:

  • Basic Vim commands that you can use in your ~/.vimrc file to customize Vim quickly land easily
  • Looks more deeply at Vimscript as a programming language, covering things like variables, conditionals, comparisons, functions, strings, string functions and more
  • Create a sample plugin intended for distribution to other Vim users. The plugin add support for the Potion programming language, a very small language

The source code to the book is available on BitBucket and on GitHub. To use this book you should have the latest version of Vim installed, which is version 7.3 at the time of this writing.

Next Section: 12 Remarkable Free Shell Scripting Books – Part 2

This article is divided into three parts:

Part 1, Part 2, Part 3

Best Free and Open Source SoftwareRead our complete collection of recommended free and open source software. Our curated compilation covers all categories of software.

The software collection forms part of our series of informative articles for Linux enthusiasts. There are hundreds of in-depth reviews, open source alternatives to proprietary software from large corporations like Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

There are also fun things to try, hardware, free programming books and tutorials, and much more.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our FAQ before making a comment.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments