Can I get (the new) bash on Windows 10 to load .profile

12,381

By default, this release of Ubuntu-on-windows loads the file named .bashrc.

You can either put the script or add the below line to .bashrc (and create .bashrc if it is non-existent):

. ~/.profile

Note: If .bashrc is sourced from .profile, you may want to comment it out to prevent bash endlessly looping.

Share:
12,381

Related videos on Youtube

dhr_p
Author by

dhr_p

Updated on June 22, 2022

Comments

  • dhr_p
    dhr_p almost 2 years

    I installed the new subsystem for 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?

    (And can someone with a lot of reputation make the windows-bash tag?)

    • Benjamin W.
      Benjamin W. almost 8 years
      That tag exists already: ubuntu-on-windows.
    • dhr_p
      dhr_p almost 8 years
      FYI: Feel free to move this to Super User if you guys prefer.
  • dhr_p
    dhr_p almost 8 years
    Thanks luk3yx; but I mentioned specifically that this fails with Ubuntu-on-windows.
  • dhr_p
    dhr_p almost 8 years
    Ah, it actually works. .bashrc is included/run, even though the system appears to be setup the other way around; as the following lines are included in the default ~/.profile if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi
  • Ryan E
    Ryan E over 7 years
    In case it isn't obvious, you probably want to remove/comment the lines that source .bashrc from your .profile otherwise you will wind up in a loop when .profile is sourced in .bashrc