Windows WSL: How to Fix Broken bashrc File


When there’s an incorrect setup of Windows Subsystem for Linux (WSL), where $HOME/.bashrc is corrupted or having an ‘exit’ statement during its runtime, Windows cannot log into is WSL using the normal wsl command.

How To Fix:
# Execute bash using a different home directory
C:\Windows\System32\bash.exe ~ -c /bin/bash

# Edit the broken bashrc file
vim ~/.bashrc


Posted on Categories Linux

4 thoughts on “Windows WSL: How to Fix Broken bashrc File”

  1. Amazing, a help article on the internet that just tells you exactly the fix without rambling on for four paragraphs! Why isn’t this the standard?

Leave a Reply

Your email address will not be published. Required fields are marked *