You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code终端Bash与Windows 10 Ubuntu Bash差异及统一工作区咨询

Understanding the Difference Between ubuntu.exe and bash.exe in WSL, and Fixing Your VS Code Terminal Issue

Let me break this down clearly—this is a super common confusion with WSL on Windows, so you’re definitely not alone here!

First: What’s the Gap Between VS Code’s Bash and Your Ubuntu Store App?

The bash terminal you’re seeing in VS Code is not the same instance as the Ubuntu app you installed from the Microsoft Store. Here’s why:

  • Your store-installed Ubuntu uses ubuntu.exe (or version-specific ones like ubuntu-22.04.exe) as its launcher. This is tied directly to the specific WSL distribution you set up, with all the packages you installed and the English locale you configured.
  • The "Bash" option in VS Code’s terminal defaults to bash.exe, which is Windows’ older, generic WSL launcher. This usually spins up a separate, legacy WSL environment (often WSL1) that’s completely isolated from your store-installed Ubuntu. That’s why it has no packages you installed, and why it’s using German (likely a default locale for this legacy instance, even if your Windows/VS Code is in English).

How to Get VS Code to Use Your Existing Ubuntu Instance (and Eliminate Duplication)

You can fix this in a few simple steps to make sure everything uses the same Ubuntu workspace:

  1. Set your store Ubuntu as the default WSL distribution
    Open PowerShell (or Command Prompt) and run these commands:

    • First, list all your WSL instances to confirm the name of your store Ubuntu:
      wsl --list --verbose
      
    • Look for the entry named Ubuntu or Ubuntu-<version> (this is your store-installed one). Then set it as default:
      wsl --set-default <YourUbuntuInstanceName>
      
  2. Configure VS Code to use your Ubuntu terminal

    • Open VS Code settings (press Ctrl+, or go to File > Preferences > Settings)
    • Search for Terminal: Default Profile
    • From the dropdown menu, select Ubuntu (not "Bash")
    • Alternatively, edit your settings.json directly by adding this line:
      "terminal.integrated.defaultProfile.windows": "Ubuntu",
      
  3. Clean up the legacy bash.exe instance (optional but recommended)
    If you want to get rid of the duplicate environment entirely:

    • Use wsl --list --verbose again to identify the legacy instance (it might be named Legacy or show a different WSL version)
    • Unregister it with:
      wsl --unregister <LegacyInstanceName>
      

    This will delete that isolated environment so you only have your store Ubuntu workspace left.

Quick Note on the Language Difference

Once you switch VS Code to use your store Ubuntu terminal, the language will automatically match the English locale you set up when you first launched the Ubuntu app. The German locale was just a quirk of that separate legacy bash.exe instance.

内容的提问来源于stack exchange,提问作者iko79

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:22:16