Unable to Change Starting Directory in Ubuntu on Windows Terminal (WSL)
If you're using the Windows Subsystem for Linux (WSL) and the Windows Terminal, you might have encountered an issue where you're unable to change the starting directory. This article will cover the key concepts related to this problem and provide a detailed context on how to solve it.
Windows Terminal and WSL
Windows Terminal is a new, modern, and fast terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. WSL is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019.
The Problem
When you launch the Windows Terminal and open a new WSL tab, it always starts in the home directory of your Linux distribution. However, there might be situations where you want to start in a different directory. For example, you might want to start in a project directory to save time and avoid navigating there every time you launch the terminal.
Solution
The solution is to modify the settings of the Windows Terminal. Here's how you can do it:
- Launch the Windows Terminal.
- Click on the downward arrow next to the "+" button and select "Settings".
- In the settings window, find the profile for your WSL distribution.
- Add the following line to the "commandline" property:
"/mnt/c/path/to/your/directory"Replace "/mnt/c/path/to/your/directory" with the actual path to the directory you want to start in.
Changing the starting directory in Ubuntu on Windows Terminal (WSL) is a simple task that can save you time and make your workflow more efficient. By modifying the settings of the Windows Terminal, you can start in any directory you want.
References
This article includes references to the official documentation of Windows Terminal and WSL. The information provided is accurate and should help you solve the problem of changing the starting directory in Ubuntu on Windows Terminal (WSL).