Where is ~/.bash_profile located in Windows Subsystem for Linux? [duplicate]

Solution 1:

From the man page for bash:

By default, it first reads and executes commands from the file > /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

So it exists in your home directory IF AND WHEN you create it and make it readable.

Solution 2:

Bash subsystem

With the bash on windows the files are located at in the same location if you are running within the bash environment, ie /home/user_name/.bashrc .

Create the file , form bash, as suggested by Rinzwind if necessary.


Windows

However, if you are looking at the files from windows, outside the bash subsystem, they are located at

C:\Users\<username>\AppData\Local\Lxss\rootfs

so ...

C:\Users\<username>\AppData\Local\Lxss\rootfs\home\username

Note: The windows user name may or may not be the same as your bash username, depends on how you set bash up I suppose.

Warning - Dont edit or modify files in your bash environment from windows, see this link:

DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.