bash guide
Is there a command guide available for the shell environment accessed by the Terminal application?
MacBook Pro (2017 – 2020)
Is there a command guide available for the shell environment accessed by the Terminal application?
MacBook Pro (2017 – 2020)
Apple uses an ancient version of Bash 3.2.57 iniitially released in 2006, and due to GNU's GPL3 licensing, Apple will not install a more recent version of Bash (e.g. 5.2) that is installed on most Linux systems. Instead, Apple is committed to providing the Zsh shell which has an MIT license. Learning the Zsh shell would be more strategic for you in future releases of macOS.
Here is a direct link to a PDF Bash 3.2 Reference Manual from Sept 2006. Almost all of the Bash related articles in a Google search are by those running later versions of Bash on Linux and some of that syntax is not implemented in Bash on macOS.
Apple provides the following:
Terminal User Guide for Mac - Apple Support
If you launch the Terminal, you can produce a PDF fromf the Bash 3.2.57 man page. You can copy and paste this in the Terminal followed by a return:
/usr/bin/mandoc -Tpdf -mandoc $(man -w bash) > ~/Desktop/bash3_2_57.pdf
You could follow that with:
open ~/Desktop/bash3_2_57.pdf
or to just quickly open the man page in the Terminal:
man bash
for Zsh man pages, see (not a typo):
man zshall
Apple uses an ancient version of Bash 3.2.57 iniitially released in 2006, and due to GNU's GPL3 licensing, Apple will not install a more recent version of Bash (e.g. 5.2) that is installed on most Linux systems. Instead, Apple is committed to providing the Zsh shell which has an MIT license. Learning the Zsh shell would be more strategic for you in future releases of macOS.
Here is a direct link to a PDF Bash 3.2 Reference Manual from Sept 2006. Almost all of the Bash related articles in a Google search are by those running later versions of Bash on Linux and some of that syntax is not implemented in Bash on macOS.
Apple provides the following:
Terminal User Guide for Mac - Apple Support
If you launch the Terminal, you can produce a PDF fromf the Bash 3.2.57 man page. You can copy and paste this in the Terminal followed by a return:
/usr/bin/mandoc -Tpdf -mandoc $(man -w bash) > ~/Desktop/bash3_2_57.pdf
You could follow that with:
open ~/Desktop/bash3_2_57.pdf
or to just quickly open the man page in the Terminal:
man bash
for Zsh man pages, see (not a typo):
man zshall
For a quick overview of bash commands and syntax: https://devhints.io/bash
bash reference card: https://www.cheat-sheets.org/saved-copy/bash_ref.pdf
For a quick overview of zsh commands and syntax: https://devhints.io/zsh
zsh reference card: https://www.bash2zsh.com/zsh_refcard/refcard.pdf
I’d suggest spending more time with zsh than with bash, if macOS is your platform. This as Apple is migrating folks from bash to zsh, and as the installed version of bash is very old.
Use zsh as the default shell on your Mac - Apple Support
Apple has an (old) primer focusing on bash shell scripting available, as well: Introduction
For those with some familiarity with bash now looking at zsh: https://scriptingosx.com/2019/06/moving-to-zsh/
And this:
A Guide to Zsh Expansion with Examples.
I have bookmarked what were some really sound Zsh documentation sites only to have them eventually disappear under 404, or 503 site codes. Some were really good such as the one that discussed how to use the Zsh/pcre module that Apple excludes from macOS.
Extremely helpful, thank you and happy holidays.
bash guide