Where are files saved when created in a WSL terminal window?

11,843

Solution 1

Method 1

While in the Ubuntu terminal enter:

explorer.exe . 

Note the . at the end. This will open a File Explorer window where you are at in Ubuntu.

enter image description here

Method 2

Open File Explorer in Windows the usual way:

enter image description here

Then at the top type:

\\wsl$\Ubuntu\home\<Your Ubuntu Username>

enter image description here

Source: https://winaero.com/blog/access-wsl-linux-files-file-explorer-windows-10/

Note: Text files created in Ubuntu uses different conventions for new lines as compared with Windows. If you edit these files using Windows tools they may not work as before in Ubuntu. Messing with Ubuntu system files via Windows Explorer may corrupt those files.

Warning

Do not change Linux files using Windows apps and tools

DO NOT, under ANY circumstances, access, create, and/or modify Linux files inside of your %LOCALAPPDATA% folder using Windows apps, tools, scripts, consoles, etc.

Opening > files using some Windows tools may read-lock the opened files > and/or folders, preventing updates to file contents and/or metadata, > essentially resulting in corrupted files/folders.

Creating/changing Linux files in your Appdata folder from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro!

Hope this helps

Solution 2

when you install the Ubuntu using WSL then default location of your saved files are: all your files should be present

 "C:\users\username\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home"
Share:
11,843
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I recently installed Ubuntu in WSL on my Windows 10 system following the steps at How to install Windows Subsystem for Linux (WSL) on Windows 10 | Windows Central. I created files in a Terminal window but I don't know how to access them via folder. How can I find and open such a file?

  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 4 years
    We've been told many times to never open a Linux file with a windows app because it can corrupt the data. There are many Linux programs the OP can use like 'ls, cat, cd, etc from the command line. Plus the OP can install nautilus and gedit if so inclined to use a GUI. There seems little point in installing Linux on Windows and turning around to use Windows to massage the Linux data.
  • user68186
    user68186 over 4 years
    @WinEunuuchs2Unix Now I have a Warning section at the bottom of the answer based on Microsofts own blog.