Techstacker
Light ModeDark ModeReset dark mode. Falls back to OS dark mode setting.

Pages

No results for 'undefined'

Blog Posts

No results for 'undefined'
Powered by Algolia

What is Bash and What Does it Do?

Oct 16, 20191 min readTerminal, BashViews:

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:

echo $0

If you’re using bash, your output will be:

-bash

You can also use:

echo $SHELL

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