Shared folder in WSL

  • this post covers
    • how to share a folder in wsl
  • environment
    • Windows 10 / Home
    • WSL / Ubuntu 18.04 LTS
    • Visual Studio Code

pre-task

  • install WSL in your Windows 10
    • open the Microsoft Store
    • search for Ubuntu
    • click Ubuntu 18.04 LTS
    • get and install it
  • prepare the environment
    • initialize your wsl
  • make a folder in some directory on Windows
    • ex) D:\Code\LinuxShare
  • make a link in some directory on WSL
    • format) ln -s /mnt/[partition]/[folder...] [link-name]
    • ex) ln -s /mnt/d/Code/LinuxShare share-with-windows

make-file

  • make a text file on Windows side
    • ex) D:\Code\LinuxShare\test.txt
  • check out the text file on WSL side
    • ex) ~/share-with-windows/test.txt
  • edit the text file and save it on WSL side
    • ex) hello WSL !hello Windows !
  • check out the text file on Windows side

typing-and-compiling

  • make a c file and edit it on Windows side
    • ex) D:\Code\LinuxShare\test.c
  • compile the c file and execute it
    • ex) ~/share-with-windows/test.c
  • you can now type texts on Windows and compile that on WSL
  • also output file, a.out will be seen on Windows side