When installing a WSL (Linux) distro via the Microsoft Market Place, we get a default icon in the Windows Start Menu, with which to start it (e.g. "Ubuntu"). We can also pin that icon to the Task Bar. By default clicking this icon will start a (Bash) prompt in the Linux home directory ~. How to change this to a different default directory?

NOTE: Maybe a silly question, but when faced with this the obvious was overlooked by me. I hope this question will help others in the same situation that search for "WSL default directory" (and variations).

1 Answer 1


When clicking the distro icon you will get Bash. You can cd in to the desired directory in a Bash start up script. In the current "Ubuntu" WSL distro the ~/.bash_profile file does not yet exist by default. Make sure to include ~/.bashrc (which does exist by default).

cat <<EOF >~/.bash_profile
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
cd /mnt/c/my/

If you put the cd command in ~/.bashrc instead, then it will also be run for subshells, which might not be what you want.

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.