Categories
Self-organization

How to run graphical linux desktop applications from windows 10’s bash shell

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10’s Bash shell doesn’t officially support graphical Linux desktop applications. Microsoft says this feature is designed only for developers who want to run Linux terminal utilities. But the underlying “Windows Subsystem for Linux” is more powerful than Microsoft lets on.

It is possible to run graphical Linux applications in Windows 10, but bear in mind that it isn’t officially supported. Not every piece of Linux software works, and graphical applications are even more complex and less tested. But these should become more stable over time as Microsoft improves the underlying Windows Subsystem for Linux.

Windows 10’s Bash shell only supports 64-bit binaries, so you can’t install and run 32-bit Linux software.

How This Works

First, let’s run down exactly how this works so you can have some understanding of what we’re doing here.

Windows 10 includes an underlying “Windows Subsystem for Linux” that allows Windows 10 to run Linux software by translating Linux system calls to Windows system calls.

When you run a Linux distribution like Ubuntu, it downloads and installs a complete Ubuntu user space image on your computer. This includes the exact same binaries–or applications–that would run on Ubuntu. That “Bash on Ubuntu on Windows” environment works thanks to the underlying Windows Subsystem for Linux.

Microsoft doesn’t want to spend any time working on graphical software, as this feature is intended for command-line developer tools. But the main technical reason that graphical applications aren’t supported is that they require an “X server” to provide that graphical interface. On a typical Linux desktop, that “X server” automatically appears when you boot your computer and it renders the entire desktop and the applications you use.

But try opening a graphical application from Bash on Windows, though, and it will complain that it can’t open a display.

How to run graphical linux desktop applications from windows 10’s bash shell

There are X server applications you can install on a Windows desktop, however. Typically, these are used to render Linux applications running on other computers–the “X11” protocol is rather old and was designed with the ability run over a network connection.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop. Everything should work fine, assuming those applications don’t depend on Linux system calls that the Windows Subsystem for Linux doesn’t yet support.

Step One: Install an X Server

There are several different X servers you could install on Windows, but we recommend Xming. Download it and install it on your Windows 10 PC.

The installation process is simple: You can just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

How to run graphical linux desktop applications from windows 10’s bash shell

Step Two: Install the Program

You can install graphical Linux desktop programs like you can any other program, using the apt-get command in the Ubuntu-based Bash environment. For example, let’s say you’d want to install the graphical, GTK-based vim editor. You’d run the following command in the Bash window:

How to run graphical linux desktop applications from windows 10’s bash shell

It will go through the installation process in the command line window, just like it does on Ubuntu.

Step Three: Set Your Display Environment Variable

Now, you’ll need to set the “DISPLAY” environment variable to point at the X server running on your Windows 10 PC. If you don’t do this, graphical applications will simply fail to launch.

To do this, run the following command in the Bash environment:

This setting only applies to your current Bash session. If you close the window, Bash will forget it. You’ll have to run this command each time you reopen Bash and want to run a graphical application.

Step Four: Launch an Application

You can now just launch a graphical application by typing the name of its executable, like you’d type any other command. For example, to launch vim-gtk, you’d run:

It’s that simple. If the application crashes after launching, the Linux system calls it requires may not be supported by the Windows Subsystem for Linux. There’s not much you can do about this. But give it a shot, and you may find that the apps you need work decently well!

How to run graphical linux desktop applications from windows 10’s bash shell

You can also combine the third and fourth steps, if you like. Rather than exporting the DISPLAY variable once for an entire Bash shell session, you’d just run a graphical application with the following command:

For example, to launch gvim, you’d run:

Remember, this isn’t officially supported, so you may run into errors with more complex applications. A virtual machine is a more reliable solution for running many graphical Linux desktop applications on Windows 10, but this is a neat solution for some of the simpler stuff.

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10’s Bash shell doesn’t officially support graphical Linux desktop applications. Microsoft says this feature is designed only for developers who want to run Linux terminal utilities. But the underlying “Windows Subsystem for Linux” is more powerful than Microsoft lets on.

It is possible to run graphical Linux applications in Windows 10, but bear in mind that it isn’t officially supported. Not every piece of Linux software works, and graphical applications are even more complex and less tested. But these should become more stable over time as Microsoft improves the underlying Windows Subsystem for Linux.

Windows 10’s Bash shell only supports 64-bit binaries, so you can’t install and run 32-bit Linux software.

How This Works

First, let’s run down exactly how this works so you can have some understanding of what we’re doing here.

Windows 10 includes an underlying “Windows Subsystem for Linux” that allows Windows 10 to run Linux software by translating Linux system calls to Windows system calls.

When you run a Linux distribution like Ubuntu, it downloads and installs a complete Ubuntu user space image on your computer. This includes the exact same binaries–or applications–that would run on Ubuntu. That “Bash on Ubuntu on Windows” environment works thanks to the underlying Windows Subsystem for Linux.

Microsoft doesn’t want to spend any time working on graphical software, as this feature is intended for command-line developer tools. But the main technical reason that graphical applications aren’t supported is that they require an “X server” to provide that graphical interface. On a typical Linux desktop, that “X server” automatically appears when you boot your computer and it renders the entire desktop and the applications you use.

But try opening a graphical application from Bash on Windows, though, and it will complain that it can’t open a display.

How to run graphical linux desktop applications from windows 10’s bash shell

There are X server applications you can install on a Windows desktop, however. Typically, these are used to render Linux applications running on other computers–the “X11” protocol is rather old and was designed with the ability run over a network connection.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop. Everything should work fine, assuming those applications don’t depend on Linux system calls that the Windows Subsystem for Linux doesn’t yet support.

Step One: Install an X Server

There are several different X servers you could install on Windows, but we recommend Xming. Download it and install it on your Windows 10 PC.

The installation process is simple: You can just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

How to run graphical linux desktop applications from windows 10’s bash shell

Step Two: Install the Program

You can install graphical Linux desktop programs like you can any other program, using the apt-get command in the Ubuntu-based Bash environment. For example, let’s say you’d want to install the graphical, GTK-based vim editor. You’d run the following command in the Bash window:

How to run graphical linux desktop applications from windows 10’s bash shell

It will go through the installation process in the command line window, just like it does on Ubuntu.

Step Three: Set Your Display Environment Variable

Now, you’ll need to set the “DISPLAY” environment variable to point at the X server running on your Windows 10 PC. If you don’t do this, graphical applications will simply fail to launch.

To do this, run the following command in the Bash environment:

This setting only applies to your current Bash session. If you close the window, Bash will forget it. You’ll have to run this command each time you reopen Bash and want to run a graphical application.

Step Four: Launch an Application

You can now just launch a graphical application by typing the name of its executable, like you’d type any other command. For example, to launch vim-gtk, you’d run:

It’s that simple. If the application crashes after launching, the Linux system calls it requires may not be supported by the Windows Subsystem for Linux. There’s not much you can do about this. But give it a shot, and you may find that the apps you need work decently well!

How to run graphical linux desktop applications from windows 10’s bash shell

You can also combine the third and fourth steps, if you like. Rather than exporting the DISPLAY variable once for an entire Bash shell session, you’d just run a graphical application with the following command:

For example, to launch gvim, you’d run:

Remember, this isn’t officially supported, so you may run into errors with more complex applications. A virtual machine is a more reliable solution for running many graphical Linux desktop applications on Windows 10, but this is a neat solution for some of the simpler stuff.

We don’t allow questions about general computing hardware and software on Stack Overflow. You can edit the question so it’s on-topic for Stack Overflow.

Closed 8 months ago .

The community reviewed whether to reopen this question 8 months ago and left it closed:

Original close reason(s) were not resolved

How to run graphical Linux desktop applications from Windows 10’s Bash Shell?

First, I installed Windows Subsystem for Linux (WSL) following steps as shown in here as follows:

(1) Installed Windows 10 Pro Insider Preview Build 19619.

(2) Installed Ubuntu Linux distribution.

(3) Changed the distribution version from WSL 1 to WSL 2.

Second, to enable graphical Linux desktop applications from Windows 10’s Bash Shell, I followed the following steps as shown here as follows:

(4) I installed an X Server that is Xming

(5) Installed graphical GTK-based vim editor as test using:

sudo apt-get install vim-gtk

(6) Set my display environment variable

(7) Launch an Application

However, this did not lunch the application and I got the following error:

Any idea why this error is occurring?

9 Answers 9

The networking subsystem in WSL2 is different than the used in WSL1. You must consider the differences to access networking apps running on Windows and on Linux:

  • In WSL1, Linux uses the same IP addresses than the Windows host, then, you can access the applications using localhost or 127.0.0.1
  • In WSL2, Linux runs on a lightweight virtual machine and has a different IP address. To access networking apps running on the Windows Host you must use the Windows IP address.

Checking the IP address of the Windows host

There are many ways to determine the IP addresses in the Windows host. You may run the following commands in your WSL Linux:

How to run graphical linux desktop applications from windows 10’s bash shell

Microsoft said it wouldn’t support graphical applications in Bash on Windows. But enterprising geeks like w2qw on Reddit have already figured out how to run graphical applications with Bash on Windows 10. The underlying code is much more capable than Microsoft initially let on.

Install an X server

This is possible because the Bash shell for Windows is more than just a shell. Microsoft built an entire “Windows Subsystem for Linux” that allows Windows 10 to natively run Linux applications, even graphical ones. Install Bash for Windows 10 and you’ll actually have a complete operating system layer for running Linux applications and a full Ubuntu userspace environment—that is, everything above the Linux kernel.

The only missing piece is an X server that allows those graphical applications to appear on your Windows desktop. This is basically the same technique people would use to run graphical Linux desktop applications over a network.

The Xming X Server for Windows works well for this, although there are other X servers for Windows and they should also work. Download and install it on your Windows 10 PC to get started. You can just use the default settings and it’ll work fine. Launch Xming and it will appear in your system tray, running in the background and waiting for you to launch a graphical Linux program.

This is Windows 10 running Linux desktop applications.

Launch applications from Ubuntu’s Bash shell

You’ll now need to install a graphical application, which you can do with the standard apt-get command in the Bash shell environment. The apt-get command has access to Ubuntu’s entire software repositories, so you can use it to install graphical applications without any additional tweaks.

For example, to install the Linux version of Firefox from Ubuntu’s repositories, you’d just run the following command:

apt-get install firefox

Once you’ve installed the program, you can specify the X server and then launch the application. For example, to launch Firefox, run the below commands. (To launch another graphical application, just specify its name instead of “firefox.)”

export DISPLAY=:0

firefox

Assuming you’re running an X server like Xming on your Windows PC, the graphical application should run. It may not run as speedily—applications can’t use direct rendering to run on your hardware directly.

This is currently a bit unstable. Many applications I tried were unable to run reliably. Some people report better success. But bugs are no surprise , as the Windows Subsystem for Linux is beta and this is its first release. As Microsoft improves the underlying code, applications—even these graphical applications—should work better and better over time.

Windows 10’s Bash shell doesn’t officially support graphical Linux desktop applications. Microsoft says this feature is designed only for developers who want to run Linux terminal utilities. But the underlying “Windows Subsystem for Linux” is more powerful than Microsoft lets on.

It is possible to run graphical Linux applications in Windows 10, but bear in mind that it isn’t officially supported. Not every piece of Linux software works, and graphical applications are even more complex and less tested. But these should become more stable over time as Microsoft improves the underlying Windows Subsystem for Linux.

How This Works

First, let’s run down exactly how this works so you can have some understanding of what we’re doing here.

Windows 10 includes an underlying “Windows Subsystem for Linux” that allows Windows 10 to run Linux software by translating Linux system calls to Windows system calls.

When you run the bash.exe program, it downloads and installs a complete Ubuntu user space image on your computer. This includes the exact same binaries–or applications–that would run on Ubuntu. That “Bash on Ubuntu on Windows” environment works thanks to the underlying Windows Subsystem for Linux.

Microsoft doesn’t want to spend any time working on graphical software, as this feature is intended for command-line developer tools. But the main technical reason that graphical applications aren’t supported is that they require an “X server” to provide that graphical interface. On a typical Linux desktop, that “X server” automatically appears when you boot your computer and it renders the entire desktop and the applications you use.

But try opening a graphical application from Bash on Windows, though, and it will complain that it can’t open a display.

How to run graphical linux desktop applications from windows 10’s bash shell

There are X server applications you can install on a Windows desktop, however. Typically, these are used to render Linux applications running on other computers–the “X11” protocol is rather old and was designed with the ability run over a network connection.

If you install an X server application on your Windows desktop and change a setting in the Bash shell, applications will send their graphical output to the X server application and they’ll appear on your Windows desktop. Everything should work fine, assuming those applications don’t depend on Linux system calls that the Linux Subsystem for Windows doesn’t yet support.

Step One: Install an X Server

There are several different X servers you could install on Windows, but we recommend Xming. Download it and install it on your Windows 10 PC.

The installation process is simple: You can just accept the default settings. It will then automatically launch and run in your system tray, waiting for you to run graphical programs.

How to run graphical linux desktop applications from windows 10’s bash shell

Step Two: Install the Program

You can install graphical Linux desktop programs like you can any other program,using the apt-get command in the Ubuntu-based Bash environment. For example, let’s say you’d want to install the graphical, GTK-based vim editor. You’d run the following command in the Bash window:

How to run graphical linux desktop applications from windows 10’s bash shell

