Perhaps most people using Cygwin don’t realize this, but they actually have two home directories. One is their Windows home directory (%USERPROFILE%) and the other is their Cygwin home directory (~).

Several months ago I became frustrated with repeated navigation from one to the other, so I began using a symbolic link. In ~ I created a link to %USERPROFILE% with ln -s "$USERPROFILE" home. Thus, any time I wanted to change to my Windows home directory I would simply cd ~/home.

It worked, but that dichotomy remained… Then, it occurred to me: why couldn’t ~ and %USERPROFILE% be the same?

Luckily, they can!  In fact, the Cygwin documentation on alternate home roots shows exactly how. Using mkpasswd, one or all home directories may be set to any arbitrary path; to change all home directories to the Windows home directory:

mkpasswd -l -p "$(cygpath -H)" > /etc/passwd

Pretty neat. See the Cygwin documentation on alternate home roots for more information.

 

Here’s a useful one-liner for running a generic socket server. I came up with this socat-based alternative to writing my own for testing client output. It listens on port 4096, accepts TCP/IP connections, and prints input received to stdout.

socat TCP-L:4096,fork -

Socat is quite powerful, be sure to read more about what it can do.

2011-July-08: My coworker has a great post showing how socat can pipe data from a serial port to a socket!

 

2011-Nov-24: Exciting news! mintty is now the default cygwin shell.

…mintty has become part of the default installation, setup will
create desktop and start menu shortcuts called “Cygwin Terminal”, which
point to mintty, starting your default shell as noted in /etc/passwd.

Let’s face it, cygwin is neat but the console (or, terminal emulator, if you prefer) it launches is lame. I’m not referring to bash, but rather the normal — and thus lame — Windows command box. Things just don’t feel right… some keys don’t work as expected and forget about making the window wider. Fortunately, there is a better way!

Rather, I should say there are better ways: puttycygConsole2, and my personal favorite, mintty.

puttycyg is a patched version of putty with support for cygwin. mintty is … well, yeah, it’s based on putty, too.

If you use cygwin, you owe it to yourself to try one or all of them immediately. And by that I mean stop reading and start downloading. Now.

© 2011 And now here's something… Suffusion theme by Sayontan Sinha