Posts

Showing posts from March, 2011

A nice shell prompt for bash, and an easy text editor for Cygwin

I recently installed Cygwin with bash as my preferred shell.  Most shell prompts simply give you a $  or # sign by default.  You don't know where you are in the directory structure unless you type pwd .  There is a simple line you can place in your .bashrc  file in your Cygwin home directory (C:\Cygwin\home\ userid ). If you don't have a text editor or aren't familiar with the UNIX editors such as vi (bvi) or emacs, I'd recommend nano .  If you don't have nano installed (check by simply running nano  in the Cygwin window).  You can install that by re-running the Cygwin setup.exe in Windows.  In the setup, expand the Editors section and click the area to the left of Nano until you can check its checkbox, then proceed with the setup.   nano  has more of a Notepad-like interface than anything else I've seen.  To edit your .bashrc  file with nano , simply type: nano .bashrc Scroll down to the bottom (use your arrow keys or press Ctrl-V).  Add the following line:

Using mintty for Cygwin and bash (or your preferred shell)

I installed Cygwin with the default options, but did not like how the terminal window was based on the Windows CMD (command line).  I did some reading and found that many people recommend mintty which is based off PuTTY v0.60, arguably a better terminal interface. However once you install mintty, you don't automatically get your shell.  Running mintty from the Start menu or shortcut icons just dropped me into the /usr/bin directory with limited shell functionality (couldn't do ls , etc. but could do cd ).  Weird.  The way to get this right is to edit the C:\Cygwin\cygwin.bat file from Windows, remove or comment out the default shell call, for example: @echo off C: cd C:\cygwin\bin REM bash --login -i start mintty.exe c:\cygwin\bin\bash --login -i You also might want to look into other startup options such as sizing of the window; you have different options  like: start mintty.exe -s 120,60 c:\cygwin\bin\bash --login -i           [opens a mintty window with 120 cols, 6