Programming Books

6 Excellent Free Books to Learn Bash

Last Updated on May 22, 2022

Bash (acronym for the ‘Bourne-Again-SHell’) is the GNU Project’s shell and programming language. It’s an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). Bash has become a de facto standard for shell scripting. It runs on almost all versions of Unix and a few other operating systems including Windows platforms.

A Unix shell is both a command interpreter and a programming language. As a command interpreter, the shell provides the user interface to various utilities. The programming language features of Bash allow these utilities to be combined. Files containing commands can be developed, and become commands themselves. A shell script is therefore a quick way of prototyping a complex application. Shell scripting follows the classic Unix philosophy of breaking complex projects into simpler subtasks, of chaining together components and utilities.

Like all Unix shells, Bash supports filename globbing (wildcard matching), piping, here documents, command substitution, variables and control structures for condition-testing and iteration. The keywords, syntax and other basic features of the language were all copied from sh.


1. GNU Bash Reference Manual by Chet Ramey, Brian Fox

Bash Reference ManualGNU Bash Reference Manual is the definitive reference for GNU Bash, the standard GNU command-line interpreter.

GNU Bash is a complete implementation of the POSIX2 shell specification (/bin/sh), with additional features from the C-shell (csh) and Korn shell (ksh). The name is an acronym for the ‘Bourne-Again SHell’, a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell sh, which appeared in the Seventh Edition Bell Labs Research version of Unix.

The book explores:

  • Basic Shell Features – briefly summarizes the shell’s ‘building blocks’: commands, control structures, shell functions, shell parameters, shell expansions, redirections, which are a way to direct input and output from and to named files, and how the shell executes commands.
  • Shell Builtin Commands – briefly describes the builtins which Bash inherits from the Bourne Shell, as well as the builtin commands which are unique to or have been extended in Bash.
  • Shell Variables – describes the shell variables that Bash uses. Bash automatically assigns default values to a number of variables.
  • Bash Features – describes features unique to Bash:
    • Invoking Bash – Command line options that you can give to Bash.
    • Bash Startup Files – When and how Bash executes scripts.
    • Interactive Shells – What an interactive shell is.
    • Bash Conditional Expressions – Primitives used in composing expressions for the test builtin.
    • Shell Arithmetic – Arithmetic on shell variables.
    • Aliases – Substituting one command for another.
    • Arrays – Array Variables.
    • The Directory Stack – History of visited directories.
    • Printing a Prompt – Controlling the PS1 string.
    • The Restricted Shell – A more controlled mode of shell execution.
    • Bash POSIX Mode – Making Bash behave more closely to what the POSIX standard specifies.
  • Job Control – discusses what job control is, how it works, and how Bash allows you to access its facilities.
  • Command Line Editing – describes the basic features of the GNU command line editing interface including readline interaction, bindable readline commands, and programmable completion.
  • Using History Interactively – describes how to use the GNU History Library interactively, from a user’s standpoint.
  • Installing Bash – provides basic instructions for installing Bash on the various supported platforms.

Read the book


2. Advanced Bash Scripting Guide by Mendel Cooper

Advanced Bash Scripting GuideAdvanced 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, arithmetic expansion, recess time.
  • Commands – Internal commands and builtins; External filters, programs and commands; System and Administrative Commands.
  • Advanced topics: Regular Expressions, 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.

This book is in the public domain.

Read the book


3. The Linux Command Line by William Shotts

The Linux Command LineThe Linux Command Line includes an excellent primer on Bash scripting. It also offers a broad overview of ‘living’ on the Linux command line.

Unlike some books that concentrate on just a single program, such as the shell, bash, this book will try to convey how to get along with the command line interface in a larger sense. How does it all work? What can it do? What’s the best way to use it?

The book is divided into the following parts:

  • Learning The Shell starts the exploration of the basic language of the command line including such things as the structure of commands, file system navigation, command line editing, and finding help and documentation for commands.
  • Configuration And The Environment covers editing configuration files that control the computer’s operation from the command line.
  • Common Tasks And Essential Tools explores many of the ordinary tasks that are commonly performed from the command line. Unix-like operating systems, such as Linux, contain many ‘classic’ command line programs that are used to perform powerful operations on data.
  • Writing Shell Scripts introduces shell programming, an admittedly rudimentary, but easy to learn, technique for automating many common computing tasks. By learning shell programming, you will become familiar with concepts that can be applied to many other programming languages.

The book is released under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0) license.

