10

I installed the Ubuntu (Bash) Linux on Windows 10 (which comes with the Windows anniversary update), and started playing around with it.

What I noticed is that starting the shell (ubuntu bash) does not load .profile or .bash_profile, even though the .profile file exists. Is there a fix?

2 Answers 2

11

You can change Bash shortcut to make it execute your .profile. Click on properties and append " --login" after the "~" in Target.

Note: This is the properties of the bash file, not the properties that show up in the upper left window of the bash shell. From the start menu, right click on "Bash on Ubuntu on Windows" and select More, then open File location. Right click on that file in the File Explorer and select properties. There's where you append " --login".

6

By default, this release of ubuntu-on-windows loads the file named ~/.bashrc (instead).

It's interesting though because ~/.profile has a section in there to automatically load ~/.bashrc. So if you reverse it to make .bashrc load .profile, you'll need to uncomment that.

2
  • You could also just put the following in your ~/.bashrc: if test -r ~/.profile; then . ~/.profile; fi Jun 24, 2016 at 19:36
  • 2
    "you'll need to uncomment that" - do you mean comment that? To prevent infinite loops of .bashrc calling .profile calling .bashrc... Personally I have my dotfiles in a repo, so I'm using the same .bashrc on WSL as well as on genuine Ubuntu, so I'll need some slightly cleverer conditional logic. Hmmm... Feb 20, 2017 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .