Git Bash and Some of its Commands

image.png

What is Git Bash?

Git Bash is an application for Microsoft Windows environments which provides a bash emulation used to run Git from the command line without the use of GUI (Graphical User Interface). This is not a simple bash compiled for Windows, but a package that contains Bash, SSH, SCP, and some other Unix utilities compiled for Windows. It also contains a new command-line interface terminal window called minty. These utilities are bundled with this Bash package to create a usable software package.

Some commands in git bash

1.PWD : The Bash command PWD 'present working directory' the pwd command writes to standard output the full path name of your current directory (from the root directory). All directories are separated by a / (slash). The root directory is represented by the first /, and the last directory named is your current directory.

2.CD : The Bash command CD 'Change Directory' is use to change the present working directory .

Methods to change the folder in Git Bash

  1. pwd can be used to search the current folder.
  2. You will need to use quotation marks if the path includes spaces ( cd “C:/Program Files”)
  3. On Windows, you can change the default starting directory of Git Bash.
  4. "Change directory" is a good way to recognize the cd command.

3.LS : The Bash command ls is used to 'list' contents of the current working directory. It is equivalent to DIR on a Windows console host terminal. Both Bash and Windows console host have a cd command.

4.MKDIR : Allows users to create or make new directories. mkdir stands for “make directory.” With mkdir , you can also set permissions, create multiple directories (folders) at once, and much more.

5.RMDIR : The rmdir command removes the directory, specified by the Directory parameter, from the system. The directory must be empty before you can remove it, and you must have write permission in its parent directory. Use the ls -al command to check whether the directory is empty.