Bash is a command line tool. Every terminal has a command line that you use to communicate with your computer’s OS (Operating System).
Every time you open your computer’s Terminal, you open a so-called shell. Bash is a type of shell, or a command line shell, so to speak.
Bash is just one of many command line shells (tools), including Zsh, and Fish.
Bash, Zsh, and Fish are just different shell flavors that by and large serve the same purpose, they provide a command line that you use to write instructions to your computer. Each of them have individual features that make some choose one over the other — but that’s for a different article.
Many are using a specific shell without even realizing it (you could have installed it as part of following a tutorial). If you want to check which shell you’re using, open your terminal and type:
If you’re using bash, your output will be:
You can also use:
The difference is that
echo $0 gives you the current shell you’re working inside, while
echo $SHELL gives you your terminals default shell. So if you close your terminal and open it again, the output you get from running
echo $SHELL is your default shell.
This is good to know because sometimes you will be running multiple brands of shells inside your terminal, which can get confusing, but that’s where the
echo $0 command is handy.
Note: if you’re running the Ubuntu OS on your computer, your default shell is Bash.
Read more about the Terminal and Command Line