PATH bug in Windows Subsystem for Linux

Note: This bug no longer exists in the Windows Store Ubuntu app–you should uninstall the deprecated WSL beta and install the Windows Store Ubuntu app


Starting at about Windows Build 16193, the problem was acknowledged by Microsoft. Specifically, WSL was ignoring ~/.bashrc and ~/.bash_aliases and stuffing the full Windows %PATH% into Bash $PATH.

Workaround

Put the needed items e.g. export PATH and alias commands into ~/.bash_profile.

~/.bash_profile
used for interactive shells.

Virtually all WSL shells are interactive, since WSL closes when the last WSL Terminal closes (no Linux services yet like Cygwin has).

Leave a Comment