The ln command in Linux is used to create a link between files. This is useful for sharing files between your local machine and WSL.
I’m linking to a ‘projects’ folder in this post but I get an error when cloning git repos in them (chmod error). Using mounted Windows drives for version-controlled projects is appearing to be a no go.
# Create a New Linked Folder
# Remove a Linked Folder
Create a New Linked Folder
ln -s /mnt/c/projects
-s
Create symbolic links instead of hard links.
First I’m creating a local folder then creating a link to the folder in my WSL home directory.

Next I’m creating a new folder and file within WSL on the linked folder.

And here’s the file created above shown within the local Windows environment.

Remove a Linked Folder
Just list the files with -lai
to check for existing links ad then remove as your would a file (rm
command).

We’re deleting the object visible to Linux here, not the folder in Windows.

2 Comments
[…] creating a new SSH key within a linked folder, which means my SSH keys are backed up on the local machine in-case anything happens on this WSL […]
[…] encountered this error message when attempting to clone a git repo on a linked folder within […]