Prerequisites and Extensions
Before changing the default terminal behavior, ensure that the necessary components are present on your system. The most critical requirement is the Remote - WSL extension by Microsoft. Without this extension, VSCode cannot communicate with the Windows Subsystem for Linux instances. You can install it by opening the Extensions view (Ctrl+Shift+X) and searching for "Remote - WSL". Once installed, verify that WSL2 is functioning correctly by runningwsl --list --verbose in a standard Windows Command Prompt or PowerShell window. This command should list your Ubuntu 24.04 instance as running version 2. If the instance is not listed or shows version 1, you may need to update it using wsl --set-version Ubuntu-24.04 2. Additionally, ensure that your Ubuntu distribution is up to date by launching it from the Start menu and executing sudo apt update && sudo apt upgrade.
Accessing Terminal Settings
The configuration for the default terminal resides in the user or workspace settings of VSCode. You can access these settings through the graphical interface or directly via the JSON file. To use the graphical interface, press Ctrl+, (or Cmd+, on Mac) to open Settings. In the search bar, typeterminal.integrated.defaultProfile.windows. This setting specifically controls which terminal profile appears when you create a new terminal pane. Alternatively, you can edit the settings.json file directly. Open the Command Palette (Ctrl+Shift+P), type "Preferences: Open User Settings (JSON)", and select it. This method provides more granular control and allows you to see the exact structure of your configuration. It is often recommended to edit the JSON file if you encounter issues with the UI not reflecting changes immediately.
Selecting the WSL Profile
In the settings interface, look for the dropdown menu associated withterminal.integrated.defaultProfile.windows. Initially, this might be set to Command Prompt, PowerShell, or CMD. Click the dropdown and select WSL: Ubuntu-24.04. If you do not see this option, it indicates that VSCode has not yet detected the WSL profile correctly. This usually happens if the Remote - WSL extension is not fully loaded or if the WSL service is not running. After selecting the profile, save your settings. The next time you open a new terminal using Ctrl+` or the menu option Terminal > New Terminal, it should launch directly into the Ubuntu shell. You can verify this by checking the title bar of the terminal panel, which should display "Ubuntu-24.04" instead of "Windows PowerShell" or "Command Prompt".
Troubleshooting Common Issues
Sometimes, the WSL profile may appear but fail to launch correctly, resulting in errors or blank screens. A common cause is permission issues or corrupted profiles. First, try restarting VSCode completely. If the issue persists, check the Output panel by going to View > Output and selecting "Terminal" from the dropdown. Look for error messages related to WSL. Another frequent problem arises when multiple WSL distributions are installed; VSCode might default to an older or different version. Ensure thatUbuntu-24.04 is explicitly selected in the settings, not just any generic "WSL" entry. For users experiencing font rendering issues after switching, refer to our guide on Changing Terminal Fonts in WSL Ubuntu VSCode. This article details how to adjust font families and sizes to ensure readability within the WSL terminal context.
Advanced Configuration
For power users, you can define custom profiles for the terminal. This is useful if you want different behaviors for different projects. Insettings.json, you can add entries under terminal.integrated.profiles.windows. Here, you can specify the path to the WSL executable and arguments to pass to it. However, for most users, the default profile selection is sufficient. It is also worth noting that if you are working with remote servers or VMs, the terminal configuration might differ. While WSL2 provides a lightweight Linux environment, it operates differently than a full virtual machine. If you are comparing environments, you might find our article on Difference between Windows WSL helpful for understanding the architectural differences between WSL and other Ubuntu installations. Understanding these differences helps in diagnosing why certain commands or tools behave differently in the VSCode terminal compared to a native Windows terminal.
Frequently Asked Questions
Why does my WSL terminal show 'bash' instead of 'zsh'?
This depends on the default shell configured in your Ubuntu distribution. WSL2 typically installs Bash as the default login shell. To change it to Zsh, you need to install Zsh inside Ubuntu and then set it as your default shell using the chsh -s /bin/zsh command within the WSL terminal itself.
Can I have different default terminals for different workspaces?
Yes, VSCode supports workspace-specific settings. You can override the terminal.integrated.defaultProfile.windows setting in the .vscode/settings.json file located in your project folder. This allows you to use PowerShell for some projects and WSL for others automatically.
What should I do if the WSL profile is missing from the dropdown?
Ensure that the Remote - WSL extension is installed and enabled. Also, verify that WSL is running by checking the system tray icon or using the command line. Restarting VSCode after installing the extension often resolves detection issues.
Is there a performance difference between using WSL and Windows terminals in VSCode?
WSL2 offers near-native performance for Linux-based tasks, making it ideal for development environments requiring Linux tools. However, for pure Windows-based scripting, native PowerShell or CMD might offer slightly lower overhead due to less translation layer processing.
How do I reset the terminal profile to its original state?
To reset, simply delete the terminal.integrated.defaultProfile.windows entry from your settings.json file or set it back to Command Prompt via the UI. This will revert to the system default terminal defined by Windows.