It will go through the installation process in the command line window, just like it does on Ubuntu.

Step Three: Set Your Display Environment Variable

Now, you’ll need to set the “DISPLAY” environment variable to point at the X server running on your Windows 10 PC. If you don’t do this, graphical applications will simply fail to launch.

To do this, run the following command in the Bash environment:

This setting only applies to your current Bash session. If you close the window, Bash will forget it. You’ll have to run this command each time you reopen Bash and want to run a graphical application.

How to run graphical linux desktop applications from windows 10’s bash shell

Step Four: Launch an Application

You can now just launch a graphical application by typing the name of its executable, like you’d type any other command. For example, to launch vim-gtk, you’d run:

It’s that simple. If the application crashes after launching, the Linux system calls it requires may not be supported by the Windows Subsystem for Linux. There’s not much you can do about this. But give it a shot, and you may find that the apps you need work decently well!

How to run graphical linux desktop applications from windows 10’s bash shell

You can also combine the third and fourth steps, if you like. Rather than exporting the DISPLAY variable once for an entire Bash shell session, you’d just run a graphical application with the following command:

For example, to launch gvim, you’d run:

Remember, this isn’t officially supported, so you may run into errors with more complex applications. A virtual machine is a more reliable solution for running many graphical Linux desktop applications on Windows 10, but this is a neat solution for some of the simpler stuff.

How to run graphical linux desktop applications from windows 10’s bash shell

You might be aware of Microsoft and Canonical’s partnership to integrate “Bash on Ubuntu on Windows 10,” which is typically a non-graphical Ubuntu running over Windows Subsystem for Linux. Windows 10 doesn’t officially support graphical Linux desktop applications.

But, now we have noticed a very interesting ticket titled “Run Any Desktop Environment in WSL” raised at Github repository, in which a user who goes by name Guerra24 has managed to run the graphical version of Ubuntu Linux, i.e. Ubuntu Unity on Windows 10.

How to run graphical linux desktop applications from windows 10’s bash shell

It’s not “Microsoft Linux.”

BASH or Bourne Again Shell is capable of handling advanced command line functionalities. Microsoft has provided support for Bash on Windows 10 as an expansion of its command-line tool family, so don’t get confused.

The Bash on Windows 10 feature is designed only for developers who want to run Linux terminal utilities without any OS dependencies.

However, this feature downloads and installs a complete Ubuntu user space image, which includes binaries and applications that would run on Ubuntu.

So, Guerra24 managed to find a way that enables Ubuntu’s Unity desktop environment, i.e. the graphical version of Ubuntu, on Windows 10 desktop.

However, before doing that you need to turn on “Bash on Windows 10” if you haven’t yet.

Bash on Ubuntu on Windows is currently available on latest Windows 10 Insider Preview Build 14316; however, the company will bring it to Windows 10 as part of the Windows 10 Anniversary Update coming in August.

How to run graphical linux desktop applications from windows 10’s bash shell

Once done, next to enable Ubuntu’s Unity desktop environment, you need to follow these steps:

Step 1: Download and Install “VcXsrv Windows X Server” on your Windows 10.

At the Microsoft Build 2020 virtual developers’ conference, CEO Satya Nadella announced that Windows Subsystem for Linux (WSL) 2.0 would soon support Linux GUIs and applications. That day is closer now than ever before. At the recent X.Org Developers Conference (XDC), Microsoft partner developer lead Steve Pronovost revealed that Microsoft has made it possible to run graphical Linux applications within WSL.

Windows 10

  • Here’s how you can still get a free Windows 10 upgrade
  • The top Windows laptops compared
  • Not ready to upgrade to Windows 11? Do this instead
  • The best keyboards: Because you deserve better

It’s always been possible to run Linux graphical programs such as the GIMP graphics editor, Evolution e-mail client, and LibreOffice on WSL. But it wasn’t easy. You had to install a third-party X Window display server, such as the VcXsrv Windows X Server in Windows 10, and then do some tuning with both Windows and Linux to get them to work together smoothly. The X Window System underlies almost all Linux graphical user interfaces.

Now, Microsoft has ported a Wayland display server to WSL. Wayland is the most popular X Window compatible server. In WSL2, it connects the graphical Linux applications via a Remote Desktop Protocol (RDP) connection to the main Windows display. This means you can run Linux and Windows GUI applications simultaneously on the same desktop screen.

WSL essentially runs Linux inside of a Virtual Machine hosted by Windows and we integrate applications (console, and now GUI) back onto your Windows desktop so you can run both Win32 and Linux applications inside of a unified experience. Because Linux is running in VM, we can’t run the native GPU driver that expects direct access to the GPU (unless we were to do something like discrete device assignment and assign one of the host GPU to the VM. but then the host would lose access to that GPU!). With GPU-PV [GPU Paravirtualization] we can essentially project the host GPU in Linux and have both Linux and Windows processes share the same physical GPU without the need for fixed resource partitioning.

Craig Loewen, Microsoft WSL Program Manager, added in a Twitter thread that the key differences between using a third-party X server and the built-in Wayland server is that: “You don’t need to start up or start the server, we’ll handle that for you.” In addition, it comes with “Lovely integration with Windows,” such as drop shadows and Linux icon support.

Loewen also said you can run a Linux web browser in it. “We haven’t tested it extensively with a full desktop environment yet, as we want to focus on running often asked for apps first, and primarily IDEs [integrated development environment] so you can run those in a full Linux environment,” he said.

Don’t get too excited about it just yet, though. Loewen continued, “We don’t yet have an ETA for the beta channel, however, this work will be available in general for Insiders to try within the next couple of months.”

Microsoft’s integration of Linux into Windows has been coming for some time. Four years ago, Microsoft introduced WSL, which brought the Linux Bash shell to Windows 10. With Bash and WSL, you can run most Linux shell tools and popular Linux programming languages.

As time went on, Linux became more of a first-class citizen on the Windows desktop. Multiple Linux distros, starting with Ubuntu, were followed by Red Hat Fedora and SUSE Linux Enterprise Desktop (SLED). Then, Microsoft replaced its WSL translation layer, which converted Linux kernel calls into Windows calls, with WSL 2. This update came with Microsoft’s own Linux kernel running on a thin version of the Hyper-V hypervisor.

More recently, starting with the Windows 10 Insider Preview build 20211, Windows users can access Linux file systems. This includes access to Linux file systems, such as ext4, which Windows doesn’t natively support. It also means, if you dual-boot Windows and Linux with different disks, you can now access Linux files from Windows. With this, you can access Linux files from both the Windows File Explorer and PowerShell window with administrative privilege.

At the rate things are going, my “crazy” prediction that Windows 11 might run on top of Linux may yet come true!

In this article, we will see how you can install your favorite Linux GUI application on your Windows PC/Laptop. For this, we will use WSLg. WSLg which stands for Windows Subsystem for Linux GUI is an open-source project that enables the support for running Linux GUI applications on Windows in a fully integrated desktop experience.

WSLg offers a seamless experience for developers, scientists, and hobbyists who prefer or want Windows on their PC but also require the option to run tools or apps that function best, or solely, in a Linux environment.

Prerequisites:

  • You must be running Windows 10 version 2004 and higher or Windows 11.

To check your current Windows version, hold the Windows logo key + R, type winver, select OK, or go to Windows settings > System > About.

Steps for installation:

Step 1: Open CMD (Command Prompt) using administrator privileges.

Step 2: In this step, we will install a Linux distribution of our choice. Type wsl -l -o in the terminal to get a list of available Linux distributions.

Step 3: let’s install Ubuntu version 20.04. Type wsl –install -d Ubuntu-20.04 in the terminal to download and install it.

Step 4: After installing, the Ubuntu terminal will be launched automatically. Here we have to create a default UNIX user account, so provide a new UNIX username and a password (onetime setup).

Step 5: Now go back to the CMD and type wsl –list -v to view the running version of Ubuntu. If the version number is not 2, then type wsl –update in the terminal.

Step 6: Now go back to the Ubuntu terminal and type sudo apt update to download package information from all configured sources.

Step 7: Lets install a GUI Linux application like ‘Nautilus‘ which is one of the most popular file managers in Linux. Type sudo apt-get install nautilus in the Ubuntu terminal.

Step 8: After installing, we can find the software under the Windows Apps section.

As you can see we have successfully installed a Linux GUI app on our Windows machine.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10s Bash-shell understøtter ikke officielt grafiske Linux-desktopapplikationer. Microsoft siger, at denne funktion kun er udviklet til udviklere, der ønsker at køre Linux-terminalværktøjer. Men det underliggende “Windows-subsystem til Linux” er kraftigere end Microsoft lader på.

Det er muligt at køre grafiske Linux-applikationer i Windows 10, men husk på, at det ikke er officielt understøttet. Ikke alle Linux-programmer fungerer, og grafiske applikationer er endnu mere komplekse og mindre testede. Men disse skal blive mere stabile over tid, da Microsoft forbedrer det underliggende Windows-subsystem til Linux.

Windows 10s Bash-shell understøtter kun 64-bit binarier, så du kan ikke installere og køre 32-bit Linux-software. Dette virker

Lad os først køre ned præcis, hvordan det virker, så du kan få en vis forståelse for, hvad vi laver her.

Windows 10 indeholder et underliggende “Windows-subsystem til Linux”, der gør det muligt for Windows 10 at køre Linux-software ved at oversætte Linux-systemopkald til Windows-systemopkald.

Når du kører en Linux-distribution som Ubuntu, downloader og installerer du et komplet Ubuntu brugerrumsbillede på din computer. Dette omfatter de nøjagtige samme binære filer eller programmer, der ville køre på Ubuntu. At “Bash on Ubuntu on Windows” miljøet virker takket være det underliggende Windows-subsystem til Linux.

Microsoft vil ikke bruge nogen tid på at arbejde med grafisk software, da denne funktion er beregnet til kommandolinjeudviklerværktøjer. Men den vigtigste tekniske årsag til, at grafiske applikationer ikke understøttes, er, at de kræver en “X-server” for at tilvejebringe den grafiske grænseflade. På et typisk Linux-skrivebord vises den “X-server” automatisk, når du starter din computer, og det gør hele skrivebordet og de programmer, du bruger.

Men prøv at åbne en grafisk applikation fra Bash on Windows, og det vil klage at det ikke kan åbne en skærm.

Der er dog X-serverprogrammer, som du kan installere på et Windows-skrivebord. Typisk bruges disse til at gøre Linux-programmer kørende på andre computere. Protokollen “X11” er ret gammel og designet med evnen til at køre over en netværksforbindelse.

How to run graphical linux desktop applications from windows 10’s bash shell

Hvis du installerer et X-serverprogram på dit Windows-skrivebord og ændrer en indstilling i Bash-skalen, vil applikationer sende deres grafiske output til X-serverprogrammet, og de vises på dit Windows-skrivebord. Alt skal fungere fint, forudsat at disse applikationer ikke afhænger af Linux-systemopkald, som Windows-delsystemet til Linux endnu ikke understøtter.

Trin One: Installer en X-server

Der er flere forskellige X-servere, du kan installere på Windows, men vi anbefaler Xming. Download den og installer den på din Windows 10-pc.

Installationsprocessen er enkel: Du kan bare acceptere standardindstillingerne. Den starter automatisk og kører i systembakken, og venter på, at du kører grafiske programmer.

Trin 2: Installer programmet

How to run graphical linux desktop applications from windows 10’s bash shell

RELATED:

Sådan installeres Linux-software i Windows 10s Ubuntu Bash Shell Du kan installere grafiske Linux desktop-programmer som du kan andre programmer, ved hjælp af apt-get-kommandoen i det Ubuntu-baserede Bash-miljø. Lad os f.eks. Sige, at du vil installere den grafiske, GTK-baserede vim-editor. Du vil køre følgende kommando i Bash-vinduet:

sudo apt-get install vim-gtk

How to run graphical linux desktop applications from windows 10’s bash shell

Trin Tre: Indstil din skærmmiljøvariabel

Nu skal du indstille miljøvariablen “DISPLAY” til at pege på X-serveren, der kører på din Windows 10-pc. Hvis du ikke gør det, vil grafiske applikationer simpelthen ikke starte.

Kør følgende kommando i Bash-miljøet:

eksport DISPLAY =: 0

Trin fire: Start et program

Du kan nu bare starte en grafisk applikation ved at skrive navnet på dets eksekverbare, som om du ville skrive en anden kommando. For eksempel for at starte vim-gtk, ville du køre:

Du kan også kombinere det tredje og fjerde trin, hvis du vil. I stedet for at eksportere DISPLAY-variablen en gang til en hel Bash shell-session, ville du bare køre en grafisk applikation med følgende kommando:

How to run graphical linux desktop applications from windows 10’s bash shell

“Windows 10” “Bash” lange oficialiai nepalaiko grafinių “Linux” darbalaukio programų. “Microsoft” teigia, kad ši funkcija skirta tik kūrėjams, kurie nori paleisti “Linux” terminalų programinę įrangą. Tačiau pagrindinis “Windows” posistemis “Linux” yra galingesnis, nei “Microsoft” leidžia.

Galima paleisti grafines “Linux” programas “Windows 10”, tačiau nepamirškite, kad ji oficialiai nepalaikoma. Ne kiekviena “Linux” programinės įrangos dalis veikia, o grafinės programos yra dar sudėtingesnės ir mažiau išbandytos. Tuo metu, kai “Microsoft” patobulina esamą “Windows” posistemį “Linux”, jie turėtų stabilizuotis.

