Whyrl (whyrl) wrote,
Whyrl
whyrl

  • Mood:
  • Music:

Using PuTTY as a Cygwin terminal

Cygwin is a great toolkit to have on a Windows machine. One of the biggest problems with it though is that it uses the awful Windows Command Prompt terminal by default. There are a couple of ways around this such as installing an X terminal emulator or ssh/telnet to the localhost. Here I will explain how to set it up nicely with PuTTY - or more accurately PuTTYcyg.

Mark Edgar wrote a patch for PuTTY called PuTTYcyg that makes it work as a terminal emulator for Cygwin. I'd been using it for several months at work and it cohabits quite peacefully with PuTTY. It is not an ideal solution and I'd much prefer it if the functionality was included in the official PuTTY source but since I'll only use the binary for connecting to the localhost I guess security isn't that big a deal.

1. Download PuTTYcyg from here and install puttycyg.exe and cthelper.exe (I installed them to the same folder as PuTTY, e.g. "C:\Program Files\PuTTY\").
2. Create a shortcut to puttycyg.exe with the command line arguments "-cygterm -" in the Target: box, e.g. "C:\Program Files\PuTTY\puttycyg.exe" -cygterm -
This will start a Cygwin terminal using your default shell (specified in /etc/login).

That's pretty much it! No more horrible Command Prompt with Cygwin.
(Oh, you might want to change the icon of that shortcut to Cygwin's icon - there should be a cygwin.ico file in Cygwin's root install directory.)

I find it useful when I right-click on a directory to have a target called "Cygwin Prompt Here" that, as the name implies, opens a Cygwin terminal in that directory. Here's what I did:

1. Start the Registry Editor (regedit).
2. Browse to HKEY_CLASSES_ROOT\Directory\shell\
3. Create a new key called "Cygwin Prompt".
4. Modify the default value of Cygwin Prompt to "Cygwin &Prompt Here".
5. Create a new key under Cygwin Prompt called "command".
6. Modify the default value of command to (include the quotes and modify the path to puttycyg.exe as appropriate): "C:\Program Files\PuTTY\puttycyg.exe" -cygterm bash --rcfile ~/.bash_login -i
That's it! You should be able to right-click a directory and get a shell in that directory.

Here's a summary of what you should have:
HKEY_CLASSES_ROOT\Directory\shell\Cygwin Prompt
	(Default)	REG_SZ		Cygwin &Prompt Here
HKEY_CLASSES_ROOT\Directory\shell\Cygwin Prompt\command
	(Default)	REG_SZ		"C:\Program Files\PuTTY\puttycyg.exe" -cygterm bash --rcfile ~/.bash_login -i
Tags: cygwin, howto, putty
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments