Skip to content

How to Create and Use .bashrc File on Windows 10

create and use .bashrc file on Windows 10

In this post, you’re going to learn how to create and then use the .bashrc file on Windows 10.

First and foremost, to be able to use the file you need to have Git Bash installed.

If you don’t have it, download it from this website and install it.

Let’s begin!

Create .bashrc

Open up Git Bash and type in touch ~/.bashrc

create bashrc file on windows 10

This will create the file in C:\Users\YOUR-USERNAMEdirectory.

bashrc file path on Windows 10

To test and see if the file is working, you can create a simple alias:

alias hello='echo Neutron dev tutorial'

bashrc alias

In order for the change to take effect, you have to reopen Git Bash.

When you open it, you’ll be met with the following warning:

WARNING: Found ~/.bashrc but no ~/.bash_profile, ~/.bash_login or ~/.profile.

But also with an info message saying:

This looks like an incorrect setup. A ~/.bash_profile that loads ~/.bashrc will be created for you.

The ~/.bash_profile file was created automatically. That’s good!

bashrc warning and info messages on windows 10

Next time you’ll open Git Bash the warning and the above info message will not appear anymore.


Then type in hello in your Git Bash terminal to execute the alias you just created.

bashrc alias on windows 10

That’s all! 😎


Let me know what you think about this article in the comments section below.

If you find this article helpful, please share it with others and subscribe to the blog to support me, and receive a bi-monthly-ish e-mail notification on my latest articles.   
  

Comments

Tags: