Argument/Option to wsl.exe to start in the user home directory in the Linux file system
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Running wsl keeps the current working directory. An example from the documentation:
PS C:\Users\sarah> wsl
scooley@scooley-elmer:/mnt/c/Users/sarah$
This is great for running commands in Linux against files in the current working Windows directory. But there are times when I want to start in the user home directory in the Linux file system.
I can run wsl (or wsl -u username) and then immediately run a cd ~ command. I can also run bash ~ but if I have set up a different shell, this may not be what I want.
It is not documented but I found that I can run wsl ~ and wsl ~ -u username. However if the ~ is not the first token in the command line, the command will not start in the user home directory and will likely have an error. Because it is undocumented and because it is idiosyncratic (by being positional) when compared to the documented arguments and options, it seems like I shouldn't depend on using ~.
Can a supported and documented argument or option be added to wsl that will start in the user home directory in the Linux file system?
Possible solutions:
- Document the apparent existing ~ argument (including that it is positional and must appear before any other arguments).
- Add a named argument that determines if wsl starts in the current working Windows directory (current default) or starts in the user home directory in the Linux file system.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the wsl command's argument and working-directory handling, then review the documented arguments and options described in the issue. Decide whether the existing positional ~ behavior should be documented or replaced with a named option, and verify that the chosen behavior works with wsl -u username and alternate shells.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux, powershell
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100