5

I'm working a programming project from school and decided to give Bash for windows a try. I downloaded the skeleton files for the project and pasted them inside the folder where my bash home folder should be. When I open the terminal and go inside the folder it shows as if there was nothing there even though I'm at the right folder. How can I get the files to be displayed?

0

2 Answers 2

6

EDIT: By now, there is actually a supported way to access these files. You have to use the \\wsl$\Legacy "network" share. For example, you could access your WSL home folder in Windows using \\wsl$\Legacy\home\<username>. Still, you should not directly access the lxss directory.


You are not supposed to touch the LXSS folder ever. The files there are use special attributes which are not understood by normal Windows applications to provide the features of a full Linux file system which NTFS on its own can't provide.

There is one hard-and-fast rule when it comes to Bash on Windows:

DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc. Creating/changing Linux files from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro! Note: Your “Linux files” are any of the files and folders under %localappdata%\lxss – which is where the Linux filesystem – distro and your own files – are stored on your drive

If you want to copy a file into a WSL directory which is not under /mnt, then use WSL to copy the file, i.e. use cp /mnt/c/original/folder/of/the/file.txt ~/ for example.

A more advanced alternative is starting a local SSH server in WSL and using Win-SSHFS to mount the WSL root as a drive in Windows. This way, file access will go through WSL.

1
  • See also WSL File System Support under the heading Interoperability with Windows: "While VolFs files are stored in regular files on Windows in the directories mentioned above, interoperability with Windows is not supported. If a new file is added to one of these directories from Windows, it lacks the EAs needed by VolFs, so VolFs doesn’t know what to do with the file and simply ignores it. Many editors will also strip the EAs when saving an existing file, again making the file unusable in WSL." Commented Apr 9, 2017 at 21:24
0

Its unclear what you're asking in your question. What did you paste? Whole files? Text? Where did you paste it? Did you do the pasting into the bash window? If so was it inside a text file or did you just paste to the prompt? I'm going to assume that you pasted files to the directory that you believe that your bash home opens in i.e ~/. You may not be pasting the files into the correct directory because the default directory for bash on windows is not where you would assume it to be. you should be able to reach your desktop by typing cd /mnt/c/Users/yourUserNameHere/Desktop

3
  • I did say I pasted files at the bash home folder. So yes I mean ~/ I think you misunderstood me. The bash home folder (inside Windows) is located at C:\Users\username\AppData\Local\lxss\home\ which is where I pasted my files. When I enter the terminal and go to this location I cannot see the files I just pasted. I am 100% that I am at the right location because if I create files from the terminal I can in fact see them in the Windows folder but not the other way around.
    – eatorres
    Commented Jan 18, 2017 at 4:52
  • Thats strange. Have you tried the long form version's of ls? ls -a or ls -l. Maybe you should try to copy the files using bash on windows with cp -rf path/to/file/including/file path/to/destination/ Commented Jan 19, 2017 at 6:45
  • @Hastradamus it's "strange" because this folder is not supposed to be modified from outside of WSL, since the files there use special extended NTFS attributes to provide the functionality a Linux filesystem normally would. Messing with the files there from normal Windows applications will not work and can even cause damage (for example when trying to copy or modify an existing file which was created by WSL).
    – CherryDT
    Commented Jan 22, 2017 at 21:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.