Running linux files on windows

Run Linux GUI apps on the Windows Subsystem for Linux

Windows Subsystem for Linux (WSL) now supports running Linux GUI applications (X11 and Wayland) on Windows in a fully integrated desktop experience.

WSL 2 enables Linux GUI applications to feel native and natural to use on Windows.

  • Launch Linux apps from the Windows Start menu
  • Pin Linux apps to the Windows task bar
  • Use alt-tab to switch between Linux and Windows apps
  • Cut + Paste across Windows and Linux apps

You can now integrate both Windows and Linux applications into your workflow for a seamless desktop experience.

Screenshot of Linux and Windows apps open on a desktop

Install support for Linux GUI apps

Prerequisites

  • You will need to be on Windows 10 Build 19044+ or Windows 11 to access this feature.
  • Installed driver for vGPU To run Linux GUI apps, you should first install the driver matching your system below. This will enable you to use a virtual GPU (vGPU) so you can benefit from hardware accelerated OpenGL rendering.
    • Intel GPU driver
    • AMD GPU driver
    • NVIDIA GPU driver

    Fresh install — No prior WSL installation

    You can now install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.

    Once your machine has finished rebooting, installation will continue and you will be asked to enter a username and password. This will be your Linux credential for the Ubuntu distribution.

    You’re now ready to begin using Linux GUI apps on WSL!

    Existing WSL install

    If you already have WSL installed on your machine, you can update to the latest version that includes Linux GUI support by running the update command from an elevated command prompt.

    1. Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
    2. Enter the WSL update command:

    Linux GUI apps are only supported with WSL 2 and will not work with a Linux distribution configured for WSL 1. Read about how to change your distribution from WSL 1 to WSL 2.

    Run Linux GUI apps

    You can run the following commands from your Linux terminal to download and install these popular Linux applications. If you are using a different distribution than Ubuntu, it may use a different package manager than apt. Once the Linux application is installed, you can find it in your Start menu under the distribution name. For example: Ubuntu -> Microsoft Edge .

    Support for GUI apps on WSL does not provide a full desktop experience. It relies on Windows desktop, so installing desktop-focused tools or apps may not be supported. To request additional support, you can file an issue in the WSLg repo on GitHub.

    Update the packages in your distribution

    Install Gnome Text Editor

    Gnome Text Editor is the default text editor of the GNOME desktop environment.

    sudo apt install gnome-text-editor -y 

    To launch your bashrc file in the editor, enter: gnome-text-editor ~/.bashrc

    Install GIMP

    GIMP is a free and open-source raster graphics editor used for image manipulation and image editing, free-form drawing, transcoding between different image file formats, and more specialized tasks.

    Install Nautilus

    Nautilus, also known as GNOME Files, is the file manager for the GNOME desktop. (Similar to Windows File Explorer).

    sudo apt install nautilus -y 

    Install VLC

    VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files.

    Install X11 apps

    X11 is the Linux windowing system and this is a miscellaneous collection of apps and tools that ship with it, such as the xclock, xcalc calculator, xclipboard for cut and paste, xev for event testing, etc. See the x.org docs for more info.

    sudo apt install x11-apps -y 

    To launch, enter the name of the tool you would like to use. For example:

    Install Google Chrome for Linux

    To install the Google Chrome for Linux:

    1. Change directories into the temp folder: cd /tmp
    2. Use wget to download it: sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    3. Get the current stable version: sudo dpkg -i google-chrome-stable_current_amd64.deb
    4. Fix the package: sudo apt install —fix-broken -y
    5. Configure the package: sudo dpkg -i google-chrome-stable_current_amd64.deb

    To launch, enter: google-chrome

    Install Microsoft Edge browser for Linux

    Find information on how to install the Microsoft Edge browser for Linux using the command line on the Edge Insider site. Select Get instructions under the Command line installation section of the page.

    To launch, enter: microsoft-edge

    Troubleshooting

    If you have any problem starting GUI applications please check this guide first: Diagnosing «cannot open display» type issues with WSLg

    Feedback

    Submit and view feedback for

    Источник

    Running Linux programs on Windows

    To run a Linux program on Windows, you have these options:

    • Run the program as-is on the Windows Subsystem for Linux (WSL). In WSL your program executes directly on the machine hardware, not in a virtual machine. WSL also enables direct filesystem calls between Windows and Linux systems, removing the need for SSL transport. WSL is designed as a command-line environment and is not recommended for graphics-intensive applications. For more information, see Windows Subsystem for Linux Documentation.
    • Run the program as-is in a Linux virtual machine or Docker container, either on your local machine or on Azure. For more information, see Virtual Machines and Docker on Azure.
    • Compile the program using gcc or clang in the MinGW or MinGW-w64 environments, which provide a translation layer from Linux to Windows system calls.
    • Compile and run the program using gcc or clang in the Cygwin environment, which provides a more complete Linux environment on Windows compared to MinGW or MinGW-w64.
    • Manually port your code from Linux and compile for Windows using Microsoft C++ (MSVC). This involves refactoring platform-independent code into separate libraries, and then re-writing the Linux-specific code to use Windows-specific code (for example, Win32 or DirectX APIs). For applications that require high performance graphics, this is probably the best option.

    Feedback

    Submit and view feedback for

    Источник

    How to Run Linux Apps on Windows 10 and 11 Using WSL

    Yosra Emad

    Yosra Emad

    How to Run Linux Apps on Windows 10 and 11 Using WSL

    I’ve been using Windows Subsystem for Linux (WSL) for my OS class for quite a while now. And I love how I can use Linux commands in Windows in a straightforward way without the added complexity of installing a virtual machine or dual booting.

    By the end of this article, you should be able to run Linux commands right from Windows like this:

    Untitled

    Prerequisites

    To have WSL running effectively, I suggest you upgrade to Windows 11. WSL is also available on Windows 10, but it is way more efficient on Windows 11 based on my experience.

    For Windows 10, you’ll need to have build 21364 or higher.

    This article will cover what you can do on both Windows 10 and 11

    How to Install WSL

    The command to run WSL is straightforward:

    This will download the Linux kernel, set WSL 2 as the default, and install Ubuntu as the default distribution.

    Don’t want ubuntu? Here is the command for you:

    These are the available distributions as of now:

    • Ubuntu
    • OpenSUSE Leap 42
    • SUSE Linux Enterprise Server 12 (SLES)
    • Kali Linux
    • Debian GNU/Linux

    After this, you’ll find an app called Ubuntu (or any other distro) in your start menu:

    Untitled-1

    Open the Linux Terminal

    Open the Ubuntu app that you just installed, and you’ll be greeted with a Linux terminal! Try running some commands:

    Untitled-2

    What if I want to access my Windows files?

    If you go to your file explorer (winkey+E) you’ll find a new Linux option on the left where all your Linux files exist. This is where when any files you create in the terminal will be located:

    Untitled-3

    But what if you want to access your regular files?

    Luckily, you can do that easily. Just run the following command in your Linux terminal:

    If you run ls here, you’ll find your computer drives. This way you’ll be able to cd your way into your files.

    Untitled-4-1

    How to Create Aliases in WSL2

    Do you ever have a long command to type and wish there were a shortcut for it? Then, aliases are your friends.

    There are two ways to create aliases:

    How to create per session aliases in WSL2

    To create an alias in your current session of Linux (the alias will be forgotten once you close the terminal), then you should run the following command:

    alias runc='gcc main.c -o main' 

    How to create permanent aliases in WSL2

    We’ll edit a file called .bash_aliases to save our aliases.

    Run the following commands:

    Look through the list of files that are printed out and look for .bash_aliases .

    If you can’t find it, run the following command:

    Now in order to edit the file, run this command:

    You’ll be greeted with a screen like this:

    Untitled-5

    • Press «i» to start typing, and add as many aliases as you want.
    alias runc='gcc main.c -o main' alias hello='echo hello' 
    • To exit the typing mode, press «ctrl + c».
    • To exit Vim and save the files type «:wq!» (I’m proud that I didn’t have to google that.)

    Now you’re ready! Restart Ubuntu and start typing any of the following aliases above and it should work perfectly:

    Untitled-6

    How to Run GUI Apps

    Okay cool, now we know how to run command line apps from WSL2. But what if we want to run Linux GUI apps? The answer is simple – you just need to install the GUI app before running it. I’ll use Firefox as an example.

    Untitled

    If you already have Firefox on your Windows machine, you’ll find that it isn’t open. That’s because you’re now running Firefox for Linux not Windows.

    You can even run Firefox for Linux right from the start menu if you use Windows 11. You’ll find it under your distro’s folder.

    Untitled

    Conclusion

    This article covered how to run WSL 2 effectively. If you have any questions, feel free to contact me on any of my social media platforms

    Источник

    Access Linux filesystems in Windows and WSL 2

    Starting with Windows Insiders preview build 20211, WSL 2 will be offering a new feature: wsl —mount . This new parameter allows a physical disk to be attached and mounted inside WSL 2, which enables you to access filesystems that aren’t natively supported by Windows (such as ext4). So, if you’re dual booting with Windows & Linux using different disks, you can now access your Linux files from Windows!

    Getting started

    wmic diskdrive list brief 

    terminal with wsl text

    The disks paths are available under the ‘DeviceID’ columns. Usually under the \\.\\\.\PHYSICALDRIVE* format. Below is an example of mounting a specific partition of a given hard disk into WSL and browsing its files.

    Accessing these files with File Explorer

    Accessing an EXT4 partition with file explorer

    Once mounted, it’s also possible to access these disks through the Windows explorer by navigating to \wsl$ and then to the mount folder.

    Limitations

    By default, wsl —mount attempts to mount the disk as ext4. To specify a filesystem, or for more advanced scenarios, check out Mount a disk in WSL 2. Also please note that this feature comes with the limitation that only physical disks can be attached to WSL 2. At this time, it’s not possible to attach a single partition. More details on the limitations here.

    Give us your feedback!

    If you run into any issues, or have feedback for our team please file an issue on our Github , and if you have general questions about WSL you can find all of our team members that are on Twitter on this twitter list.

    Источник

    Читайте также:  Подключение ftp консоли linux
Оцените статью
Adblock
detector