Windows Subsystem for Linux (WSL) empowers developers to run Linux environments directly on Windows, seamlessly integrating Linux command-line tools, utilities, and applications with your Windows workflow. Windows Terminal, a modern, multi-tabbed terminal application, offers a superb experience for interacting with WSL distributions.
Combining WSL and Windows Terminal provides a powerful and flexible development environment. You get the best of both worlds: the rich ecosystem of Linux tools and the familiar, user-friendly interface of Windows.
The easiest way to install WSL is by opening PowerShell or Command Prompt as an administrator and running:
wsl --install
This command will enable the necessary features, download the latest Linux kernel, and install a default Linux distribution (usually Ubuntu). You may need to restart your computer. Follow the on-screen instructions to set up a username and password for your Linux distribution.
For more detailed installation steps and to choose specific distributions, refer to the official Microsoft WSL installation guide.
Windows Terminal is available from the Microsoft Store. Search for "Windows Terminal" and install it.
Alternatively, you can install it using PowerShell:
winget install Microsoft.WindowsTerminal
Once both WSL and Windows Terminal are installed, Windows Terminal will automatically detect your WSL distributions and add them as profiles. You can launch your WSL distribution by clicking the dropdown arrow in the terminal and selecting your distribution's name.
Windows Terminal is highly customizable. You can access its settings by clicking the dropdown arrow and selecting "Settings".
Within the settings, you can:
Customize keyboard shortcuts for common actions like opening new tabs, splitting panes, copying, and pasting.
Each WSL distribution appears as a profile. You can edit these profiles individually. For instance, you might want to start your Ubuntu profile directly in a specific directory:
Tip: To start a WSL profile in a specific directory, edit the profile's "Starting directory" setting in Windows Terminal's JSON settings. You can use paths like \\wsl$\Ubuntu\home\youruser\projects
.
You can modify the settings.json
file directly for advanced configurations. Access it via the Settings UI ("Open JSON file").
With WSLg (WSL Graphical Architecture), you can run Linux GUI applications directly from your WSL distribution within Windows Terminal.
To run a GUI app, simply type its command in your WSL terminal. For example:
gedit
This will launch the Gedit text editor within a Windows window.
Your Windows drives are mounted under /mnt/
in your WSL distribution. For example, your C: drive is accessible at /mnt/c/
.
cd /mnt/c/Users/YourUsername/Documents
Install your favorite development tools within your WSL distribution. Windows Terminal provides a seamless interface for using them.
sudo apt update && sudo apt install git nodejs npm -y
If you encounter issues:
By mastering the synergy between WSL and Windows Terminal, you can significantly enhance your development productivity and enjoy a robust, flexible computing environment.