How to convert Unix and Windows paths in Cygwin

Cygwin uses Unix paths. It can be sometimes confusing to figure out where in the Windows filesystem a Cygwin path is actually referring to. This is precisely why Cygwin ships with the cygpath tool.

  • To print the Windows path of a Cygwin Unix path:
$ cygwin -w /some/unix/path
  • To print the Windows path of a Cygwin Unix path in a DOS-compatible path format:
$ cygwin -d /some/unix/path
  • To find out how a Windows path can be accessed inside Cygwin as an Unix path:
$ cygwin -u "C:\Windows"

byobu status bar shifting under ConEmu


I installed the latest stable release of ConEmu. I opened a Cygwin shell and used SSH to connect to a remote computer. I ran Byobu on the remote computer. I noticed that its status bar would shift upward, overwriting the entire screen after some time.


This problem is documented here. The solution suggested by the ConEmu creator is to use the ConEmu/msys terminal connector plugin. Using this connector is however a bit complicated. But, according to this post, it has been rolled into ConEmu starting with the 170705 release. I checked and found that the stable release I had installed was 161206. The stable release was years behind!

Seeing no recent stable version available, I opted to download a preview release from here. This release was dated later than 170705. byobu worked fine through SSH from Cygwin after that!

How to install Byobu on Cygwin

Byobu is a user friendly terminal multiplexer built around tmux.

There is no byobu package in Cygwin, but installing it from source is easy:

  • Install tmux and make using the Cygwin package installer.

  • Download the latest release of Byobu from here and unzip it.

  • Configure by providing it the directory where you want it to be installed and then make install it:

$ ./configure --prefix="$HOME/installs/byobu"
$ make
$ make install
  • Add the installed bin directory to your PATH environment variable at the shell or permanently in your bashrc:
$ export PATH="$HOME/installs/byobu/bin:$PATH"

You can now run byobu at the shell. You will notice that there will be some errors when it looks for Linux programs that are either not installed or not available on Cygwin. Also, the configuration user interface does not appear since that needs python-newt which is not available for Cygwin. Some of the function key combinations might also not work cause it is Windows.

Tried with: Byobu 5.125 and Cygwin 2.10

Make error with cpan

The first time you try to install a Perl package from CPAN, you might get this error:

Writing MYMETA.yml
  make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

The fix is simple: you need to install the make package. This error typically occurs on Cygwin, which does not have make installed by default. Install make and then try to install the package again and it should work now.

Tried with: Cygwin x86 1.7.25

How to install Cygwin packages from commandline using apt-cyg

Probably the biggest pain in using Cygwin is that you need to use the setup GUI program and go through its wizard dialog to view, install or uninstall packages. Thankfully, there is now a solution called apt-cyg that mimics apt-get on Linux to list, install and remove Cygwin packages.


To install apt-cyg, first install the subversion and wget packages using the setup program. After that do:

$ wget
$ install apt-cyg /bin

You are now ready to use apt-cyg, which is actually a Bash shell script.


This is really easy:

$ apt-cyg update
(Update package information from the internet)

$ apt-cyg show
(Lists installed packages)

$ apt-cyg find foo
(Lists installed and not-installed packages with foo in their name)

$ apt-cyg describe foo
(List description of package named foo)

$ apt-cyg install foo
(Install package named foo)

$ apt-cyg remove foo
(Remove package named foo)

Tried with: Cygwin 2.10.0

Cygwin x86 and x86_64

I had a Cygwin installation on Windows x64. Recently, I found that its setup program could not pull the package list, claiming that the mirrors could not be found. It turns out that now Cygwin has split off into x86 (for 32-bit Windows) and x86_64 (for 64-bit Windows).

I tried the x86_64 and found it lacking many packages that are present in the x86 branch. In addition, there were many other problems too. So, if you are using a production system based on 64-bit Windows, you might still want to use the x86 Cygwin. Both of them work on 64-bit Windows, but the x86 version is bound to have fewer problems in the near future, until x86_64 version gains stability.

How to check for Cygwin in Vim

Vimrc and other Vim script files can be used across many platforms. To check specifically for CygwinΒ in these files, check for win32unix as shown here:

if has("win32unix")
    " Do something only in Cygwin

Note that value of unix is also true under Cygwin. So, if you want to do something specifically under Linux, but not under Cygwin, then try this:

if has("unix") && !has("win32unix")
    " Do something only in Linux, but not in Cygwin

Tried with: Vim 7.3 and Cygwin 1.7.22

How to install cowsay for Cygwin

cowsay is a popular tool to produce fun greetings at the shell. Cygwin does not ship with cowsay.

A cowsay package compiled for Cygwin can be downloaded from here. Unzip its contents, which will be contained in a usr directory. Using Windows Explorer, merge this directory with the /usr directory of Cygwin. Using the mv command for this purpose will not work, since it does not merge directories.

That is it, you can call cowsay or cowthink from the Cygwin command prompt! The different ASCII animal characters it ships with can be seen in theΒ /usr/local/share/cows directory πŸ™‚

Tried with: Cowsay 3.03-1 and Cygwin 1.7.22