How to Connect WSL Linux to VS Code Terminal

Easy step-by-step guide to integrate Windows Subsystem for Linux with Visual Studio Code

📅 Published: October 20, 2025
⏱️ Reading Time: 3 minutes
🏷️ Category: Development Tools
Introduction: Connecting Windows Subsystem for Linux (WSL) to Visual Studio Code allows you to develop in a Linux environment directly from Windows. This guide will show you two simple methods to establish this connection.

What You'll Need

  • Windows 10/11 with WSL installed
  • Visual Studio Code installed
  • Internet connection (for extension download)

Method 1: Connect via VS Code Interface

1 Install the WSL Extension

Open Visual Studio Code and install the official WSL extension from Microsoft.

  • Go to Extensions panel (Ctrl+Shift+X)
  • Search for "WSL"
  • Install the extension by Microsoft
Tip: The extension name is "WSL" and the publisher is Microsoft. Make sure you install the correct one.
2 Open the Command Palette

Access the VS Code command palette using keyboard shortcuts.

Press Ctrl+Shift+P (or F1)
3 Connect to WSL

Search for the WSL connection command and execute it.

  • Type "WSL: Connect to WSL"
  • Select the option from the dropdown
  • Press Enter
4 Connection Complete!

VS Code will reload and connect to your WSL environment. You should see "WSL" in the bottom-left corner of VS Code.

Success: Your VS Code is now connected to WSL Linux!
5 Verify the Connection

Test the connection by running basic Linux commands in the VS Code terminal.

ls -la

If you see a list of files and directories in Linux format, the connection is successful!

Method 2: Connect via Linux Terminal

Alternative Method: Launch from WSL

If Method 1 doesn't work or you prefer working from the Linux terminal, follow these steps:

1 Close VS Code

First, close any open instances of Visual Studio Code.

2 Open Linux Terminal

Launch your WSL Linux terminal (Ubuntu, Debian, etc.).

  • Open Start Menu
  • Search for your Linux distribution (e.g., "Ubuntu")
  • Click to open the terminal
3 Navigate to Your Project Directory

Use the cd command to go to your project folder.

cd /path/to/your/project
4 Launch VS Code from Terminal

Open VS Code with WSL connection automatically configured.

code .
Success: VS Code will open with the terminal automatically connected to WSL!
Note: The dot (.) represents the current directory.

Benefits of Using WSL with VS Code

  • Native Linux Environment: Run Linux commands and tools natively
  • File System Access: Direct access to Linux file system
  • Better Performance: Improved performance for Linux-based projects
  • Cross-Platform Development: Develop on Windows for Linux deployment
  • Integrated Terminal: Seamless integration with VS Code's terminal

Troubleshooting Tips

Connection Failed?

  • Ensure WSL is properly installed on Windows
  • Restart VS Code after installing the WSL extension
  • Check if your Linux distribution is running
  • Try the alternative method (Method 2) if Method 1 doesn't work
  • Update VS Code and the WSL extension to the latest version

Conclusion

Connecting WSL to VS Code is straightforward and enhances your development workflow significantly. Both methods work reliably, so choose the one that fits your workflow best. Once connected, you can enjoy the full power of Linux development tools within your Windows environment!

Pro Tip: You can also right-click on any folder in Windows Explorer and select "Open with Code" to launch VS Code with WSL connection for that specific directory!

© 2025 Tech Setup & Troubleshooting Blog | All Rights Reserved

Helping you solve technical challenges, one step at a time.

Comments

Popular posts from this blog