Free Programming Books

6 Excellent Free Books to Learn Bash

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.

5. The Linux Command Line – 5th Edition


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
JavaGeneral-purpose, concurrent, class-based, object-oriented, high-level language
CGeneral-purpose, procedural, portable, high-level language
PythonGeneral-purpose, structured, powerful language
C++General-purpose, portable, free-form, multi-paradigm language
C#Combines the power and flexibility of C++ with the simplicity of Visual Basic
JavaScriptInterpreted, prototype-based, scripting language
PHPPHP has been at the helm of the web for many years
HTMLHyperText Markup Language
SQLAccess and manipulate data held in a relational database management system
RubyGeneral purpose, scripting, structured, flexible, fully object-oriented language
AssemblyAs close to writing machine code without writing in pure hexadecimal
SwiftPowerful and intuitive general-purpose programming language
GroovyPowerful, optionally typed and dynamic language
GoCompiled, statically typed programming language
PascalImperative and procedural language designed in the late 1960s
PerlHigh-level, general-purpose, interpreted, scripting, dynamic language
RDe facto standard among statisticians and data analysts
COBOLCommon Business-Oriented Language
ScalaModern, object-functional, multi-paradigm, Java-based language
FortranThe first high-level language, using the first compiler
ScratchVisual programming language designed for 8-16 year-old children
LuaDesigned as an embeddable scripting language
LogoDialect of Lisp that features interactivity, modularity, extensibility
RustIdeal for systems, embedded, and other performance critical code
LispUnique features - excellent to study programming constructs
AdaALGOL-like programming language, extended from Pascal and other languages
HaskellStandardized, general-purpose, polymorphically, statically typed language
SchemeA general-purpose, functional language descended from Lisp and Algol
PrologA general purpose, declarative, logic programming language
ForthImperative stack-based programming language
ClojureDialect of the Lisp programming language
JuliaHigh-level, high-performance language for technical computing
AwkVersatile language designed for pattern scanning and processing language
CoffeeScriptTranscompiles into JavaScript inspired by Ruby, Python and Haskell
BASICBeginner’s All-purpose Symbolic Instruction Code
ErlangGeneral-purpose, concurrent, declarative, functional language
VimLPowerful scripting language of the Vim editor
OCamlThe main implementation of the Caml language
ECMAScriptBest known as the language embedded in web browsers
BashShell and command language; popular both as a shell and a scripting language
LaTeXProfessional document preparation system and document markup language
TeXMarkup and programming language - create professional quality typeset text
ArduinoInexpensive, flexible, open source microcontroller platform
TypeScriptStrict syntactical superset of JavaScript adding optional static typing
ElixirRelatively new functional language running on the Erlang virtual machine
F#Uses functional, imperative, and object-oriented programming methods
TclDynamic language based on concepts of Lisp, C, and Unix shells
FactorDynamic stack-based programming language
EiffelObject-oriented language designed by Bertrand Meyer
AgdaDependently typed functional language based on intuitionistic Type Theory
IconWide variety of features for processing and presenting symbolic data
XMLRules for defining semantic tags describing structure ad meaning
ValaObject-oriented language, syntactically similar to C#
Standard MLGeneral-purpose functional language characterized as "Lisp with types"
DGeneral-purpose systems programming language with a C-like syntax
Share this article

Share your Thoughts

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