“Windows 10” “Bash” lange palaiko tik 64 bitų dvejetainius failus, todėl negalima įdiegti ir paleisti 32 bitų “Linux” programinės įrangos. Tai veikia

Pirma, pagalvokime, kaip tai veikia, kad galėtumėte suprasti, ką mes čia darome.

“Windows 10” apima pagrindinį “Windows” Linux “posistemį, kuris leidžia” Windows 10 “paleisti” Linux “programinę įrangą perduodama “Linux” sistemos skambučius į “Windows” sistemos skambučius.

Kai paleidžiate “Linux” platinimą, pvz., Ubuntu, kompiuteryje atsisiunčia ir įdiegia visą Ubuntu vartotojo erdvę. Tai apima tuos pačius dvejetainius failus ar programas, kurios paleidžiamos Ubuntu. “Windows” “Ubuntu” “Windows” aplinka veikia dėl pagrindinio Windows “Linux” posistemio.

“Microsoft” nenori bet kuriuo metu dirbti grafinėje programinėje įrangoje, nes ši funkcija skirta komandinės eilutės kūrimo įrankiams. Tačiau pagrindinė techninė priežastis, dėl kurios grafinės programos nepalaikomos, yra tai, kad jiems reikalingas “X serveris”, kad būtų pateikta tokia grafinė sąsaja. Įprastame “Linux” darbalaukyje “X serveris” automatiškai pasirodo, kai įkeliamas kompiuteris, ir visa tai sudaro visą darbalaukį ir programas, kurias naudojate.

Tačiau bandykite atidaryti grafinę programą iš “Bash” sistemoje “Windows”, ir ji skundžiasi kad jis negali atidaryti ekrano.

Tačiau yra X serverių programos, kurias galite įdiegti “Windows” darbalaukyje. Paprastai jie naudojami norint, kad “Linux” programos būtų naudojamos kituose kompiuteriuose, “X11” protokolas yra gana senas, jis buvo sukurtas taip, kad galėtų veikti per tinklo ryšį.

How to run graphical linux desktop applications from windows 10’s bash shell

Jei jūsų “Windows” darbalaukyje įdiekite X serverio programą ir pakeiskite “Bash” lakšto nustatymas, programos išsiųs grafinę išvestį į “X” serverio programą ir bus rodomos “Windows” darbalaukyje. Viskas turėtų veikti gerai, jei tos programos nepriklausytų nuo Linux sistemos skambučių, kurių “Windows” posistemis “Linux” dar nepalaiko.

Pirmas žingsnis: įdiekite X serverį

Yra keletas skirtingų X serverių, kuriuos galite įdiegti. “Windows”, bet mes rekomenduojame “Xming”. Atsisiųskite ją ir įdiekite į savo “Windows 10” kompiuterį.

Įdiegimo procesas yra paprastas: galite priimti numatytuosius nustatymus.

Antras žingsnis: įdiekite programą

How to run graphical linux desktop applications from windows 10’s bash shell

SUSIJĘS:

Kaip įdiegti “Linux” programinę įrangą “Windows 10” “Ubuntu Bash Shell” “ Galite įdiegti grafines “Linux” darbastalio programas, pvz., Galite naudoti bet kurią kitą programą, naudodami “apt-get” komandą Ubuntu pagrįstoje “Bash” aplinkoje. Pvz., Tarkime, kad norite įdiegti grafinį GTK pagrindu sukurtą VIM redaktorių. Bash langelyje paleiskite šią komandą:

sudo apt-get install vim-gtk

How to run graphical linux desktop applications from windows 10’s bash shell

Žingsnis Trys: nustatykite ekrano aplinkos kintamąjį

Dabar turite nustatyti aplinkos kablelį “DISPLAY”, kad nurodytumėte “X” serverį, kuriame veikia jūsų “Windows 10” kompiuteris.

Jei norite tai padaryti, paleiskite šią komandą Bash aplinkoje:

export DISPLAY =: 0

Ketvirtas žingsnis: paleiskite taikomąją programą

Dabar galite tiesiog paleisti grafinę programą, įvesdami jo vykdomąjį failą, pvz., Įveskite bet kurią kitą komandą. Pavyzdžiui, norėdami paleisti vim-gtk, paleiskite:

Jei norite, taip pat galite sujungti trečią ir ketvirtą žingsnius. Užuot eksportuoję “DISPLAY” kintamąjį vieną kartą visą Bash apvalkalo seansą, paleiskite grafinę programą naudodami šią komandą:

How to run graphical linux desktop applications from windows 10’s bash shell

DISPLAY =: 0 komanda

DISPLAY =: 0 gvim

How to run graphical linux desktop applications from windows 10’s bash shell

Bet kuriuo metu, kai pakeisite “Windows” registrą, bet kuris atsakingas straipsnis tikriausiai pasakys, kad pirmiausia reikia atsarginę kopiją. Bet kaip tu tai darai? Tai nėra taip paprasta, kaip galėtumėte pagalvoti. Jūs negalite tiesiog atsarginę kopiją ir atkurti registrą kaip ir bet kurį kitą failą – dauguma jo negalima keisti rankiniu būdu, o patys failai negali būti pakeisti arba kopijuoti per, bent jau neveikdamas “Windows”.

How to run graphical linux desktop applications from windows 10’s bash shell

“Emoji” jau keletą pastaruoju metu susiūtė su tekstiniu pasauliu, bet jei jūs tik dabar matote šviesą, tai kaip naudoti “Emoji” savo “iPhone”, kad nusiųstumėte savo draugams veidus veidus ir virtualius bučinius. Įjunkite emocijų klaviatūrą Pirmas dalykas, kurį reikės padaryti prieš išprotėjusį, yra “iPhone” įjungti “emoji” klaviatūrą, kuri nėra ” t įjungta pagal numatytuosius nustatymus.

How to run graphical linux desktop applications from windows 10’s bash shell

窗10的Bash shell中不正式支持Linux图形桌面应用程序。 Microsoft表示此功能仅适用于想要运行Linux终端实用程序的开发人员。 但是底层的“Windows Subsystem for Linux”比Microsoft允许的功能更强大。

可以在Windows 10中运行图形化的Linux应用程序,但请记住,它不是官方支持的。 不是每一块Linux软件都可以工作,图形应用程序甚至更复杂,测试也更少。 但随着时间的推移,这些应该变得更加稳定,因为微软改进了Linux的底层Windows子系统。

Windows 10的Bash shell仅支持64位二进制文​​件,因此您无法安装和运行32位Linux软件。

当您运行bash.exe程序时,它会在您的计算机上下载并安装一个完整的Ubuntu用户空间映像。 这包括在Ubuntu上运行的完全相同的二进制文件或应用程序。 “在Ubuntu在Windows上的Bash”环境的工作感谢的基础Windows子系统Linux。

Microsoft不想花费任何时间处理图形软件,因为此功能适用于命令行开发人员工具。 但是不支持图形应用程序的主要技术原因是它们需要一个“X服务器”来提供图形界面。 在典型的Linux桌面上,当您启动计算机时,“X服务器”会自动出现,并呈现整个桌面和您使用的应用程序。

How to run graphical linux desktop applications from windows 10’s bash shell

但是,有可以在Windows桌面上安装的X服务器应用程序。 通常,这些用于渲染在其他计算机上运行的Linux应用程序 – “X11”协议相当旧,并且设计具有通过网络连接运行的能力。

第一步:安装X服务器

还有,你可以在Windows上安装多个不同的X服务器,但我们建议的Xming 。 下载它,并将其安装在Windows 10 PC上。

How to run graphical linux desktop applications from windows 10’s bash shell

第二步:安装程序

你可以安装像你的图形化桌面Linux程序可以在任何其他程序, 使用apt-get命令在基于Ubuntu的Bash的环境。 例如,假设您想要安装基于GTK的图形化编辑器。 您将在Bash窗口中运行以下命令:

How to run graphical linux desktop applications from windows 10’s bash shell

第三步:设置显示环境变量

现在,您需要将“DISPLAY”环境变量设置为指向在Windows 10 PC上运行的X服务器。 如果不这样做,图形应用程序将无法启动。

此设置仅适用于您当前的Bash会话。 如果你关闭窗口,Bash会忘记它。 每次重新打开Bash并且想要运行图形应用程序时,都必须运行此命令。

How to run graphical linux desktop applications from windows 10’s bash shell

第四步:启动应用程序

就是这么简单。 如果应用程序在启动后崩溃,则Linux系统调用它可能不受Windows Subsystem for Linux支持。 你可以做的不多。 但是给它一个镜头,你可能会发现,你需要的应用程序工作得很好!

How to run graphical linux desktop applications from windows 10’s bash shell

如果你喜欢,你也可以结合第三和第四步。 而不是为整个Bash shell会话导出DISPLAY变量一次,您只需使用以下命令运行图形应用程序:

请记住,这不是官方支持,所以你可能会遇到与更复杂的应用程序的错误。 虚拟机是在Windows 10上运行,许多Linux的图形桌面应用程序更可靠的解决方案,但是这对于一些简单的东西,一个整洁的解决方案。

  • 发布于 2016-07-10
  • 阅读(0)
  • 评论(0)

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10的Bash shell并不正式支持图形Linux桌面应用程序。 微软表示,这个功能只针对想要运行Linux终端实用程序的开发者。 但是底层的“Windows Linux子系统”比微软的功能更强大。

可以在Windows 10中运行图形化Linux应用程序,但请记住,它不是官方支持的。 并不是每一个Linux软件都可以工作,而且图形应用程序更加复杂,测试也更少。 但随着微软改进Linux的底层Windows子系统,这些应该会随着时间的推移而变得更加稳定。

Windows 10的Bash shell仅支持64位二进制文​​件,因此无法安装和运行32位Linux软件。

这是如何工作的

Windows 10包含一个底层的“Windows Linux子系统”,允许Windows 10通过将Linux系统调用转换为Windows系统调用来运行Linux软件 。

当您运行bash.exe程序时,它会在您的计算机上下载并安装完整的Ubuntu用户空间映像。 这包括在Ubuntu上运行的完全相同的二进制文件或应用程序。 这个“Windows上的Ubuntu上的Bash”环境的工作得益于Linux的底层Windows子系统。

微软不想花时间在图形软件上工作,因为这个功能是为命令行开发者工具设计的。 但是不支持图形应用程序的主要技术原因是它们需要一个“X服务器”来提供图形界面。 在典型的Linux桌面上,启动计算机时会自动显示“X服务器”,并呈现整个桌面和您使用的应用程序。

How to run graphical linux desktop applications from windows 10’s bash shell

但是,您可以在Windows桌面上安装X服务器应用程序。 通常情况下,这些是用来渲染在其他计算机上运行的Linux应用程序 – “X11”协议是相当古老的,并被设计为具有通过网络连接运行的能力。

如果在Windows桌面上安装X服务器应用程序并更改Bash shell中的设置,则应用程序将把它们的图形输出发送到X服务器应用程序,它们将出现在Windows桌面上。 一切都应该正常工作,假设这些应用程序不依赖Linux系统调用,Windows子系统Linux不支持。

第一步:安装一个X服务器

有几种不同的X服务器可以在Windows上安装,但是我们推荐Xming 。 下载并安装在您的Windows 10电脑上。

How to run graphical linux desktop applications from windows 10’s bash shell

第二步:安装程序

您可以使用任何其他程序安装图形化Linux桌面程序,在基于Ubuntu的Bash环境中使用apt-get命令 。 例如,假设您想要安装基于GTK的图形编辑器。 您可以在Bash窗口中运行以下命令:

How to run graphical linux desktop applications from windows 10’s bash shell

第三步:设置你的显示环境变量

现在,您需要将“DISPLAY”环境变量设置为指向Windows 10 PC上运行的X服务器。 如果你不这样做,图形应用程序将无法启动。

此设置仅适用于您当前的Bash会话。 如果关闭窗口,Bash将会忘记它。 每当你重新打开Bash并想运行一个图形应用程序时,你将不得不运行这个命令。

第四步:启动一个应用程序

就这么简单。 如果应用程序在启动后崩溃,Linux系统调用它的需求可能不被Linux的Windows子系统支持。 关于这一点你可以做的不多。 但是给它一个镜头,你可能会发现你需要的应用程序工作得很好!

How to run graphical linux desktop applications from windows 10’s bash shell

如果你喜欢,你也可以结合第三和第四步。 而不是为整个Bash shell会话导出一次DISPLAY变量,只需使用以下命令运行一个图形应用程序即可:

请记住,这不是官方的支持,所以你可能会遇到更复杂的应用程序的错误。 虚拟机是在Windows 10上运行许多图形化Linux桌面应用程序的更可靠的解决方案,但是对于一些更简单的东西,这是一个很好的解决方案。

How to run graphical linux desktop applications from windows 10’s bash shell

You can use this command in the terminal directly but in this test, you’ll run this command through a shell script. Now make the file hello.sh executable by using the chmod command as follows: chmod u+x hello.sh. And finally, run your first shell script by preceding the hello.sh with your desired shell “bash”: bash hello.sh

In GUI, to open a shell prompt manually, we have to access a terminal window. A terminal window is an application that starts the default shell in the GUI environment. To start a terminal window, right-click on the Desktop and select the “Open in terminal” option from the right-click context menu.

