Is there a way to change the root (/) directory of git bash on windows.
By default it is set to the installation folder. Setting it to c:\ instead would save needing to type the drive letter e.g. /c/some/path on all absolute paths.
You can change to the root directory of the current drive with the “cd” command or switch to a root directory on another drive. The root directory is the top-most folder on the drive. For example, “C:\” is the root directory for the C: drive and “D:\” is the root directory for the D: drive.
To change directories, use the command cd followed by the name of the directory (e.g. cd downloads ). Then, you can print your current working directory again to check the new path.
The basic idea is that C:\Program Files\Git\mingw64\ is your / (“root”) directory according to Git Bash. If you go to that directory, you will find the typical linux root folder structure ( bin , etc , lib and so on).
To change into the root directory of Linux file system, use cd / . To go into the root user directory, run cd /root/ as root user. To navigate up one directory level up, use cd ..
echo 'cd /c/' >> ~/.bashrc
Automatically go to /c/ directory when opening bash cli.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With