Bash shell

The Bourne-Again SHell (source code), almost always referred to simply as "Bash", interprets and executes input entered from a source such as the user or a program. Bash is an implementation of the shell concept and is often used during Python software development as part of a programmer's development environment.

Bourne-again shell (Bash) logo.

Bash is an implementation of the shells concept. Learn more in the development environments chapter or view the table of contents for all topics.

Bash resources

  • Bash Guide for beginners is an entire book for those new to working with commandlines. It covers commands, paths, Bash shell scripting, variables and many other critical topics that are necessary to move from beginner to advanced Bash user.

  • Advancing in the Bash shell covers important concepts such as bang syntax, movement commands, tab completion and aliases.

  • Mastering Bash and Terminal shows methods for repeating commands, changing directories and handling background processes.

  • Ten Things I Wish I’d Known About Bash covers some edge cases that are very useful to know about such as proper exit code usage and configuration options through the set command. There is also a great follow up post called Ten MORE Things I Wish I'd Known About Bash that covers new topics such as on-the-fly command re-execution using the carrot character. The Seven Surprising Bash Variables post continues the series by examining built-in variables such as PROMPT_COMMAND, CDPATH and REPLY which can simplify your scripts by using values that Bash already has stored for you.

  • Google's Shell Style Guide covers how to write consistent, maintainable shell scripts, which is particularly important if you have ever tried to debug a hacky shell script that was never meant to be used by anyone other than the original author.

  • 101 Bash Commands and Tips for Beginners to Experts is a well-done laundry list of tricks to explore.

  • Bash scripting quirks & safety tips explains Bash basic programming constructs like for loops and variable assignment then goes into ways to avoid weird issues in your code.

  • Safe ways to do things in bash shows you how to not shoot yourself in the foot by using safe coding practices with your shell scripts.

  • The Bash Infinity Framework source code provides boilerplate and a standard library for Bash projects so they are easier to read and maintain. If you have ever tried to read someone else's Bash scripts or even your own after setting them aside for a couple of months, you know that anything which makes readability better is a major step up from vanilla Bash.

  • Static status is a Bash application that generates a hostable, customizable status page for your services.

  • Replacing Bash scripts with Python is a guide on using using Python for administrative scripting, including what to do about replacing invaluable command line tools such as awk, sed and grep.

  • Using Aliases to Speed Up Your Git Workflow has a bunch of shell aliases that make it easier for you to execute complicated or uncommon Git commands.

  • Creating a bash completion script is a great tutorial that walks you through a reasonably complex Bash script for completing syntax in other Bash shell scripts.

  • 6 Tips Before You Write Your Next Bash Cronjob covers starting your scripts with shebang, redirecting output, timeouts and sudo privileges.

  • Better Bash history shows how to make your Bash history more useful by having it store more previous commands (which takes up more persistent storage but is not a huge deal in 2019) and add timestamps to the history command.

  • 9 Evil Bash Commands Explained presents a list of commands you should never run, but can learn about their destructive abilities by reading through the descriptions provided by the author.

  • Bash Quick References is a cheat sheet for common operators and signals that come up when working with scripts.

  • Anybody can write good bash (with a little effort) covers the basics of shell scripting and provides some recommendations for creating more maintainable scripts such as using linters and formatters.

What do you want to learn about Python development?

What editor should I use to code my Python app?

I've built a Python web app, now how do I deploy it?

Tell me about standard relational databases.

Matt Makai 2012-2020