The procedure to run the .sh file shell script on Linux is as follows: Open the Terminal application on Linux or Unix. Create a new script file with .sh extension using a text editor. Write the script file using nano script-name-here.sh. Set execute permission on your script using chmod command : chmod +x script-name-here.sh. To run your script :

Open file using Bash commands: The uses of shell commands to open a file for creating or reading are shown in this tutorial. The uses of `cat`, `less`, and `more` commands have shown here. Use of `cat` command: The `cat` is a very useful command of bash to create or display the file’s content. Any file type can be created easily and quickly by opening the file using the `cat`

If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a TCP connection to the corresponding socket. /dev/udp/host/port : If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open a UDP connection to the corresponding socket.

  • How to Create and Run Bash Shell Script [Beginner’s Guide]
  • How to access or open a Shell in Linux
  • How to run .sh file shell script (bash/ksh) in Linux
  • How to open the file in bash
  • How to Install and Use the Linux Bash Shell on Windows 10

A shell is a command line interpreter that accepts and runs commands. If you have ever run any Linux command before, then you have used the shell. When you open a terminal in Linux, you are already running the

To start a terminal window, right-click on the Desktop and select the “Open in terminal” option from the right-click context menu. Not only from the Desktop, but also you can access a shell prompt from any directory by using the

The procedure to run the .sh file shell script on Linux is as follows: Open the Terminal application on Linux or Unix. Create a new script file with .sh extension using a text editor. Write the script file using nano script-name

Open file using Bash commands: The uses of shell commands to open a file for creating or reading are shown in this tutorial. The uses of `cat`, `less`, and `more` commands have shown here. Use of `cat` command: The `cat` is a very useful

