For most of today's activities, we will be using Bash, the Bourne Again Shell, as well as some common Unix tools. Though Bash is widespread, it is not always available, and Windows users especially will have to do some extra steps.
- Search for and open the Terminal application
- The default shell on macOS is zsh. Enter Bash by typing
bashand pressing enter. - Once you see a line ending in
$and your blinking cursor, you are all set!
Windows uses a significantly different architecture from macOS and Unix, and as such does not generally include Bash or the other tools we will need. How to proceed is up to you, but we recommend installing Windows Subsystem for Linux (WSL). This program emulates certain parts of the Linux operating system, so that developers and hackers like you can use these tools from the comfort of Windows.
We recommend you check that you have some free space on your main storage before proceeding. WSL should take less than 1 Gb.
To install WSL:
- Search for PowerShell. Right-click it and click "run as administrator"
- Once PowerShell is opened, type
wsl --installand press enter. - You may need to restart your computer for the process to complete.
- Search for and open the Ubuntu program. You may have to configure a username and password. Do so.
- Once you see a line ending in
$, just before your blinking cursor, you are all set and in Bash!
If you are using a Linux device, chances are that when you open up your terminal, you will already have entered bash. Lets try it out:
- Open a terminal emulator—if you have a search program, search for "terminal" or "command" and you will almost certainly find one.
- Type
echo $SHELLNAMEand press enter. If you seebash, you're all set! - Otherwise, type
/bin/bashand press enter. If this works, you have bash installed but it is not your default shell. It's fine!—just keep that in mind. - If step 3 fails, bash is not installed on your system. See our previous workshop on Git for how to install a program on your device.
To enter bash once it is installed, type bash and press enter.
Congratulations! You are now running Bash!
When you run programs in Bash, they produce lines of output. But whenever you can enter a command, Bash will print a prompt with some relevant information. The information in the prompt is configurable, and the default will depend on your operating system, but here are some of the common elements:
- your username: pretty self-explanatory
- your hostname: the name of your device
- your current working directory: where in your device's filesystem you are currently executing from.
/home/<username>is often abbreviated as~ - a dollar sign: this symbol indicates two things: first, the prompt is ready and second, that the command will be run with "normal" privileges—i.e., not as an administrator or superuser.