Title photo
frugal technology, simple living and guerrilla large-appliance repair

Regular blog here, 'microblog' there

Many of my traditional blog post live on this site, but a great majority of my social-style posts can be found on my much-busier microbloging site at updates.passthejoe.net. It's busier because my BlogPoster "microblogging" script generates short, Twitter-style posts from the Linux or Windows (or anywhere you can run Ruby with too many Gems) command line, uploads them to the web server and send them out on my Twitter and Mastodon feeds.

I used to post to this blog via scripts and Unix/Linux utilities (curl and Unison) that helped me mirror the files locally and on the server. Since this site recently moved hosts, none of that is set up. I'm just using SFTP and SSH to write posts and manage the site.

Disqus comments are not live just yet because I'm not sure about what I'm going to do for the domain on this site. I'll probably restore the old domain at first just to have some continuity, but for now I like using the "free" domain from this site's new host, NearlyFreeSpeech.net.

Tue, 30 Oct 2018

Cygwin and the Windows Subsystem for Linux, when to use one and not the other

tl;dr: The Windows Subsystem for Linux is shiny and new, and its great when your environment has to be exactly like Ubuntu (or whatever distro your WSL is based on), but if your aim is to use Linux tools on Windows files, Cygwin is a better choice.

Cygwin, the Linux environment for Windows, has been around for a very long time, but I've never used it. Until now.

During the year or so that I've been running Windows 10, I tapped into the Windows Subsystem for Linux (aka Bash on Windows, aka Ubuntu on Windows) as my Linux-in-Windows environment so I could have the best of both worlds, or at least all of one world and a great deal of the other.

When I first started with Windows 10 and the WSL, what I thought I would do with Linux on Windows was manage files and do little sysadmin-style tasks like update this blog via Unison (very doable in the WSL) and back up Windows files (NOT doable in the WSL). I thought I could have a Windows computer but do everything in a Linux shell.

It was not meant to be.

Once I realized that my WSL and Windows filesystems were on two different islands and that using one system to edit the other's files was difficult at best and file-destroying at worse, I abandoned my idea of using WSL Linux tools to manage my Windows environment.

As I say above, I used the WSL as my Windows 10 blog-writing and syncing environment, and it has worked very well for that task, except that my files are all in the WSL filesystem, and I have to do all of my writing in the WSL's Bash shell. That's not a hardship per se. I used the opportunity to improve my Vim skills, and I got even better with Vim when I began using it on the Windows side to do my text processing and editing.

Still, having to transfer text files and images from Windows to Bash/WSL was an extra step. I do have a Bash script that does it for me, but it would be easier if the WSL could work with files anywhere on the Windows drive..

Recently something — and I can't remember what that something was — got me thinking about Cygwin. It has LOTS of Linux packages, including the old version of Unison that I had to pin in Ubuntu WSL so my syncing setup would continue working. And it was made to work in the Windows filesystem.

I downloaded and installed Cygwin, and I began building up my environment. I even added X and the Geany text editor just to see how the GUI works. (It's awkward but usable. Unlike X on the WSL, it is supported.

Unfortunately, while I initially got Cygwin's Unison to work with my Linux shared-hosting account, once I changed some file permissions on the server, the file-synching program stopped working. So I'm back to the WSL for my Unison synching needs. I also installed rsync, and I still hope to be able to use it to back up the Windows side of the laptop.

I've already been using Cygwin instead of the Git Bash shell (which I've been using since I discovered it in my Windows right-click menu) to create files and directories in Windows, though Cygwin's failure to run Unison seamlessly with a Linux server on the other end has somewhat tempered my excitement over having yet another Linux alternative in Windows. Today I just right-clicked into Git Bash to create a few files and directories for my morning news production.

You may be thinking, "If he's so comfortable with Linux tools, why use Windows at all?" That's a fair point. I'm not happy about Cygwin's inability to sync with a Linux server, but I still have the WSL, and I recognize its value.