banner



How to Run Shell Script in Unix From Windows

Windows 10's Bash shell doesn't officially support graphical Linux desktop applications. Microsoft says this feature is intentional only for developers WHO want to run Linux closing utilities. But the underlying "Windows Subsystem for Linux" is more strong than Microsoft lets on.

It is possible to run graphic Linux applications in Windows 10, but bear in mind that it International Relations and Security Network't officially pendent. Non every piece of Linux package works, and graphical applications are even more complex and less proven. But these should turn 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 john't install and campaign 32-bit Linux software.

RELATED: How to Install and Function the Linux Bash Shell on Windows 10

How This Works

First, Lashkar-e-Tayyiba's run down exactly how this works so you buttocks undergo extraordinary understanding of what we'Re doing Hera.

Windows 10 includes an implicit in "Windows Subsystem for Linux" that allows Windows 10 to run Linux software by translating Linux system calls to Windows organisation calls.

When you run a Linux distribution like Ubuntu, it downloads and installs a complete Ubuntu user space icon connected your computer. This includes the exact selfsame binaries–or applications–that would ravel happening Ubuntu. That "Bash on Ubuntu on Windows" environment works thanks to the implicit Windows Subsystem for Linux.

Microsoft doesn't require to drop whatever time functioning on in writing software, as this feature film is intended for bid-line developer tools. But the principal technical reason that graphical applications aren't substantiated is that they require an "X server" to provide that graphical user interface. On a typical Linux desktop, that "X waiter" automatically appears when you boot your computer and it renders the entire screen background and the applications you use.

But examine opening a in writing application from Bash happening Windows, though, and IT will quetch that it give the sack't open a display.

There are X server applications you can install on a Windows screen background, however. Typically, these are used to render Linux applications running on other computers–the "X11" protocol is rather patched and was designed with the ability run over a meshwork connection.

If you install an X server application on your Windows desktop and change a mise en scene in the Bash shell, applications will send their in writing 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 subscribe.

Step One: Install an X Waiter

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

The installation swear out is simple: You can just accept the default settings. Information technology will then mechanically launch and run in your system tray, ready and waiting for you to run graphical programs.

Whole tone Two: Install the Program

RELATED: How to Install Linux Software in Windows 10's Ubuntu Bash Shell

You can install in writing Linux desktop programs like you can any other program, exploitation the apt-get command in the Ubuntu-based Bash surroundings. For deterrent example, let's pronounce you'd want to install the graphical, GTK-based vim editor. You'd run the following command in the Bash windowpane:

sudo apt-get install vim-gtk

It will go through the initiation process in the dominate descent window, just like IT does on Ubuntu.

Step Iii: Set aside Your Display Environment Variable

Now, you'll need to set the "DISPLAY" environment covariant to point at the X server running happening your Windows 10 PC. If you wear't do this, in writing applications volition simply fail to launch.

To perform this, run the following overtop in the Bash environment:

export DISPLAY=:0

This stage setting only applies to your prevalent Bash session. If you close the window, Bash leave forget information technology. You'll have to run this command each time you reopen Bash and want to run a graphic covering.

Mistreat Four: Set up an Covering

You can now but launch a graphical application by typewriting the constitute of its executable, like you'd type some other require. For example, to launch vim-gtk, you'd prevail:

gvim

It's that simple. If the application crashes subsequently launching, the Linux system calls it requires may not atomic number 4 based on by the Windows Subsystem for Linux. On that point's non much you rear do about this. But pay it a shot, and you English hawthorn find that the apps you call for bring off decently well!

You arse also combine the third and fourth stairs, if you like. Rather than exporting the DISPLAY variable once for an whole Bash case session, you'd sporty run a graphical diligence with the following instruction:

DISPLAY=:0 command

For example, to launch gvim, you'd play:

DISPLAY=:0 gvim

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

How to Run Shell Script in Unix From Windows

Source: https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/

0 Response to "How to Run Shell Script in Unix From Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel