Cygwin not only provides most of the Linux programs and shells, it also comes with a builtin X server called Cygwin/X. This is great if you want to run Cygwin GUI applications locally or over SSH from a remote computer.
xinitpackages. The first one is the X server and the second installs a lot of scripts and programs that enable you to start the server and use it.
xeyespackage. This is a small X application that we will use for testing X.
XWinand other X server processes if they are running and close all your Cygwin windows. Open a new Cygwin window.
$ export DISPLAY=:0.0
startx: If you run
startx, you get X server opening a X window with XTerm running inside it. From here on, you can open X apps by running them from that XTerm. You can try by running
xeyes inside that XTerm. Once you kill this X window, your X server is closed.
startxwin: If you run
startxwin, you get X server running, but no windows are displayed. You can now open another Cygwin window and can invoke individual X apps there and they will be displayed in individual windows. You can try by running
xeyes from the Cygwin shell. This is called the multiwindow mode.
Follow all the steps shown above for local X apps. Make sure you have killed the earlier X server processes, set the
DISPLAY environment variable locally and run
startxwin. Make sure local X apps can display a window to the Cygwin/X server.
SSH to the remote computer running Linux using ssh on Cygwin or PuTTY. Make sure you have X11 Forwarding enabled for this SSH session. This is usually done by specifying
-X (untrusted forwarding) or
-Y (trusted forwarding) or setting the corresponding X11 Forwarding option in your SSH config file.
DISPLAY on the remote computer. It should be set to some value like shown below:
$ echo $DISPLAY localhost:11.0
DISPLAY is empty, then either you did not set
DISPLAY locally, did not cleanly restarted a X server locally or there was a problem with SSH X11 Forwarding. Please diagnose.
xeyesprogram from the remote computer. It should display in a window on your local machine. Your Cygwin/X server is working! You can now run GUI/X apps from the remote computer and display them locally. Beware that they will be slow to display and refresh.
Tried with: Cygwin 2.10.0 and Windows 10