9

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?

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".

4

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.

  • You could also just put the following in your ~/.bashrc: if test -r ~/.profile; then . ~/.profile; fi – Julie Pelletier Jun 24 '16 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... – Jonathan Hartley Feb 20 '17 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.