admin管理员组

文章数量:1567915

wsl运行linux

Larry Ewing
拉里·尤因

Windows 10’s May 2019 Update finally offers an easy, safe, and officially supported way to access and work with your Linux files from within File Explorer and other applications. Here’s how to get at your Windows Subsystem for Linux files.

Windows 10的2019年5月更新最终提供了一种简单,安全且受到官方支持的方式,可以从文件资源管理器和其他应用程序中访问和使用Linux文件。 这是获取Windows Subsystem for Linux文件的方法。

Unlike previous methods, this is a safe way to work with Linux files! Windows does some magic in the background, making it possible to edit your Linux files from Windows applications without causing file permission issues. You still shouldn’t modify the underlying files at their real location on your system.

与以前的方法不同,这是使用Linux文件的安全方法! Windows 在后台做了一些魔术 ,使从Windows应用程序编辑Linux文件成为可能,而不会引起文件权限问题。 您仍然不应该在系统上的实际位置修改基础文件。

There are two ways to access your Linux files. First, the easy one. From within the Windows Subsystem for Linux environment you want to browse, run the following command:

有两种访问Linux文件的方法。 首先,容易。 在要浏览的Windows Linux子系统Windows环境中,运行以下命令:

explorer.exe .

This will launch File Explorer showing the current Linux directory—you can browse the Linux environment’s file system from there.

这将启动显示当前Linux目录的文件资源管理器-您可以从那里浏览Linux环境的文件系统。

You can also access them directly at a \\wsl$ path. In File Explorer or any other Windows application that can browse files, navigate to the following path:

您也可以直接在\\wsl$路径中访问它们。 在文件浏览器或任何其他可以浏览文件的Windows应用程序中,导航到以下路径:

\\wsl$

You’ll see the folders for all your installed Linux distributions, which are exposed as if they were network shares. For example, Ubuntu 18.04 usually is available at \\wsl$\Ubuntu-18.04 .

您将看到所有已安装的Linux发行版的文件夹,这些文件夹似乎是网络共享的。 例如,通常可以从\\wsl$\Ubuntu-18.04

Feel free to create a shortcut to this folder—for example, you could drag it to the Quick Access section in File Explorer’s sidebar.

随意创建此文件夹的快捷方式-例如,您可以将其拖到“文件资源管理器”侧栏中的“快速访问”部分。

Again, you can modify these files normally as if they were any other type of file on your system. Modify files with Windows tools (Notepad even supports Unix line endings!), create new files in the Linux folders, delete files, or do anything else you like. Windows will ensure nothing goes wrong and the file’s permissions are updated properly.

同样,您可以正常修改这些文件,就像它们是系统上任何其他类型的文件一样。 使用Windows工具修改文件( 记事本甚至支持Unix行尾 !),在Linux文件夹中创建新文件,删除文件,或执行其他任何您喜欢的事情。 Windows将确保一切正常,并且文件权限已正确更新。

翻译自: https://www.howtogeek/426749/how-to-access-your-linux-wsl-files-in-windows-10/

wsl运行linux

本文标签: 文件如何在WSLWindows