What You Need to Know About Windows 10’s Bash Shell. RELATED: Everything You Can Do With Windows 10’s New Bash Shell This isn’t a virtual machine, a container, or Linux software compiled for Windows (like

A shell is a command line interpreter that accepts and runs commands. If you have ever run any Linux command before, then you have used the shell. When you open a terminal in Linux, you are already running the

To start a terminal window, right-click on the Desktop and select the “Open in terminal” option from the right-click context menu. Not only from the Desktop, but also you can access a shell prompt from any directory by using the

The procedure to run the .sh file shell script on Linux is as follows: Open the Terminal application on Linux or Unix. Create a new script file with .sh extension using a text editor. Write the script file using nano script-name

Open file using Bash commands: The uses of shell commands to open a file for creating or reading are shown in this tutorial. The uses of `cat`, `less`, and `more` commands have shown here. Use of `cat` command: The `cat` is a very useful

What You Need to Know About Windows 10’s Bash Shell. RELATED: Everything You Can Do With Windows 10’s New Bash Shell This isn’t a virtual machine, a container, or Linux software compiled for Windows (like

How to run graphical linux desktop applications from windows 10’s bash shell

Bash shell Windows 10 tidak menyokong secara rasmi aplikasi desktop Linux. Microsoft mengatakan ciri ini direka bentuk hanya untuk pemaju yang ingin menjalankan utiliti terminal Linux. Tetapi yang mendasari “Windows Subsystem for Linux” lebih berkuasa berbanding Microsoft.

Ia mungkin untuk menjalankan aplikasi Linux graf dalam Windows 10, tetapi perlu diingat bahawa ia tidak disokong secara rasmi. Tidak semua perisian Linux berfungsi, dan aplikasi grafik lebih kompleks dan kurang diuji. Tetapi ini sepatutnya menjadi lebih stabil dari masa ke masa apabila Microsoft memperbaiki Subsistem Windows yang mendasarinya untuk Linux.

Bash shell Windows 10 hanya menyokong binari 64-bit, jadi anda tidak boleh memasang dan menjalankan perisian Linux 32-bit.

Bagaimana ini berfungsi

Pertama, mari kita lari dengan tepat bagaimana ini berfungsi supaya anda dapat memahami sedikit tentang apa yang kita lakukan di sini.

Windows 10 merangkumi “Windows Subsystem for Linux” yang membolehkan Windows 10 menjalankan perisian Linux dengan menterjemahkan panggilan sistem Linux kepada panggilan sistem Windows.

Apabila anda menjalankan pengedaran Linux seperti Ubuntu, ia memuat turun dan memasang imej ruang pengguna Ubuntu yang lengkap pada komputer anda. Ini termasuk binari-atau aplikasi-aplikasi yang sama – yang akan dijalankan di Ubuntu. Yang “Bash pada Ubuntu pada Windows” persekitaran berfungsi terima kasih kepada Windows Subsystem yang mendasarinya untuk Linux.

Microsoft tidak mahu meluangkan masa untuk menggunakan perisian grafis, kerana ciri ini bertujuan untuk alat pemaju baris arahan. Tetapi sebab teknikal utama bahawa aplikasi grafik tidak disokong adalah mereka memerlukan “pelayan X” untuk menyediakan antara muka grafis itu. Pada desktop Linux biasa, bahawa “pelayan X” muncul secara automatik apabila anda boot komputer anda dan ia menjadikan keseluruhan desktop dan aplikasi yang anda gunakan.

Tetapi cuba membuka aplikasi grafik dari Bash pada Windows, walaupun, dan ia akan mengeluh bahawa ia tidak boleh membuka paparan.

How to run graphical linux desktop applications from windows 10’s bash shell

Walau bagaimanapun, terdapat aplikasi pelayan X yang boleh dipasang pada desktop Windows. Biasanya, ini digunakan untuk menjadikan aplikasi Linux berjalan pada komputer lain-protokol “X11” agak lama dan direka bentuk dengan keupayaan yang dijalankan melalui sambungan rangkaian.

Jika anda memasang aplikasi pelayan X pada desktop Windows anda dan menukar tetapan dalam shell Bash, aplikasi akan menghantar output grafis mereka ke aplikasi pelayan X dan ia akan muncul pada desktop Windows anda. Segala-galanya perlu berfungsi dengan baik, dengan menganggap bahawa aplikasi tersebut tidak bergantung pada panggilan sistem Linux bahawa Subsistem Windows untuk Linux masih belum menyokong.

Langkah Pertama: Pasang Pelayan X

Terdapat beberapa pelayan X yang berbeza yang anda boleh pasang pada Windows, tetapi kami mencadangkan Xming. Muat turun dan pasang pada Windows 10 PC anda.

Proses pemasangan mudah: Anda hanya boleh menerima tetapan lalai. Ia kemudian akan dilancarkan secara automatik dan dijalankan dalam dulang sistem anda, menunggu anda menjalankan program grafik.

How to run graphical linux desktop applications from windows 10’s bash shell

Langkah Dua: Pasang Program

Anda boleh memasang program desktop grafis Linux seperti anda boleh menggunakan program lain, menggunakan perintah apt-get dalam persekitaran Bash berasaskan Ubuntu. Sebagai contoh, katakan anda ingin memasang editor vim yang berasaskan GTK. Anda akan menjalankan arahan berikut dalam tetingkap Bash:

How to run graphical linux desktop applications from windows 10’s bash shell

Ia akan melalui proses pemasangan dalam tetingkap baris perintah, seperti yang dilakukan pada Ubuntu.

Langkah Tiga: Tetapkan Variasi Persekitaran Paparan anda

Kini, anda perlu menetapkan pembolehubah persekitaran “DISPLAY” untuk menunjukkan pada pelayan X yang berjalan pada Windows 10 PC anda. Jika anda tidak melakukan ini, aplikasi grafik hanya akan gagal dilancarkan.

Untuk melakukan ini, jalankan arahan berikut dalam persekitaran Bash:

Tetapan ini hanya terpakai pada sesi Bash semasa anda. Jika anda menutup tetingkap, Bash akan melupakannya. Anda perlu menjalankan arahan ini setiap kali anda membuka semula Bash dan mahu menjalankan aplikasi grafik.

Langkah Empat: Pelancaran Aplikasi

Anda kini boleh melancarkan aplikasi grafis dengan menaip nama yang dapat dilaksanakan, seperti yang anda ketikkan arahan lain. Sebagai contoh, untuk melancarkan vim-gtk, anda akan menjalankan:

Itulah yang mudah. Sekiranya aplikasi tersebut mengalami kemalangan selepas dilancarkan, sistem Linux memerlukannya mungkin tidak disokong oleh Subsistem Windows untuk Linux. Tidak banyak yang boleh anda lakukan mengenai perkara ini. Tetapi berikannya tembakan, dan anda mungkin mendapati bahawa aplikasi yang anda perlukan berfungsi dengan baik dengan baik!

How to run graphical linux desktop applications from windows 10’s bash shell

Anda juga boleh menggabungkan langkah ketiga dan keempat, jika anda suka. Daripada mengeksport pembolehubah DISPLAY sekali untuk sesi shell Bash keseluruhan, anda hanya akan menjalankan aplikasi grafik dengan arahan berikut:

Sebagai contoh, untuk melancarkan gvim, anda akan menjalankan:

Ingat, ini tidak disokong secara rasmi, jadi anda mungkin menghadapi kesilapan dengan aplikasi yang lebih kompleks. Mesin maya adalah penyelesaian yang lebih dipercayai untuk menjalankan banyak aplikasi desktop Linux pada Windows 10, tetapi ini adalah penyelesaian yang kemas untuk beberapa perkara yang mudah.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10s Bash-skall støtter ikke offisielt grafiske Linux-skrivebordsprogrammer. Microsoft sier denne funksjonen er kun utviklet for utviklere som ønsker å kjøre Linux-terminalverktøy. Men det underliggende “Windows Subsystem for Linux” er kraftigere enn Microsoft lar på.

Det er mulig å kjøre grafiske Linux-programmer i Windows 10, men husk at det ikke støttes offisielt. Ikke alle Linux-programmer fungerer, og grafiske applikasjoner er enda mer komplekse og mindre testet. Men disse bør bli mer stabile over tid da Microsoft forbedrer det underliggende Windows Subsystem for Linux.

Windows 10s Bash-skjerm støtter bare 64-biters binærfiler, slik at du ikke kan installere og kjøre 32-biters Linux-programvare.

Slik fungerer dette

Først, la oss løpe nøyaktig hvordan dette virker, slik at du kan få litt forståelse for hva vi gjør her.

Windows 10 inneholder et underliggende “Windows Subsystem for Linux” som gjør at Windows 10 kan kjøre Linux-programvare ved å oversette Linux-systemanrop til Windows-systemanrop.

Når du kjører en Linux-distribusjon som Ubuntu, laster den ned og installerer et komplett Ubuntu brukerområdebilde på datamaskinen. Dette inkluderer nøyaktig samme binarier eller programmer som ville kjøre på Ubuntu. At “Bash on Ubuntu on Windows” miljø fungerer takket være det underliggende Windows Subsystem for Linux.

Microsoft ønsker ikke å bruke noen tid på å arbeide med grafisk programvare, da denne funksjonen er beregnet på kommandolinjeutviklerverktøy. Men den viktigste tekniske grunnen til at grafiske applikasjoner ikke støttes, er at de krever en “X-server” for å gi det grafiske grensesnittet. På et typisk Linux-skrivebord vises den “X-serveren” automatisk når du starter datamaskinen, og det gjør hele skrivebordet og programmene du bruker.

Men prøv å åpne en grafisk applikasjon fra Bash på Windows, og det vil klage på at den ikke kan åpne en skjerm.

How to run graphical linux desktop applications from windows 10’s bash shell

Det finnes imidlertid X-serverprogrammer du kan installere på et Windows-skrivebord, men. Vanligvis brukes disse til å gjengi Linux-applikasjoner som kjører på andre datamaskiner. “X11” -protokollen er ganske gammel og ble designet med evnen til å kjøre over en nettverkstilkobling.

Hvis du installerer et X-serverprogram på Windows-skrivebordet og endrer en innstilling i Bash-skallet, sender programmene deres grafiske utdata til X-serverprogrammet, og de vises på Windows-skrivebordet. Alt skal fungere bra, forutsatt at disse programmene ikke er avhengige av Linux-systemanrop at Windows Subsystem for Linux ennå ikke støtter.

Trinn ett: Installer en X Server

Det finnes flere forskjellige X-servere du kan installere på Windows, men vi anbefaler Xming. Last ned den og installer den på din Windows 10-PC.

Installasjonsprosessen er enkel: Du kan bare godta standardinnstillingene. Den starter automatisk og kjøres i systemstatusfeltet, og venter på at du skal kjøre grafiske programmer.

How to run graphical linux desktop applications from windows 10’s bash shell

Trinn to: Installer programmet

Du kan installere grafiske Linux-skrivebordsprogrammer som du kan hvilket som helst annet program, ved hjelp av apt-get-kommandoen i det Ubuntu-baserte Bash-miljøet. For eksempel, la oss si at du vil installere den grafiske, GTK-baserte vim-editoren. Du vil kjøre følgende kommando i Bash-vinduet:

How to run graphical linux desktop applications from windows 10’s bash shell

Det vil gå gjennom installasjonsprosessen i kommandolinjevinduet, akkurat som det gjør på Ubuntu.

Trinn tre: Still inn visningsmiljøet ditt Variabelt

Nå må du sette miljøvariabelen “DISPLAY” for å peke på X-serveren som kjører på din Windows 10-PC. Hvis du ikke gjør dette, vil grafiske applikasjoner ganske enkelt ikke starte.

For å gjøre dette, kjør følgende kommando i Bash-miljøet:

Denne innstillingen gjelder bare for din nåværende Bash-økt. Hvis du lukker vinduet, vil Bash glemme det. Du må løpe denne kommandoen hver gang du åpner Bash igjen og vil kjøre et grafisk program.

Trinn fire: Start et program

Du kan nå bare starte en grafisk applikasjon ved å skrive navnet på det kjørbare, som om du vil skrive en hvilken som helst annen kommando. For eksempel, for å starte vim-gtk, kjører du:

Det er så enkelt. Hvis programmet krasjer etter lansering, kan Linux-systemanropene det krever kanskje ikke støttes av Windows Subsystem for Linux. Det er ikke mye du kan gjøre med dette. Men gi det et skudd, og du kan oppleve at appene du trenger, fungerer ordentlig bra!

How to run graphical linux desktop applications from windows 10’s bash shell

Du kan også kombinere det tredje og fjerde trinnet, hvis du vil. I stedet for å eksportere DISPLAY-variabelen en gang for en hel Bash-shell-sesjon, ville du bare kjøre et grafisk program med følgende kommando:

For eksempel, for å starte gvim, kjører du:

Husk at dette ikke støttes offisielt, så det kan føre til feil med mer komplekse applikasjoner. En virtuell maskin er en mer pålitelig løsning for å kjøre mange grafiske Linux-skrivebordsprogrammer på Windows 10, men dette er en fin løsning for noen av de enklere tingene.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10s Bash-skall støtter ikke offisielt grafiske Linux-skrivebordsprogrammer. Microsoft sier denne funksjonen er kun utviklet for utviklere som ønsker å kjøre Linux-terminalverktøy. Men det underliggende “Windows Subsystem for Linux” er kraftigere enn Microsoft lar på.

Det er mulig å kjøre grafiske Linux-programmer i Windows 10, men husk at det ikke støttes offisielt. Ikke alle Linux-programmer fungerer, og grafiske applikasjoner er enda mer komplekse og mindre testet. Men disse bør bli mer stabile over tid da Microsoft forbedrer det underliggende Windows Subsystem for Linux.

Windows 10s Bash-skjerm støtter bare 64-biters binærfiler, slik at du ikke kan installere og kjøre 32-biters Linux-programvare.

Slik fungerer dette

Først, la oss løpe nøyaktig hvordan dette virker, slik at du kan få litt forståelse for hva vi gjør her.

Windows 10 inneholder et underliggende “Windows Subsystem for Linux” som gjør at Windows 10 kan kjøre Linux-programvare ved å oversette Linux-systemanrop til Windows-systemanrop.

Når du kjører en Linux-distribusjon som Ubuntu, laster den ned og installerer et komplett Ubuntu brukerområdebilde på datamaskinen. Dette inkluderer nøyaktig samme binarier eller programmer som ville kjøre på Ubuntu. At “Bash on Ubuntu on Windows” miljø fungerer takket være det underliggende Windows Subsystem for Linux.

Microsoft ønsker ikke å bruke noen tid på å arbeide med grafisk programvare, da denne funksjonen er beregnet på kommandolinjeutviklerverktøy. Men den viktigste tekniske grunnen til at grafiske applikasjoner ikke støttes, er at de krever en “X-server” for å gi det grafiske grensesnittet. På et typisk Linux-skrivebord vises den “X-serveren” automatisk når du starter datamaskinen, og det gjør hele skrivebordet og programmene du bruker.

Men prøv å åpne en grafisk applikasjon fra Bash på Windows, og det vil klage på at den ikke kan åpne en skjerm.

How to run graphical linux desktop applications from windows 10’s bash shell

Det finnes imidlertid X-serverprogrammer du kan installere på et Windows-skrivebord, men. Vanligvis brukes disse til å gjengi Linux-applikasjoner som kjører på andre datamaskiner. “X11” -protokollen er ganske gammel og ble designet med evnen til å kjøre over en nettverkstilkobling.

Hvis du installerer et X-serverprogram på Windows-skrivebordet og endrer en innstilling i Bash-skallet, sender programmene deres grafiske utdata til X-serverprogrammet, og de vises på Windows-skrivebordet. Alt skal fungere bra, forutsatt at disse programmene ikke er avhengige av Linux-systemanrop at Windows Subsystem for Linux ennå ikke støtter.

Trinn ett: Installer en X Server

Det finnes flere forskjellige X-servere du kan installere på Windows, men vi anbefaler Xming. Last ned den og installer den på din Windows 10-PC.

Installasjonsprosessen er enkel: Du kan bare godta standardinnstillingene. Den starter automatisk og kjøres i systemstatusfeltet, og venter på at du skal kjøre grafiske programmer.

How to run graphical linux desktop applications from windows 10’s bash shell

Trinn to: Installer programmet

Du kan installere grafiske Linux-skrivebordsprogrammer som du kan hvilket som helst annet program, ved hjelp av apt-get-kommandoen i det Ubuntu-baserte Bash-miljøet. For eksempel, la oss si at du vil installere den grafiske, GTK-baserte vim-editoren. Du vil kjøre følgende kommando i Bash-vinduet:

How to run graphical linux desktop applications from windows 10’s bash shell

Det vil gå gjennom installasjonsprosessen i kommandolinjevinduet, akkurat som det gjør på Ubuntu.

Trinn tre: Still inn visningsmiljøet ditt Variabelt

Nå må du sette miljøvariabelen “DISPLAY” for å peke på X-serveren som kjører på din Windows 10-PC. Hvis du ikke gjør dette, vil grafiske applikasjoner ganske enkelt ikke starte.

For å gjøre dette, kjør følgende kommando i Bash-miljøet:

Denne innstillingen gjelder bare for din nåværende Bash-økt. Hvis du lukker vinduet, vil Bash glemme det. Du må løpe denne kommandoen hver gang du åpner Bash igjen og vil kjøre et grafisk program.

Trinn fire: Start et program

Du kan nå bare starte en grafisk applikasjon ved å skrive navnet på det kjørbare, som om du vil skrive en hvilken som helst annen kommando. For eksempel, for å starte vim-gtk, kjører du:

Det er så enkelt. Hvis programmet krasjer etter lansering, kan Linux-systemanropene det krever kanskje ikke støttes av Windows Subsystem for Linux. Det er ikke mye du kan gjøre med dette. Men gi det et skudd, og du kan oppleve at appene du trenger, fungerer ordentlig bra!

How to run graphical linux desktop applications from windows 10’s bash shell

Du kan også kombinere det tredje og fjerde trinnet, hvis du vil. I stedet for å eksportere DISPLAY-variabelen en gang for en hel Bash-shell-sesjon, ville du bare kjøre et grafisk program med følgende kommando:

For eksempel, for å starte gvim, kjører du:

Husk at dette ikke støttes offisielt, så det kan føre til feil med mer komplekse applikasjoner. En virtuell maskin er en mer pålitelig løsning for å kjøre mange grafiske Linux-skrivebordsprogrammer på Windows 10, men dette er en fin løsning for noen av de enklere tingene.

Can PowerShell run Linux commands?

With PowerShell and WSL, we can integrate Linux commands into Windows just as if they were native applications.

How do I run a Linux command in Windows?

If you are just looking to practice Linux to pass your exams, you can use one of these methods for running Bash commands on Windows.

  1. Use Linux Bash Shell on Windows 10. …
  2. Use Git Bash to run Bash commands on Windows. …
  3. Using Linux commands in Windows with Cygwin. …
  4. Use Linux in virtual machine.

How do I run a command in Windows PowerShell?

How can I easily execute a PowerShell script?

  1. Browse to the location you stored the ps1-file in File Explorer and choose; File-> Open Windows PowerShell.
  2. Type (part of) the name of the script.
  3. Press TAB to autocomplete then name. Note: Do this even when you typed the name in full. …
  4. Press ENTER to execute the script.

How do I run a Linux command?

Steps to write and execute a script

  1. Open the terminal. Go to the directory where you want to create your script.
  2. Create a file with . sh extension.
  3. Write the script in the file using an editor.
  4. Make the script executable with command chmod +x .
  5. Run the script using ./ .

What are the PowerShell commands?

Basic PowerShell Cmdlets

  • Get-Command. Get-Command is an easy-to-use reference cmdlet that brings up all the commands available for use in your current session. …
  • Get-Help. …
  • Set-ExecutionPolicy. …
  • Get-Service. …
  • ConvertTo-HTML. …
  • Get-EventLog. …
  • Get-Process. …
  • Clear-History.

Can you run bash in PowerShell?

With the arrival of Windows 10’s Bash shell, you can now create and run Bash shell scripts on Windows 10. You can also incorporate Bash commands into a Windows batch file or PowerShell script. Even if you know what you’re doing, this isn’t necessarily as simple as it seems.

Can I run Linux on Windows?

Starting with the recently released Windows 10 2004 Build 19041 or higher, you can run real Linux distributions, such as Debian, SUSE Linux Enterprise Server (SLES) 15 SP1, and Ubuntu 20.04 LTS. With any of these, you can run Linux and Windows GUI applications simultaneously on the same desktop screen.

How do I get Linux command on Windows 10?

  1. Navigate to Settings. …
  2. Click Update & security.
  3. Select For Developers in the left column.
  4. Navigate to the Control Panel (the old Windows control panel). …
  5. Select Programs and Features. …
  6. Click “Turn Windows features on or off.”
  7. Toggle “Windows Subsystem for Linux” to on and click Ok.
  8. Click the Restart Now button.

How do I get Linux on Windows 10?

To install a distribution of Linux on Windows 10, use these steps:

  1. Open Microsoft Store.
  2. Search for the Linux distribution that you want to install. …
  3. Select the distro of Linux to install on your device. …
  4. Click the Get (or Install) button. …
  5. Click the Launch button.
  6. Create a username for the Linux distro and press Enter.

How do you invoke a command?

To run a command in a disconnected session, use the InDisconnectedSession parameter. To run a command in a background job, use the AsJob parameter. You can also use Invoke-Command on a local computer to a script block as a command. PowerShell runs the script block immediately in a child scope of the current scope.

How do I run a script from the command line in Windows?

How-to: Create and Run a CMD batch file

  1. From the start menu: START > RUN c:path_to_scriptsmy_script.cmd, OK.
  2. “c:path to scriptsmy script.cmd”
  3. Open a new CMD prompt by choosing START > RUN cmd, OK.
  4. From the command line, enter the name of the script and press return.

How do I write a PowerShell script?

To save and name a script

  1. On the File menu, click Save As. The Save As dialog box will appear.
  2. In the File name box, enter a name for the file.
  3. In the Save as type box, select a file type. For example, in the Save as type box, select ‘PowerShell Scripts ( *. ps1 )’.
  4. Click Save.

Can I practice Linux commands online?

Say hello to Webminal, a free online learning platform that allows you to learn about Linux, practice, play with Linux and interact with other Linux users. Just open your web browser, create a free account and start practicing! It’s that simple. You don’t have to install any additional applications.

How do I write a script in Linux?

How to Write Shell Script in Linux/Unix

  1. Create a file using a vi editor(or any other editor). Name script file with extension . sh.
  2. Start the script with #! /bin/sh.
  3. Write some code.
  4. Save the script file as filename.sh.
  5. For executing the script type bash filename.sh.

What are the basic command in Linux?

Basic Linux Commands

  • Listing directory contents ( ls command)
  • Displaying file contents ( cat command)
  • Creating files ( touch command)
  • Creating directories ( mkdir command)
  • Creating symbolic links ( ln command)
  • Removing files and directories ( rm command)
  • Copying files and directories ( cp command)

Can I run Linux on Windows?

Starting with the recently released Windows 10 2004 Build 19041 or higher, you can run real Linux distributions, such as Debian, SUSE Linux Enterprise Server (SLES) 15 SP1, and Ubuntu 20.04 LTS. With any of these, you can run Linux and Windows GUI applications simultaneously on the same desktop screen.

How do I run a Linux command in Windows?

If you are just looking to practice Linux to pass your exams, you can use one of these methods for running Bash commands on Windows.

  1. Use Linux Bash Shell on Windows 10. …
  2. Use Git Bash to run Bash commands on Windows. …
  3. Using Linux commands in Windows with Cygwin. …
  4. Use Linux in virtual machine.

How do I run a Linux command in Windows 10?

How to Enable the Linux Bash Shell in Windows 10

  1. Navigate to Settings. …
  2. Click Update & security.
  3. Select For Developers in the left column.
  4. Select Developer Mode under “Use developer features” if it’s not already enabled.
  5. Navigate to the Control Panel (the old Windows control panel). …
  6. Select Programs and Features. …
  7. Click “Turn Windows features on or off.”

How do I run Linux on my PC?

Choose a boot option

  1. Step one: Download a Linux OS. (I recommend doing this, and all subsequent steps, on your current PC, not the destination system. …
  2. Step two: Create a bootable CD/DVD or USB flash drive.
  3. Step three: Boot that media on the destination system, then make a few decisions regarding the installation.

Is Windows 10 better than Linux?

Linux has good performance. It is much quicker, fast and smooth even on the older hardware’s. Windows 10 is slow compared to Linux because of running batches at the back end, requiring good hardware to run. Linux updates are easily available and can be updated/modified quickly.

Does Windows 10 have Linux?

Microsoft today announced Windows Subsystem for Linux version 2—that’s WSL 2. It will feature “dramatic file system performance increases” and support for Docker. To make all this possible, Windows 10 will have a Linux kernel.

How do I run a Linux command?

Launch a terminal from your desktop’s application menu and you will see the bash shell. There are other shells, but most Linux distributions use bash by default. Press Enter after typing a command to run it. Note that you don’t need to add an .exe or anything like that – programs don’t have file extensions on Linux.

Can I practice Linux commands online?

Say hello to Webminal, a free online learning platform that allows you to learn about Linux, practice, play with Linux and interact with other Linux users. Just open your web browser, create a free account and start practicing! It’s that simple. You don’t have to install any additional applications.

Can I run bash script on Windows?

With the arrival of Windows 10’s Bash shell, you can now create and run Bash shell scripts on Windows 10. You can also incorporate Bash commands into a Windows batch file or PowerShell script. Even if you know what you’re doing, this isn’t necessarily as simple as it seems.

How do I run a shell script in Windows 10?

Execute Shell Script Files

  1. Open Command Prompt and navigate to the folder where the script file is available.
  2. Type Bash script-filename.sh and hit the enter key.
  3. It will execute the script, and depending on the file, you should see an output.

Can you run Linux on any computer?

Most computers can run Linux, but some are much easier than others. Certain hardware manufacturers (whether it’s Wi-Fi cards, video cards, or other buttons on your laptop) are more Linux-friendly than others, which means installing drivers and getting things to work will be less of a hassle.

Which Linux OS is best?

10 Most Stable Linux Distros In 2021

  • 2| Debian. Suitable for: Beginners. …
  • 3| Fedora. Suitable for: Software Developers, Students. …
  • 4| Linux Mint. Suitable for: Professionals, Developers, Students. …
  • 5| Manjaro. Suitable for: Beginners. …
  • 6| openSUSE. Suitable for: Beginners and advanced users. …
  • 8| Tails. Suitable for: Security and privacy. …
  • 9| Ubuntu. …
  • 10| Zorin OS.

Does my computer have Linux?

Open a terminal program (get to a command prompt) and type uname -a. This will give you your kernel version, but might not mention the distribution your running. To find out what distribution of linux your running (Ex. Ubuntu) try lsb_release -a or cat /etc/*release or cat /etc/issue* or cat /proc/version.

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10s Bash shell understøtter ikke officielt grafiske Linux desktop applikationer. Microsoft siger, at denne funktion kun er udviklet til udviklere, der ønsker at køre Linux-terminalværktøjer. Men det underliggende “Windows Subsystem for Linux” er mere kraftfuldt end Microsoft lader på.

Det er muligt at køre grafiske Linux-applikationer i Windows 10, men husk på, at det ikke er officielt understøttet. Ikke alle Linux-programmer fungerer, og grafiske applikationer er endnu mere komplekse og mindre testede. Men disse bør blive mere stabile over tid, da Microsoft forbedrer det underliggende Windows-subsystem til Linux.

Windows 10s Bash shell understøtter kun 64-bit binarier, så du kan ikke installere og køre 32-bit Linux-software.

Sådan virker dette

Lad os først køre nøjagtigt, hvordan det virker, så du kan få en vis forståelse for, hvad vi laver her.

Windows 10 indeholder et underliggende “Windows-subsystem til Linux”, der gør det muligt for Windows 10 at køre Linux-software ved at oversætte Linux-systemopkald til Windows-systemopkald.

Når du kører en Linux-distribution som Ubuntu, downloader og installerer du et komplet Ubuntu brugerrumsbillede på din computer. Dette omfatter de nøjagtige samme binære filer eller programmer, der ville køre på Ubuntu. At “Bash on Ubuntu on Windows” miljø fungerer takket være det underliggende Windows-subsystem til Linux.

Microsoft vil ikke bruge nogen tid på at arbejde med grafisk software, da denne funktion er beregnet til kommandolinjeudviklerværktøjer. Men den vigtigste tekniske årsag til, at grafiske applikationer ikke understøttes, er, at de kræver en “X-server” for at tilvejebringe den grafiske grænseflade. På et typisk Linux-skrivebord vises den “X-server” automatisk, når du starter din computer, og det gør hele skrivebordet og de programmer, du bruger.

Men prøv at åbne en grafisk applikation fra Bash on Windows, og det vil klage over, at det ikke kan åbne en skærm.

How to run graphical linux desktop applications from windows 10’s bash shell

Der er dog X-serverprogrammer, som du kan installere på et Windows-skrivebord, dog. Typisk bruges disse til at gøre Linux-applikationer kørende på andre computere. Protokollen “X11” er ret gammel og blev designet med evnen til at køre over en netværksforbindelse.

Hvis du installerer et X-serverprogram på dit Windows-skrivebord og ændrer en indstilling i Bash-skalen, sender programmer deres grafiske output til X-serverprogrammet, og de vises på dit Windows-skrivebord. Alt skal fungere fint, forudsat at disse applikationer ikke afhænger af Linux-systemopkald, at Windows-subsystemet til Linux endnu ikke understøtter.

Trin 1: Installer en X-server

Der er flere forskellige X-servere, du kan installere på Windows, men vi anbefaler Xming. Hent det og installer det på din Windows 10-pc.

Installationsprocessen er enkel: Du kan bare acceptere standardindstillingerne. Den starter automatisk og kører i systembakken, og venter på, at du kører grafiske programmer.

How to run graphical linux desktop applications from windows 10’s bash shell

Trin to: Installer programmet

Du kan installere grafiske Linux desktop-programmer som du kan andre programmer, ved hjælp af apt-get-kommandoen i det Ubuntu-baserede Bash-miljø. Lad os f.eks. Sige, at du vil installere den grafiske, GTK-baserede vim-editor. Du vil køre følgende kommando i Bash-vinduet:

How to run graphical linux desktop applications from windows 10’s bash shell

Det vil gå gennem installationsprocessen i kommandolinjevinduet, ligesom det gør på Ubuntu.

Trin tre: Indstil din skærmmiljø variabel

Nu skal du indstille miljøvariablen “DISPLAY” til at pege på X-serveren, der kører på din Windows 10-pc. Hvis du ikke gør det, vil grafiske applikationer simpelthen ikke blive lanceret.

For at gøre dette skal du køre følgende kommando i Bash-miljøet:

Denne indstilling gælder kun for din nuværende Bash-session. Hvis du lukker vinduet, vil Bash glemme det. Du bliver nødt til at køre denne kommando hver gang du genåbner Bash og vil køre en grafisk applikation.

Trin fire: Start et program

Du kan nu bare starte en grafisk applikation ved at skrive navnet på dens eksekverbare, ligesom du ville skrive en hvilken som helst anden kommando. Hvis du for eksempel vil starte vim-gtk, kører du:

Det er så simpelt. Hvis applikationen går i stykker efter lanceringen, kan de Linux-systemopkald, der kræves muligvis ikke understøttes af Windows-subsystemet til Linux. Der er ikke meget du kan gøre ved dette. Men giv det et skud, og du kan opleve, at de apps du har brug for, virker ordentligt godt!

How to run graphical linux desktop applications from windows 10’s bash shell

Du kan også kombinere det tredje og fjerde trin, hvis du vil. I stedet for at eksportere DISPLAY-variablen en gang til en hel Bash shell-session, ville du bare køre en grafisk applikation med følgende kommando:

For eksempel, for at starte gvim, ville du køre:

Husk, dette understøttes ikke officielt, så du kan komme ind i fejl med mere komplekse applikationer. En virtuel maskine er en mere pålidelig løsning til at køre mange grafiske Linux desktop applikationer på Windows 10, men det er en pæn løsning til nogle af de enklere ting.

  • 블로그
  • 어떻게
  • 전화

How to run graphical linux desktop applications from windows 10’s bash shell

How to run graphical linux desktop applications from windows 10’s bash shell

How to run graphical linux desktop applications from windows 10’s bash shell

  • 메인 
  • 블로그 
  • Windows 10의 Bash 셸에서 그래픽 Linux 데스크톱 응용 프로그램을 실행하는 방법

How to run graphical linux desktop applications from windows 10’s bash shell

Windows 10의 Bash 셸은 공식적으로 그래픽 Linux 데스크톱 응용 프로그램을 지원하지 않습니다. Microsoft는이 기능이 Linux 터미널 유틸리티를 실행하려는 개발자를 위해 설계된 것이라고 말합니다. 그러나 기본적인 “리눅스 용 윈도우 서브 시스템”은 마이크로 소프트보다 더 강력합니다.

Windows 10에서 그래픽 Linux 응용 프로그램을 실행할 수는 있지만 공식적으로 지원되지는 않습니다. 모든 Linux 소프트웨어가 작동하는 것은 아니며 그래픽 응용 프로그램은 훨씬 더 복잡하고 테스트도 덜합니다. 그러나 Microsoft가 Linux 용 기본 Windows 하위 시스템을 향상 시킴에 따라 이러한 변경 사항은 시간이 지남에 따라 더욱 안정화되어야합니다.

Windows 10의 Bash 쉘은 64 비트 바이너리 만 지원하므로 32 비트 Linux 소프트웨어를 설치하고 실행할 수 없습니다.

이 작동 원리

먼저, 이것이 작동하는 방식을 정확히 실행하여 우리가 여기서 무엇을하는지 이해할 수 있도록하십시오.

Windows 10은 Windows 10이 Linux 시스템 호출을 Windows 시스템 호출로 변환하여 Linux 소프트웨어를 실행할 수 있도록하는 “Linux 용 Windows 서브 시스템”을 포함합니다.

Ubuntu와 같은 Linux 배포판을 실행하면 컴퓨터에 완전한 Ubuntu 사용자 공간 이미지를 다운로드하고 설치합니다. 여기에는 Ubuntu에서 실행되는 동일한 바이너리 또는 응용 프로그램이 포함됩니다. Windows 용 Ubuntu on Bash 환경은 Linux 용 기본 Windows 서브 시스템 덕분으로 작동합니다.

Microsoft는 그래픽 소프트웨어로 작업하는 데 시간을 허비하지 않습니다.이 기능은 명령 줄 개발자 도구 용입니다. 그러나 그래픽 응용 프로그램이 지원되지 않는 주요 기술적 이유는 그래픽 인터페이스를 제공하기 위해 “X 서버”가 필요하다는 것입니다. 일반적인 Linux 데스크톱에서는 컴퓨터를 부팅 할 때 “X 서버”가 자동으로 나타나며 전체 데스크톱과 사용하는 응용 프로그램을 렌더링합니다.

그러나 Windows의 Bash에서 그래픽 응용 프로그램을 열어보십시오. 그러면 디스플레이를 열 수 없다는 불평이있을 것입니다.

How to run graphical linux desktop applications from windows 10’s bash shell

그러나 Windows 데스크톱에 설치할 수있는 X 서버 응용 프로그램이 있습니다. 일반적으로 이들은 다른 컴퓨터에서 실행되는 Linux 응용 프로그램을 렌더링하는 데 사용됩니다. “X11″프로토콜은 다소 오래되었고 네트워크 연결을 통해 실행되는 기능으로 설계되었습니다.

Windows 바탕 화면에 X 서버 응용 프로그램을 설치하고 Bash 셸에서 설정을 변경하면 응용 프로그램은 그래픽 출력을 X 서버 응용 프로그램에 보내고 Windows 바탕 화면에 나타납니다. 이러한 응용 프로그램이 Linux 용 Windows 서브 시스템이 아직 지원하지 않는 Linux 시스템 호출에 의존하지 않는다고 가정 할 때 모든 것이 잘 작동합니다.

1 단계 : X 서버 설치

Windows에 설치할 수있는 여러 가지 X 서버가 있지만 Xming을 사용하는 것이 좋습니다. 다운로드하여 Windows 10 PC에 설치하십시오.

설치 과정은 간단합니다. 기본 설정 만 적용하면됩니다. 그러면 시스템 트레이에서 자동으로 시작되고 실행되어 그래픽 프로그램을 실행하기를 기다립니다.

How to run graphical linux desktop applications from windows 10’s bash shell

2 단계 : 프로그램 설치

Ubuntu 기반 Bash 환경에서 apt-get 명령을 사용하여 다른 프로그램처럼 그래픽 Linux 데스크탑 프로그램을 설치할 수 있습니다. 예를 들어 그래픽 GTK 기반 vim 편집기를 설치한다고 가정 해 봅시다. Bash 창에서 다음 명령을 실행합니다.

sudo apt-get install vim-gtk

How to run graphical linux desktop applications from windows 10’s bash shell

우분투에서와 마찬가지로 커맨드 라인 윈도우에서 설치 과정을 거칩니다.

3 단계 : 디스플레이 환경 변수 설정

이제 Windows 10 PC에서 실행중인 X 서버를 가리 키도록 “DISPLAY”환경 변수를 설정해야합니다. 이렇게하지 않으면 그래픽 응용 프로그램이 시작되지 않습니다.

이를 수행하려면 Bash 환경에서 다음 명령을 실행하십시오.

이 설정은 현재 Bash 세션에만 적용됩니다. 창을 닫으면 배쉬는 그것을 잊어 버릴 것이다. Bash를 다시 열 때마다이 명령을 실행해야하며 그래픽 응용 프로그램을 실행하려고합니다.

4 단계 : 응용 프로그램 시작

이제 다른 명령을 입력하는 것처럼 실행 파일의 이름을 입력하여 그래픽 응용 프로그램을 시작할 수 있습니다. 예를 들어 vim-gtk를 실행하려면 다음을 실행하십시오.

그것은 간단합니다. 실행 후 응용 프로그램이 충돌하는 경우 Linux 시스템은 Linux 용 Windows 서브 시스템에서 지원하지 않을 수도 있다고 요구합니다. 당신이 이것에 대해 할 수있는 일이별로 없습니다. 그러나 한 번 시도해보십시오. 필요한 앱이 잘 작동하는 것을 알 수 있습니다.

How to run graphical linux desktop applications from windows 10’s bash shell

원하는 경우 세 번째와 네 번째 단계를 결합 할 수도 있습니다. 배시 쉘 세션 전체에 대해 DISPLAY 변수를 한 번 내보내는 대신 다음 명령을 사용하여 그래픽 응용 프로그램을 실행하기 만하면됩니다.

예를 들어 gvim을 실행하려면 다음을 실행하십시오.

이것은 공식적으로 지원되지 않으므로보다 복잡한 응용 프로그램에서 오류가 발생할 수 있음을 기억하십시오. 가상 컴퓨터는 Windows 10에서 많은 그래픽 Linux 데스크톱 응용 프로그램을 실행하기위한보다 안정적인 솔루션이지만이 방법은 단순한 몇 가지 사항에 대한 깔끔한 솔루션입니다.

Índice de contenidos

Does Windows have a Unix shell?

One of the really cool things about Windows 10 is that Microsoft has baked a full-blown Ubuntu-based Bash shell into the operating system. For those who might not be familiar with Bash, it is a text-based Linux command line environment.

How do I get Unix on Windows?

Installing and Using a Linux/UNIX emulator

  1. Download the Cygwin setup installer, setup.exe.
  2. Run the installer (see the Cygwin/X User’s Guide for detailed documentation on the installation process)
  3. Proceed using installation defaults.

How do you run a Unix shell in Windows?

Execute Shell Script Files

  1. Open Command Prompt and navigate to the folder where the script file is available.
  2. Type Bash script-filename.sh and hit the enter key.
  3. It will execute the script, and depending on the file, you should see an output.

How do I install Unix on Windows 10?

How to Install Linux from USB

  1. Insert a bootable Linux USB drive.
  2. Click the start menu. …
  3. Then hold down the SHIFT key while clicking Restart. …
  4. Then select Use a Device.
  5. Find your device in the list. …
  6. Your computer will now boot Linux. …
  7. Select Install Linux. …
  8. Go through the installation process.

How use Linux on Windows?

Virtual machines allow you to run any operating system in a window on your desktop. You can install the free VirtualBox or VMware Player, download an ISO file for a Linux distribution such as Ubuntu, and install that Linux distribution inside the virtual machine like you would install it on a standard computer.

How do I enable Linux on Windows?

Begin typing “Turn Windows features on and off” into the Start Menu search field, then select the control panel when it appears. Scroll down to Windows Subsystem for Linux, check the box, and then click the OK button. Wait for your changes to be applied, then click the Restart now button to restart your computer.

How do I start Unix?

To open an UNIX terminal window, click on the “Terminal” icon from Applications/Accessories menus. An UNIX Terminal window will then appear with a % prompt, waiting for you to start entering commands.

What are the steps to install Unix operating system?

  1. Step 1: Before You Install. …
  2. Step 2: Log In to the System. …
  3. Step 3: Insert Product CD or Download Product Files. …
  4. Step 4: Create the Installation Directory. …
  5. Step 5: Put the License File in the Installation.
  6. Step 6: Start the Installer. …
  7. Step 7: Review the License Agreement. …
  8. Step 8: Verify the Installation Directory Name.

Why is Windows Not Unix based?

Microsoft’s DOS became the most successful DOS of them all. DOS was never based on Unix at all, which is why Windows uses a backslash for file paths while everything else uses a forward slash. … Unlike most other operating systems, Windows NT wasn’t developed as a Unix-like operating system.

Can we run shell script in Windows?

With the arrival of Windows 10’s Bash shell, you can now create and run Bash shell scripts on Windows 10. You can also incorporate Bash commands into a Windows batch file or PowerShell script.

Can you run bash on Windows?

Bash on Windows provides a Windows subsystem and Ubuntu Linux runs atop it. It is not a virtual machine or an application like Cygwin. It is complete Linux system inside Windows 10. Basically, it allows you to run the same Bash shell that you find on Linux.

What is shell command?

A shell is a computer program that presents a command line interface which allows you to control your computer using commands entered with a keyboard instead of controlling graphical user interfaces (GUIs) with a mouse/keyboard combination. … The shell makes your work less error-prone.

Can you run Windows 10 and Linux on the same computer?

You can have it both ways, but there are a few tricks for doing it right. Windows 10 isn’t the only (kind of) free operating system you can install on your computer. … Installing a Linux distribution alongside Windows as a “dual boot” system will give you a choice of either operating system each time you start your PC.

Can you run Linux and Windows on the same computer?

Having more than one operating system installed allows you to quickly switch between two and have the best tool for the job. … For example, you could have both Linux and Windows installed, using Linux for development work and booting into Windows when you need to use Windows-only software or play a PC game.

Is Windows 10 better than Linux?

Linux has good performance. It is much quicker, fast and smooth even on the older hardware’s. Windows 10 is slow compared to Linux because of running batches at the back end, requiring good hardware to run. Linux updates are easily available and can be updated/modified quickly.

How to run graphical linux desktop applications from windows 10’s bash shell

Bash shell ของ Windows 10 ไม่สนับสนุนการใช้งานเดสก์ท็อป Linux แบบกราฟิกอย่างเป็นทางการ Microsoft กล่าวว่าคุณลักษณะนี้ได้รับการออกแบบมาเฉพาะสำหรับนักพัฒนาที่ต้องการรันยูทิลิตี้เทอร์มินัลของ Linux แต่พื้นฐาน“ Windows Subsystem สำหรับ Linux” นั้นทรงพลังกว่าที่ Microsoft ยอมให้.

เป็นไปได้ที่จะรันแอพพลิเคชั่น Linux กราฟิกใน Windows 10 แต่จำไว้ว่ามันไม่ได้รับการสนับสนุนอย่างเป็นทางการ ไม่ใช่ว่าทุกชิ้นส่วนของซอฟต์แวร์ Linux จะใช้งานได้และแอพพลิเคชั่นแบบกราฟิกนั้นมีความซับซ้อนมากกว่าและมีการทดสอบน้อยกว่า แต่สิ่งเหล่านี้จะมีเสถียรภาพมากขึ้นเมื่อเวลาผ่านไปเนื่องจาก Microsoft ปรับปรุงระบบย่อย Windows พื้นฐานสำหรับ Linux.

Bash shell ของ Windows 10 รองรับเฉพาะไบนารี 64 บิตดังนั้นคุณจึงไม่สามารถติดตั้งและรันซอฟต์แวร์ Linux 32 บิตได้.

วิธีนี้ใช้ได้ผล

Windows 10 มี“ ระบบย่อย Windows สำหรับ Linux” ที่ทำให้ Windows 10 สามารถเรียกใช้ซอฟต์แวร์ Linux ได้โดยการแปลการเรียกระบบ Linux ไปที่การเรียกระบบ Windows.

เมื่อคุณรันการแจกจ่าย Linux เช่น Ubuntu มันจะดาวน์โหลดและติดตั้งอิมเมจพื้นที่ผู้ใช้ Ubuntu ที่สมบูรณ์บนคอมพิวเตอร์ของคุณ ซึ่งรวมถึงไบนารีหรือแอปพลิเคชันเดียวกันที่แน่นอนที่จะทำงานบน Ubuntu สภาพแวดล้อม“ Bash บน Ubuntu บน Windows” นั้นทำงานได้ด้วยระบบย่อย Windows สำหรับ Linux.

Microsoft ไม่ต้องการใช้เวลาในการทำงานกับซอฟต์แวร์กราฟิกเนื่องจากคุณสมบัตินี้มีไว้สำหรับเครื่องมือนักพัฒนาซอฟต์แวร์บรรทัดคำสั่ง แต่เหตุผลทางเทคนิคหลักที่แอปพลิเคชันกราฟิกไม่ได้รับการสนับสนุนคือต้องการแอพพลิเคชั่น“ เซิร์ฟเวอร์ X” เพื่อให้อินเทอร์เฟซแบบกราฟิกนั้น บนเดสก์ท็อป Linux ทั่วไปนั้น“ เซิร์ฟเวอร์ X” จะปรากฏขึ้นโดยอัตโนมัติเมื่อคุณบูตเครื่องคอมพิวเตอร์และจะแสดงทั้งเดสก์ท็อปและแอปพลิเคชันที่คุณใช้.

แต่ลองเปิดโปรแกรมกราฟิกจาก Bash บน Windows และมันจะบ่นว่ามันไม่สามารถเปิดจอแสดงผลได้.

How to run graphical linux desktop applications from windows 10’s bash shell

อย่างไรก็ตามมีแอปพลิเคชันเซิร์ฟเวอร์ X ที่คุณสามารถติดตั้งบนเดสก์ท็อป Windows ได้ โดยทั่วไปแล้วสิ่งเหล่านี้ใช้เพื่อแสดงแอปพลิเคชัน Linux ที่ทำงานบนคอมพิวเตอร์เครื่องอื่น – โปรโตคอล“ X11” ค่อนข้างเก่าและได้รับการออกแบบพร้อมความสามารถในการทำงานผ่านการเชื่อมต่อเครือข่าย.

หากคุณติดตั้งแอปพลิเคชันเซิร์ฟเวอร์ X บนเดสก์ท็อป Windows ของคุณและเปลี่ยนการตั้งค่าในเชลล์ Bash แอปพลิเคชันจะส่งเอาต์พุตกราฟิกไปยังแอปพลิเคชันเซิร์ฟเวอร์ X และแอปพลิเคชันเหล่านั้นจะปรากฏบนเดสก์ท็อป Windows ของคุณ ทุกอย่างควรใช้งานได้ดีสมมติว่าแอปพลิเคชันเหล่านั้นไม่ได้ขึ้นอยู่กับระบบลีนุกซ์เรียกว่าระบบย่อย Windows สำหรับ Linux ยังไม่รองรับ.

ขั้นตอนที่หนึ่ง: ติดตั้งเซิร์ฟเวอร์ X

มีเซิร์ฟเวอร์ X หลายตัวที่คุณสามารถติดตั้งบน Windows ได้ แต่เราขอแนะนำ Xming ดาวน์โหลดและติดตั้งบนพีซี Windows 10 ของคุณ.

กระบวนการติดตั้งนั้นง่าย: คุณสามารถยอมรับการตั้งค่าเริ่มต้นได้ จากนั้นจะเปิดและเรียกใช้ในถาดระบบของคุณโดยอัตโนมัติรอให้คุณเรียกใช้โปรแกรมกราฟิก.

How to run graphical linux desktop applications from windows 10’s bash shell

ขั้นตอนที่สอง: ติดตั้งโปรแกรม

คุณสามารถติดตั้งโปรแกรมเดสก์ท็อป Linux แบบกราฟิกเช่นเดียวกับโปรแกรมอื่น ๆ โดยใช้คำสั่ง apt-get ในสภาพแวดล้อม Bash บน Ubuntu ตัวอย่างเช่นสมมติว่าคุณต้องการติดตั้งโปรแกรมแก้ไข vim แบบกราฟิก GTK คุณจะเรียกใช้คำสั่งต่อไปนี้ในหน้าต่าง Bash:

How to run graphical linux desktop applications from windows 10’s bash shell

ขั้นตอนที่สาม: ตั้งค่าตัวแปรสภาพแวดล้อมการแสดงผลของคุณ

ตอนนี้คุณจะต้องตั้งค่าตัวแปรสภาพแวดล้อม“ DISPLAY” ให้ชี้ไปที่เซิร์ฟเวอร์ X ที่ทำงานบนพีซี Windows 10 ของคุณ หากคุณไม่ทำเช่นนี้แอปพลิเคชันกราฟิกจะไม่สามารถเปิดใช้งานได้.

การตั้งค่านี้ใช้กับเซสชัน Bash ปัจจุบันของคุณเท่านั้น หากคุณปิดหน้าต่าง Bash จะลืมมัน คุณจะต้องเรียกใช้คำสั่งนี้ทุกครั้งที่คุณเปิด Bash ใหม่และต้องการเรียกใช้โปรแกรมกราฟิก.

ขั้นตอนที่สี่: เปิดแอปพลิเคชัน

ตอนนี้คุณสามารถเปิดแอปพลิเคชั่นแบบกราฟิกโดยพิมพ์ชื่อของไฟล์ที่เรียกใช้งานได้เช่นพิมพ์คำสั่งอื่น ๆ ตัวอย่างเช่นในการเปิดตัว vim-gtk คุณต้องเรียกใช้:

มันง่ายมาก หากแอปพลิเคชันขัดข้องหลังจากเปิดตัวระบบ Linux ที่เรียกว่าต้องการอาจไม่ได้รับการสนับสนุนโดยระบบย่อย Windows สำหรับ Linux มีไม่มากที่คุณสามารถทำสิ่งนี้ แต่ลองดูแล้วคุณอาจพบว่าแอพที่คุณต้องการใช้งานได้ดีพอสมควร!

How to run graphical linux desktop applications from windows 10’s bash shell

คุณสามารถรวมขั้นตอนที่สามและสี่ได้หากต้องการ แทนที่จะส่งออกตัวแปร DISPLAY หนึ่งครั้งสำหรับเซสชัน Bash shell ทั้งหมดคุณเพียงเรียกใช้แอปพลิเคชันแบบกราฟิกด้วยคำสั่งต่อไปนี้:

ตัวอย่างเช่นในการเปิดตัว gvim คุณต้องเรียกใช้:

โปรดจำไว้ว่านี่ไม่ได้รับการสนับสนุนอย่างเป็นทางการดังนั้นคุณอาจพบข้อผิดพลาดกับแอปพลิเคชันที่ซับซ้อนมากขึ้น เครื่องเสมือนเป็นโซลูชันที่เชื่อถือได้มากขึ้นสำหรับการใช้งานแอพพลิเคชั่น Linux บนเดสก์ท็อปกราฟิกจำนวนมากบน Windows 10 แต่นี่เป็นวิธีที่เรียบร้อยสำหรับบางสิ่งที่ง่ายกว่า.

The Windows Subsystem for Linux (WSL) is a new feature of Windows 10 (1) that allows you to run native Linux programs directly on Windows, alongside other Windows applications.

When WSL is enabled, it installs an Ubuntu user-mode image that was created by Canonical, the company behind Ubuntu Linux. It loads and runs the Linux Bash shell and provides many of the command-line tools that you would expect when running Ubuntu Linux. It is based on the Ubuntu 14.04.5 LTS release.

Installation

It is easy to install. (2, 3, 4) Turn on developer mode and then enable the Windows Subsystem for Linux feature.

How to run graphical linux desktop applications from windows 10’s bash shell

How to run graphical linux desktop applications from windows 10’s bash shell

It will then download and install WSL and provide a new application called Bash on Ubuntu on Windows.

How to run graphical linux desktop applications from windows 10’s bash shell

Launching it will open a Bash shell that provides most of the commonly used Linux command-line tools like ls, cd, grep and applications such as the vim text editor.

How to run graphical linux desktop applications from windows 10’s bash shell

How to run graphical linux desktop applications from windows 10’s bash shell

You can install additional Ubuntu applications using the apt-get command. The filesystem layout is what you would expect under Linux, with the Windows drives available under /mnt.

X11 And Graphical Applications

WSL doesn’t officially support graphical applications, but some people have installed a separate X11 server and found that it works. (5)

I downloaded and installed the Xming X server for Windows. (6) After launching Xming from the Start menu, I set the DISPLAY environment variable from the Bash shell:

I was then able to run a number of X11 applications.

How to run graphical linux desktop applications from windows 10’s bash shell

My preferred Linux text editor, emacs, did not work (it did work in text mode) but some basic X11 applications (installed using sudo apt-get install x11-apps) all seemed to work quite well. The Firefox browser is reported to work.

Qt Support

I thought it would be interesting to try building Qt inside WSL. I followed the standard procedure for building Qt 5.8.0 on Ubuntu Linux (7) , installing the dependencies it needs and then running configure and make.

Once all the correct dependencies were installed, the configure program ran correctly and I was able to build all Qt modules with the exception of the very large qtwebengine where I encountered some out of memory errors.

I was pleased to see that with the X server running and using Qt’s xcb back end, Qt Designer, Qt Assistant, and most of the Qt widget and QML demos that I tried ran successfully.

How to run graphical linux desktop applications from windows 10’s bash shell How to run graphical linux desktop applications from windows 10’s bash shellHow to run graphical linux desktop applications from windows 10’s bash shell
How to run graphical linux desktop applications from windows 10’s bash shell How to run graphical linux desktop applications from windows 10’s bash shellHow to run graphical linux desktop applications from windows 10’s bash shell

Perhaps pushing my luck, I then tried building the Qt Creator IDE. While it successfully built, running it just resulted in a black window. Qt Creator reported an error about QSharedMemory, which likely isn’t supported under WSL, so that might have been the cause of the problem but it would require more investigation.

Summary

The Windows Subsystem for Linux is currently considered a Beta release. In my short time using it, it seemed quite stable. I did have to restart it a few times when it started reporting out-of-memory errors during large Qt compiles, but general use of the Bash shell seemed quite reliable.

WSL can be useful if you want a Linux-like environment on Windows, including the ability to run scripts and tools like grep, find, awk, sed, etc. I found it particularly useful to be able to use ssh to copy files from another machine over the network.

If you prefer working in the Linux environment and have to use Windows, I would encourage you to try it out.

References

  1. Bash on Ubuntu on Windows, Microsoft MSDN website, https://msdn.microsoft.com/en-us/commandline/wsl/about
  2. Installation Guide, Microsoft MSDN website, https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
  3. How to Install and Use the Linux Bash Shell on Windows 10, How-To Geek website, http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
  4. Everything You Can Do With Windows 10’s New Bash Shell, How-To Geek website, http://www.howtogeek.com/265900/everything-you-can-do-with-windows-10s-new-bash-shell/
  5. Windows 10’s Bash shell Can Run Graphical Linux Applications, PC World website, http://www.pcworld.com/article/3055403/windows/windows-10s-bash-shell-can-run-graphical-linux-applications-with-this-trick.html
  6. Xming X Server for Windows, Xming project website, https://sourceforge.net/projects/xming/
  7. How to Compile Qt from Source Code on Linux, ICS blog post, http://www.ics.com/blog/how-compile-qt-source-code-linux

About the author

How to run graphical linux desktop applications from windows 10’s bash shell

Jeff Tranter

Jeff Tranter is a Qt Consulting Manager at ICS. He oversees the architectural and high-level design of software systems for clients. Jeff’s leadership organizes global teams of developers on desktop and embedded applications. He has been published in Electronic Design magazine.

We learned a couple of weeks ago that Microsoft and Canonical would be teaming up to bring some Linux goodness to Windows 10, and a mere week later, we saw the functionality hit the 14316 Insider Preview build. With that build now in the hands of tinkerers, some neat features are now being discovered.

After Microsoft made the mind-blowing announcement that Linux’s BASH terminal would be supported on Windows 10, many began to wonder if it’d be possible to initiate an X server (the accelerated window manager for Linux) to run GUI applications. In its shipping form, both Microsoft and Canonical expect people to use only command-line based applications in the BASH terminal, but as it happens, you are able to run some GUI apps, as long as you don’t mind the experience being less-than-intuitive.

As the shot above highlights, reddit user w2qw managed to run the xeyes toy and the GUI version of VIM. Neither of those are that impressive, but check out Firefox. While no one would run Firefox this way, given that there’s a native Windows client, the fact that loading the Linux version on Windows is possible really does highlight how powerful this BASH functionality can be. Firefox requires quite a number of dependencies and it could have easily broke right from the get-go. Instead, it appears to be running just fine.

In his post, w2qw recommends heading over to the xming Sourceforge page and then run an application through it using the switch ‘DISPLAY=:0 Firefox’ (without quotes; Firefox can be replaced with another application). It’s noted that performance isn’t going to be ideal, but that likely won’t surprise anyone. Performance penalties don’t take away from the coolness of this actually being possible. Running Windows apps in Linux has been done for ages, but vice versa? It’s impressive to see that in action.

Windows 10’s Anniversary Update offered a new feature for developers: A full Ubuntu-based Bash shell that can run Linux commands on a Windows 10 client. This is possible by using the new “Windows Subsystem for Linux” Microsoft added to Windows 10.

This isn’t a virtual machine or Linux software compiled for Windows. Microsoft worked with Canonical to offer a full Ubuntu-based Bash shell. This isn’t Linux, it is just the Bash shell and the exact same binaries you’d normally run on Ubuntu Linux.

It’s intended for developers who want to run Linux command-line utilities on Windows. They’ll get access to the Windows file system, but you can’t use Bash commands to automate normal Windows programs, or launch Bash commands from the standard Windows command-line.

How to Install Bash on Windows 10

To get started, make sure you have installed the Windows 10 Anniversary Update (build 14316 or higher). This also only works on 64-bit builds of Windows 10.

Once you’re sure you’re using the correct version of Windows 10, open the Settings app and go to Update & Security > For Developers. Activate the “Developer Mode” switch here to enable Developer Mode.

How to run graphical linux desktop applications from windows 10’s bash shell

Next, open the Control Panel, click “Programs,” and click “Turn Windows Features On or Off” under Programs and Features. Enable the “Windows Subsystem for Linux (Beta)” option in the list here and click “OK.”

After you do, you’ll be prompted to reboot your computer. Click “Restart Now” to reboot your computer and Windows 10 will install the new feature.

How to run graphical linux desktop applications from windows 10’s bash shell

After your computer restarts, click the Start button (or press the Windows key), type “bash”, and press “Enter.”

How to run graphical linux desktop applications from windows 10’s bash shell

The first time you run the bash.exe file, you’ll be prompted to accept the terms of service. The command will then download the “Bash on Ubuntu on Windows” application from the Windows Store. You’ll be asked to create a user account and password for use in the Bash environment.

How to run graphical linux desktop applications from windows 10’s bash shell

If you’d like to automate the installation of Bash instead, you can run the following command in a Command Prompt window. This will automatically agree to all prompts and set the default user to “root” with no password:

Using Ubuntu’s Bash Shell

You now have a full command-line bash shell based on Ubuntu, which means you can use Ubuntu’s apt-get command to install software from Ubuntu’s repositories. You’ll have access to all the Linux command line software out there.

To open the Bash shell, just open your Start menu and search for “bash” or “Ubuntu.” You’ll see a “Bash on Ubuntu on Windows” application. You can pin this application shortcut to your Start menu, taskbar, or desktop for easier access.

How to run graphical linux desktop applications from windows 10’s bash shell

If you’re experienced using a Bash shell on Linux, Mac OS X, or other platforms, you’ll be right at home. You don’t need to use sudo, as you’re given a root shell. The “root” user on UNIX platforms has full system access, like the “Administrator” user on Windows. Your Windows file system is located at /mnt/c in the Bash shell environment.

Use the same Linux terminal commands you’d use to get around. If you’re used to the standard Windows Command Prompt with its DOS commands, here are a few basic commands on both Bash and Windows:

  • Change Directory: cd in Bash, cd or chdir in DOS
  • List Contents of Directory: ls in Bash, dir in DOS
  • Move or Rename a File: mv in Bash, move and rename in DOS
  • Copy a File: cp in Bash, copy in DOS
  • Delete a File: rm in Bash, del or erase in DOS
  • Create a Directory: mkdir in Bash, mkdir in DOS
  • Use a Text Editor: vi or nano in Bash, edit in DOS

Índice de contenidos

How do I run a Linux program on Windows?

Virtual machines allow you to run any operating system in a window on your desktop. You can install the free VirtualBox or VMware Player, download an ISO file for a Linux distribution such as Ubuntu, and install that Linux distribution inside the virtual machine like you would install it on a standard computer.

How do I run a Linux program on Windows 10?

Here’s how.

  1. Navigate to Settings. …
  2. Click Update & security.
  3. Select For Developers in the left column.
  4. Select Developer Mode under “Use developer features” if it’s not already enabled.
  5. Navigate to the Control Panel (the old Windows control panel). …
  6. Select Programs and Features. …
  7. Click “Turn Windows features on or off.”

Can I run Linux programs on Windows 10?

Unfortunately, to use Linux programs in Windows, you would typically need to find versions that have been ported to Windows. Using the Windows Subsystem for Linux (WSL), you can now launch Linux applications directly in a Windows 10 command prompt or PowerShell prompt.

How do I run UNIX executable on Windows?

The only way you can get the unix executable to run on a Windows system is using a virtual machine (Something like VMWare or VirtualBox). This isn’t REALLY running it on Windows, of course, it’s setting up a UNIX system on Windows and running it on that UNIX system.

Can you run Linux files 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). … Run the program as-is in a Linux virtual machine or Docker container, either on your local machine or on Azure.

How do I run an EXE file in Linux?

Run the .exe file either by going to “Applications,” then “Wine” followed by the “Programs menu,” where you should be able to click on the file. Or open a terminal window and at the files directory,type “Wine filename.exe” where “filename.exe” is the name of the file you want to launch.

Is Microsoft release Windows 11?

Microsoft is all set to release Windows 11 OS on October 5, but the update won’t include Android app support. … It is being reported that the support for Android apps won’t be available on Windows 11 until 2022, as Microsoft first tests a feature with Windows Insiders and then releases it after a few weeks or months.

Can you run bash scripts on Windows?

With the arrival of Windows 10’s Bash shell, you can now create and run Bash shell scripts on Windows 10. You can also incorporate Bash commands into a Windows batch file or PowerShell script.

Can you run bash on Windows?

Bash on Windows is a new feature added to Windows 10. Microsoft has teamed up with Canonical, aka the creators of Ubuntu Linux, to build this new infrastructure within Windows called the Windows Subsystem for Linux (WSL). It allows developers to access a complete set of Ubuntu CLI and utilities.

Why is Linux better than Windows?

Linux offers great speed and security, on the other hand, Windows offers great ease of use, so that even non-tech-savvy people can work easily on personal computers. Linux is employed by many corporate organizations as servers and OS for security purpose while Windows is mostly employed by business users and gamers.

How can I run Linux on Windows without Virtual Machine?

PowerShell is now cross-platform and runs on Linux. OpenSSH runs on Windows. Linux VM’s run on Azure. Now, you can even install a Linux distribution directory on Windows 10 natively (without using a VM) with the Windows Subsystem for Linux (WSL).