The meaning of life is to explore the world

A few tips of using WSL

Posted on By Jason Liu

Please reference the bash code example of syncing folders from one drive to another under WSL here:
https://github.com/jasonmccb/myWSLSync.git


  1. USB disk needs to be mounted MANUALLY from time to time
    sudo mkdir /mnt/e
    sudo mount -t drvfs E: /mnt/e
    sudo umount /mnt/e
    
  2. WSL may not be able to read correct permissions from time to time
    Below screenshot shows different results of running same command between a few seconds my_image

    Solution:
    Manually add permission to such folders/files.

     sudo chmod a+r,a+x folder1 file1
     sudo chmod -R 777 folder2	#-R for recursion
    
  3. File or folder name can contain % symbol
    This can be a problem to some commands such as find . -printf "$fileName=%f\n".
    When bash expands $fileName, it may considers %xxx as a directive.

    Solution:
    Use %% as % in variable for the “find -printf”.