WSL: Use Symbolic Links to Speed Access to Common Directories
In a Windows Subsystem for Linux (WSL) shell, you can use symbolic links to simplify access to Windows directories that you access frequently.
Specifically, in my home directory, I create symbolic links to various directories. Then I can quickly and easily navigate to those directories in the shell or use my o command to open the directory in Windows Explorer.
To create a symbolic link, use the ln command with the -s option:
ln -s `wslpath "<windowsPath>"` [linkname]
I changed to my home directory (~) and used these commands:
ln -s `wslpath "C:\temp"`
ln -s `wslpath "C:\data"`
path=`wslpath "C:\program files (x86)"`; ln -s "$path" x86
path=`wslpath "C:\program files"`; ln -s "$path" x64
Now I can enter cd ; cd x64 to get to change the working directory to C:\program files. Unfortunately, the prompt and pwd commands show the location of the symbolic link rather than the actual path (I imagine that there is some way to change this).
For some reason, I also moved my shortcut commands to a directory on the Windows file system and made /bin a symbolic link to that. I guess I am worried about something going wrong with WSL and losing my shortcut commands. I guess I should make my .bashrc file a symbolic link as well.