The command line is a powerful tool used by developers to find, create, and manipulate files. This short tutorial will walk you through the steps to setting up the command line application on your computer.

Bash Setup for Mac and Windows

Before we can explain what Bash is, it's important we discuss what the command-line is.

What is the command-line?

The Command-Line Interface, or CLI, also refered to as a shell, is a powerful tool that allows us to communicate directly with the computer by using various text commands. With these commands, we can create/move/edit files, open applications, run scripts/programs, and so much more.

Here's an example:

If we wanted to create a new text file (.txt) called MyName.txt, then write our name in that file, we can do so using two simple commands:

touch MyName.txt echo "Your name here" > MyName.txt

The first command touch is how we create new, empty files. To choose what the file is named, we must declare it directly after touch.

The second command echo is just like that annoying, younger sibling who repeats everything you say. For example, if you enter echo "stop copying me" the command line will return stop copying me. The trick here is that we are using the redirect operator (>) to return whatever we echo to a specified location, instead of to us directly. In this example, we are redirecting the output to our newly created text file MyName.txt.

(For a complete A-Z listing of bash commands, click here)

So what is Bash?

Bash, or the Bourne-Again SHell, is a CLI that was created over 27 years ago by Brian Fox as a free software replacement for the Bourne Shell. Currently it is the most used and widely distributed shell, as it is the default shell for Linux and Mac. If you want to learn more about Bash, this wikipedia article can help you out.

How to get started with Bash

Mac users:

As mentioned before, Bash is the default shell on Linux and Mac, so good news, you don't have to install anything!

To access Bash in OS X, we need to use an application called Terminal. First open the Applications folder, then open the Utilities folder. Once you're in the Utilities folder you will see the application Terminal, open that and you're ready to go!

Windows users:

Windows includes a much more slimmed down version of Bash called the Command Prompt, but unfortunately, it's no where near as powerful as Bash. To combat this and stay on the same track as our Mac friends, we are going to download and install a program called Cygwin, which allows us access to Bash and other popular tools native to Unix and Unix-like operating systems, such as Linux and OS X.

How to install Cygwin:

1. Navigate to the Cygwin installation page and choose the appropriate link for download, setup-x86.exe for 32-bit versions of Windows, or setup-x86_64.exe for 64-bit versions of Windows. (If you are unsure which version of windows you have, click here)

2. Once it finishes downloading, run the .exe file and allow the application to make changes to your PC, if you happen to get a pop up asking about this.

3. To keep things simple, we are going to use the default settings for everything in this installation, so all you need to do now is keep clicking Next until it changes to Finish.

4. When you reach the last step of installation, check the two boxes next to Create icon on Desktop and Add icon to Start Menu and click Finish.

Congratulations, you now have Cygwin installed and it's ready to be used!