How to Change Directory With Git Bash

Fumbani Banda Feb 02, 2024
How to Change Directory With Git Bash

This tutorial demonstrates changing the directory in git bash using the cd command.

Change Directory With Git Bash

Before changing the directory, you need to know your current working directory. To do this, you use the pwd command. This command stands for print working directory.

$ pwd

The output of the code above shows that we are in /c/Users/0x30 directory.

change directory with git bash

To move from the current working directory to another directory, we use the cd command. The cd command stands for change directory. It takes the path of the directory where we want to move to as the argument.

In the case below, we move from the current working directory to /c/example/ using cd.

$ cd /c/example/

To confirm that we have moved to the new directory, check the current working directory using the pwd command.

$ pwd

From the output below, it shows that we have successfully changed directories in git bash.

change directory with git bash

Fumbani Banda avatar Fumbani Banda avatar

Fumbani is a tech enthusiast. He enjoys writing on Linux and Python as well as contributing to open-source projects.

LinkedIn GitHub

Related Article - Bash Directory