14

When trying to access ~/.bash_profile from Ubuntu Xenial (16.04) in Windows Subsystem for Linux I get the following error:

-bash: /home/<username>/.bash_profile: No such file or directory

Where is it located and how do I edit it?

Thank you!

2 Answers2

16

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.

jpezz
  • 1,120
4

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.

Panther
  • 102,067