Getting Started with Bash

Apr 12, 2022
4 min read
615 words

In this article we are going to learn about what is bash and how we are going to install in windows? This is going to be a full series on Bash in which we are going to learn so much more.

According to Wikipedia,

Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell.

BASH is an acronym for Bourne Again Shell, It is a shell program written by Brian Fox as an upgraded version of Bourne Shell program 'sh'. It was first released in 1989.

Shell: A UNIX Shell is a program or a command line interpreter that interprets the user commands which are either entered by the user directly or which can be read from a file and then pass them to the operating system for processing.

Why Bash?

Bash Scripting is a powerful part of system administration and development used at an extreme level. People use Bash for system administration, data crunching, web application deployment, automated backups, creating custom scripts for various pages, etc. They can control their computer or OS without having to navigate menus, options, and windows within a GUI.

What is Bash Script?

A Bash Shell Script is a simple and plain text file that contains various commands that we usually type in the command line. It might include loops, functions, conditional constructs, etc. Effectively. In other words Bash script is a computer program written in the Bash programming language.

Install Bash on Windows

Method-1

To run bash on windows you need to install it first to do that First Run you windows Powershell or Windows Terminal as Administrator, then run the following command-

bash

wsl --install

This could take a few minutes because its size is several MB. after the downloading is done you need to restart your system after that It’ll start downloading and installing Ubuntu, and then you’ll be prompted to pick a username and password. They don’t have to be related to your Windows 11 login details. After that, all is done. Now you have installed bash in your system. For futhuer info about this Click Here

Method-2

You can download and install Ubuntu 20.04.4 LTS from Microsoft Store. Once its doen just open the Ubuntu Application then set username and password. And voilà your installation is done.

Running Bash

After the installation is done just open your windows terminal or ubuntu terminal (in windows) and run bash as shown in the image below-

run bash

Note- You can skip this step if you are a Mac or Linux user.

Hello, World

Now we are going to run out the first command or program in bash. just type the following in your terminal.

bash

echo "Hello, World"
# Output : Hello, World

helloworld

echo: It is a built-in command in Bash, which is used to display the standard output by passing the arguments. It is the most widely used command for printing the lines of text/String to the screen.

preview

As you can see in the above gif you don't even need "" to print something on-screen you can simply type echo followed by the text you want to print. You can create a file to do the same. That's for another article.

Wrapping up

In this article we have learned that what bash is? why we wanna use it? How to Install ubuntu in windows and a simple echo command to print something on the screen. This is just beginning we are going to dive into the ocean of bash.

Jatin's Newsletter

I write monthly Tech, Web Development and chrome extension that will improve your productivity. Trust me, I won't spam you.

Share on Social Media: