5 Interacting with Terminal and Bash

We have two more things to cover before we dive in to Git and Github. First, we will be using Mac’s Terminal and Window’s Bash for this training. If you have never used these applications before, we introduce them below, so you become familiar with them. Second, we discuss good names for files and folders, as good names make for good times when you interact with Terminal and Bash.

5.1 A Terminal window

We will use Terminal and Bash applications to interact with Git on our laptops. Below is a Mac Terminal window. It looks very similar to a Windows Bash window.

In this training, we supply you with Git code for you to type into your Terminal/Bash windows.

Once you input a command and hit Enter/return on your keyboard, Terminal/Bash will display output to the screen. Pay attention to this output as it will indicate if the command was understood by your computer or if something went wrong. For example, here is the command git branch, followed by the output printed to screen:

Here is a cheat sheet that you can refer to for your bash commands: | Command | Description | |———-|—————————————-| | ls | Lists files and directories | | cd {dir} | Changes to directory {dir} | | cd .. | Moves up one directory level | | open . | Opens the current directory | | rm | Removes a file | | mkdir {}| Creates a new directory {} | | touch {}| Creates a new empty file {} | | cp {source} {destination} | Copies files or directories from {source} to {destination} | | mv {source} {destination} | Moves or renames files or directories from {source} to {destination} | | pwd | Prints the current working directory | | history| Shows the command history | | clear | Clears the terminal screen |