Skip to content

pure bash bible

A reference book of bash snippets that replace external commands with built-in shell features.

Stars
41.7k
Forks
3.7k
Licence
MIT
Language
Shell
Last update
2.9 years ago
Type
Learning resource

This repository is archived and no longer maintained.

What it is

This is a free reference book of shell scripting recipes for bash. Each entry shows how to do a common task, such as trimming a string, reading a file, or getting terminal size, using only bash's built-in features instead of calling outside programs like sed, awk, or cut. The README says the goal is to remove unneeded dependencies from scripts and, in most cases, make them faster.

  • Trim whitespace or change case of a string without calling tr or sed
  • Read a file into a variable or array without calling cat
  • Get the terminal size or cursor position from inside a script
  • Look up a bash parameter expansion or conditional form when writing a script

Great for

  • Bash scripters who want fewer external dependencies in their scripts
  • People learning bash internals and what the shell can do on its own
  • Maintainers of portable command-line tools who want to reduce process spawning
  • Readers who want a searchable list of snippets to copy from

Not ideal for

  • People who need POSIX sh portability: the README points to a separate pure-sh-bible project for that
  • Anyone wanting a finished application, since this is a collection of snippets, not a program
  • Beginners with no shell basics, since entries assume familiarity with bash syntax

How to get it

  1. 1

    Read it online

    You'll need: bash

    Clone the repository to read it locally

    git clone https://github.com/dylanaraps/pure-bash-bible
  2. 2

    Run it

    • Open the README or the Leanpub book in a browser
    • Pick a topic from the table of contents, such as Strings or File Handling
    • Copy a snippet into your script and test it in your bash version
  3. 3

    Get the most out of it

    • Check the CONTRIBUTING.md file to see how the unit tests are organized
    • Use the table of contents to jump directly to the task you need
    • Compare each snippet against the external-command version to confirm the speed or dependency benefit for your case

Downloads

Strengths

  • The README states snippets are linted with shellcheck and tested where applicable
  • Covers a broad range of topics, from strings and arrays to terminal escape sequences
  • Free to read online, with a paid edition on Leanpub that the author links to

Trade-offs

  • The repository was archived, so it is no longer updated (last push 2023-11-28)
  • Snippets target bash specifically and will not run in plain POSIX sh
  • The README is truncated here, so the full contents could not be verified

How it compares

ProjectStarsTypeLevelUpdatedBest for
pure-bash-bible (this)41.7kLearning resourceintermediate2.9 years agoBash scripters who want fewer external dependencies in their scripts
java8-tutorial16.7kLearning resourcebeginner3.2 years agoJava developers who work on older Java code and want to learn Java 8 features
nvm95.7kDev toolbeginner8 days agoDevelopers who work on several Node.js projects that need different versions
zoxide40.4kDev toolbeginner4 days agoDevelopers who move between many project folders in a terminal
atuin32.2kDev toolbeginner4 days agoDevelopers who work in a terminal and often need to find past commands
asdf25.6kDev toolbeginner5 days agoDevelopers who work on several projects that need different language versions

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.