Read the book


Next page: Page 2 – Bash Guide for Beginners and more books

Pages in this article:
Page 1 – GNU Bash Reference Manual and more books
Page 2 – Bash Guide for Beginners and more books


All books in this series:

Free Programming Books
AdaALGOL-like programming language, extended from Pascal and other languages
AgdaDependently typed functional language based on intuitionistic Type Theory
ArduinoInexpensive, flexible, open source microcontroller platform
AssemblyAs close to writing machine code without writing in pure hexadecimal
AwkVersatile language designed for pattern scanning and processing language
BashShell and command language; popular both as a shell and a scripting language
BASICBeginner’s All-purpose Symbolic Instruction Code
CGeneral-purpose, procedural, portable, high-level language
C++General-purpose, portable, free-form, multi-paradigm language
C#Combines the power and flexibility of C++ with the simplicity of Visual Basic
ClojureDialect of the Lisp programming language
ClojureScriptCompiler for Clojure that targets JavaScript
COBOLCommon Business-Oriented Language
CoffeeScriptTranscompiles into JavaScript inspired by Ruby, Python and Haskell
CoqDependently typed language similar to Agda, Idris, F* and others
CrystalGeneral-purpose, concurrent, multi-paradigm, object-oriented language
CSSCSS (Cascading Style Sheets) specifies a web page’s appearance
DGeneral-purpose systems programming language with a C-like syntax
DartClient-optimized language for fast apps on multiple platforms
DylanMulti-paradigm language supporting functional and object-oriented coding
ECMAScriptBest known as the language embedded in web browsers
EiffelObject-oriented language designed by Bertrand Meyer
ElixirRelatively new functional language running on the Erlang virtual machine
ErlangGeneral-purpose, concurrent, declarative, functional language
F#Uses functional, imperative, and object-oriented programming methods
FactorDynamic stack-based programming language
ForthImperative stack-based programming language
FortranThe first high-level language, using the first compiler
GoCompiled, statically typed programming language
GroovyPowerful, optionally typed and dynamic language
HaskellStandardized, general-purpose, polymorphically, statically typed language
HTMLHyperText Markup Language
IconWide variety of features for processing and presenting symbolic data
JArray programming language based primarily on APL
JavaGeneral-purpose, concurrent, class-based, object-oriented, high-level language
JavaScriptInterpreted, prototype-based, scripting language
JuliaHigh-level, high-performance language for technical computing
KotlinMore modern version of Java
LabVIEWDesigned to enable domain experts to build power systems quickly
LaTeXProfessional document preparation system and document markup language
LispUnique features - excellent to study programming constructs
LogoDialect of Lisp that features interactivity, modularity, extensibility
LuaDesigned as an embeddable scripting language
MarkdownPlain text formatting syntax designed to be easy-to-read and easy-to-write
Objective-CObject-oriented language that adds Smalltalk-style messaging to C
OCamlThe main implementation of the Caml language
PascalImperative and procedural language designed in the late 1960s
PerlHigh-level, general-purpose, interpreted, scripting, dynamic language
PHPPHP has been at the helm of the web for many years
PostScriptInterpreted, stack-based and Turing complete language
PrologA general purpose, declarative, logic programming language
PureScriptSmall strongly, statically typed language compiling to JavaScript
PythonGeneral-purpose, structured, powerful language
QMLHierarchical declarative language for user interface layout - JSON-like syntax
RDe facto standard among statisticians and data analysts
RacketGeneral-purpose, object-oriented, multi-paradigm, functional language
RakuMember of the Perl family of programming languages
RubyGeneral purpose, scripting, structured, flexible, fully object-oriented language
RustIdeal for systems, embedded, and other performance critical code
ScalaModern, object-functional, multi-paradigm, Java-based language
SchemeA general-purpose, functional language descended from Lisp and Algol
ScratchVisual programming language designed for 8-16 year-old children
SQLAccess and manipulate data held in a relational database management system
Standard MLGeneral-purpose functional language characterized as "Lisp with types"
SwiftPowerful and intuitive general-purpose programming language
TclDynamic language based on concepts of Lisp, C, and Unix shells
TeXMarkup and programming language - create professional quality typeset text
TypeScriptStrict syntactical superset of JavaScript adding optional static typing
ValaObject-oriented language, syntactically similar to C#
VHDLHardware description language used in electronic design automation
VimLPowerful scripting language of the Vim editor
XMLRules for defining semantic tags describing structure ad meaning
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments