setup#
The first half of this workshop, the unix shell, provides an introduction the Unix shell using bash. In order
to work through these exercises on your own computer, you will need to make sure that you have a bash interpreter
installed. Depending on your operating system, this may already be done - use the contents menu on the right side of
this page for more information/instructions.
windows#
If you are using a Windows computer, you will need to install a bash emulator (if you have not already done so), as
they are not installed by default.
You will only need to install one of the options listed below, though I very much recommend installing git
independently of the fact that the Windows version ships with a bash interpreter.
Note
You will need to have Administrator rights on your computer in order to install either WSL or git.
windows subsystem for linux#
Since Windows 10, Windows has included support for installing Linux distributions via the “Windows Subsystem for Linux”
(WSL). This enables you to use Linux applications and utilities, including bash, directly through Windows without
the need for installing a virtual machine or dual-boot.
To install WSL, please see the official installation guide from Microsoft.
git bash#
If you are not interested in installing WSL, you can also install git, a distributed version
control system software. In addition to git, the Windows installer will also install Git Bash, a bash
emulator.
Click here to download git for Windows, then follow the instructions provided
by the installation wizard. You can also have a look here for more detailed instructions.
mac os x#
If you are using a Mac, congratulations! You don’t actually have to install anything new, because OS X already comes
with bash installed.
Since Catalina, however, the default shell used by Terminal has been zsh (“z shell”). To check what shell your
Terminal runs by default, open it up - at the top of the window, you should see either -bash or -zsh next
to your username.
If you see -zsh, you have three options, in increasing levels of difficulty:
Just run the commands as-is. Because
zshis built onbash, almost all of the programs/commands are the same, meaning that you could just use the terminal as-is.At the initial command prompt, type
bashand press Enter. This will open thebashinterpreter, allowing you to run the commands throughbashrather thanzsh. Note that if you close the window, you will need to run thebashcommand again after re-opening it, in order to continue usingbash.Change your default shell from
zshtobash. See, for example, this guide for more detailed instructions on how to do this.
linux#
If you have a computer that already has a linux distribution (or other *nix variety) installed, you really don’t need
to do anything. Just launch a Terminal window to get started. Though, you may want to check that your terminal is
running bash, rather than another shell.
To do this, type the following at the prompt:
echo $0
If you see bash printed below the prompt, congratulations! You’re all set to get started.
If you do not see bash, you can still change to bash by typing the following at the command prompt:
bash
You will now be able to run all of the commands used in the exercises. If you close the terminal window, you’ll need to
remember to run the bash command again.
You can also use the chsh command to change your default shell - for more detailed instructions on how to do this,
see this guide.