Computer

That’s how easy it is to open files in Linux from Windows

Activate the Windows Subsystem for Linux

The Windows Subsystem for Linux comes, by default, disabled on computers. Being an advanced feature, Microsoft wants that only users who need it, and know how to activate it, can do so to avoid causing compatibility and performance problems on other computers.

There are several ways to enable WSL in Windows 10 and in Windows 11. We can do it from the advanced features of Windows, activating Hyper-V, the subsystem and other functions necessary for it to work, from PowerShell, or, the option that we like the most, and introduced in summer 2021 in the operating system, to through a single command that we must execute in CMD. The next:

wsl.exe --install

This simple command will take care of activate Hyper-V on the PC, the subsystem and everything you need to start using this feature. And not only that, but it will also download and configure Ubuntu by default to be able to start using this tool as soon as possible.

Activate WSL

Once the process is finished, which only takes a few seconds, we will simply have to restart the computer and we will be able to start working with our new subsystem. In addition to Ubuntu, in the Microsoft Store we can find a wide variety of Linux distros prepared to work in WSL. We can download, install and use the one we want, without problem.

In case of receiving an error in the execution of this command, what we must do is make sure that the virtualization functions are activated in the BIOS / UEFI of the PC, and that we have Windows 11 installed on the PC, or the latest versions of Windows 10, that is, 2004, 20H2 or 21H1, with the latest patches released by Microsoft through Windows Update.

OpenInWSL

OpenInWSL is a totally free program, whose main purpose is to help us open any file with a Linux distro that we have installed on the PC simply by right-clicking on it. What this app does is add an entry to the contextual menu of our PC called “Open In WSL” which, when selected, will give us to choose how we want to open the file.

OpenInWSL
OpenInWSL

Developer: Opticos Studios

The main features of this app are:

  • It’s free.
  • Compatible with Windows 10 and Windows 11.
  • Add an entry in the context menu.
  • Create and manage file associations to always open certain types of files with Linux.
  • It is compatible with GWSL, the project that loads XServer on top of WSL to use apps with graphical environments.
  • It has a light mode and a dark mode.

The only thing we have to do to start using this app is to install it from the link to the Microsoft Store that we have seen previously. Once installed, it will be already registered in the system, and it will be ready to start working with it.

The first thing we will see will be a simple window like the following from which we can configure the app. We will can choose backend type to load the graphic environments of the applications that we want to use (for example, the already mentioned GWSL), if we want to activate transparency, or the color theme that we want to use. Also, very important, if we want to add the option “Open In WSL” to the context menu.

OpenInWSL - 1

From this window we can manage the list of associations, if we want, or see the program’s configuration as such. Ready.

Now, we simply have to select a file that we want (for example, a text file or a code file) and click on it in the contextual menu. We can see a new entry in this menu that will allow us to open the file in question directly with WSL.

OpenInWSL - 2

When selecting this option for the first time, we will be able to see a simple wizard where it will ask us to choose the Subsystem that we want to use (since we can have several Linux distros installed at the same time), and if we want to execute the file with different parameters. We can also see a list of all the apps installed in that subsystem to choose which one we want to open our file with.

OpenInWSL - 3

Ready. Now we can see how the file in question opens with the program that we have selected within the Linux Subsystem for Windows. Thus, for example, we can use Geany, and the Linux compiler, to program in all kinds of languages.

Other ways to do it

Of course, OpenInWSL greatly facilitates a task that, otherwise, can be quite complicated. However, it is not the only way we have to open our Windows files with Linux programs. We can always do the process manually, just as it was before this app existed.

To do this, we have several ways to do it. The first one is to enter the Windows drive from the Linux Subsystem as if it were one more mounted unit. That is, to enter C: we would have to execute “cd / mnt / c”. In this way, using the “cd” command we can move around it as if it were a disk more connected to the PC, and access the files stored in it from the terminal or with an XServer. We simply have to run the app we want to use (both with the GUI and from the terminal) and open it with it.

Another way we can choose is configure an SSH server in Windows, and connect from WSL to it. By connecting like this from WSL to our main Windows, we can access all the files that we have saved in it and open the one we want with the program we want. Of course, this method is much more limited and we can only use it with terminal programs (such as Vim).

Be that as it may, the best way we have to do this is through OpenInWSL, one of the best programs that we will be able to find to get the most out of the Windows Subsystem for Linux.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *