Make your own free website on

Infrablue atTripod

Cygwin Part 1
Cygwin Part 2
Cygwin Part 3
Int'l. Keyboard

Useful Configuration of Cygwin, Part 1: Install, rxvt, and BASH


To install cygwin first download and run the setup.  Be sure to choose at least the folllowing packages:

(hint: if you find the listing of packages according to groups annoying then click the "View" button in the upper-right which will change the listing order to alphabetical)

Admin: cygrunsrv
Doc: cygwin-doc
Doc: man
Editors: vim
Interpreters: perl
Mail: fetchmail
Mail: mutt
Mail: procmail
Net: inetutils
Net: openssh
Net: openssl
Net: rsync
Shells: bash
Shells: rxvt
Text: less
Utils: cygutils

Packages which the above packages depend upon will be automatically selected and installed so there is no need to worry about installing dependencies.  However one problem with this is that if you accidentally click on a package which you do not want to install and it has a lot of dependencies, all those dependencies will automatically be selected and you will have to manually deselect each one.  To complicate issues further, there is no way during the setup to find out what dependencies each package has.  This is basically a mess and hopefully someone will put together a better setup utility.  If you do not want to mess around with stuff then be careful not to select anything that might depend on the packages, including X-term.

You probably want to install a lot of other packages such as perl, grep, exim, ssmtp, zip, unzip, bunzip, tar, gzip, wget, irc, links, ncftp, lftp, file, sunrpc, nfs-server, mc, and others as I have only listed ones essential for this setup.


Setting up rxvt

One of the main points, if not THE main point for setting up Cygwin is to have a bash shell.  By default cygwin sets itself up with a link to the cygwin bash shell in the Start menu and on the desktop.  The default Cygwin shell works but is a little bit ugly and can sometimes lead to problems when working with remote systems running other operating systems. 
The cygwin shell sets the TERM type to "cygwin" which some systems do not properly recognize and certain applications will not work properly or at all under it. 

The best alternative is to use
rxvt (ouR eXended Virtual Terminal) which is also included with Cygwin.  But it is not installed by default, you must select it during setup and then configure it if you want to use it.   Rxvt's $TERM variable is sets to "xterm" which is more universally recognized by other applications and ensures maximum interoperability with other systems.  Also, rxvt is far more configurable than the cygwin term.  Consult the rxvt man page for more info on its many config options.

If the rxvt binary is launched without arguments it will run like a regular DOS shell without the bash environment.  In order to launch in properly you need to create a new shortcut and customize its arguments.  Here is how to do it:

In Windows Explorer go to
C:\cygwin\bin and right-click on rxvt.exe and choose Send To -> Desktop (create shortcut).  Now right-click on the shortcut it just created on the desktop and choose Properties.  Select the Shortcut tab and change the entry under Target to:

C:\cygwin\bin\rxvt.exe -sl 1500 -fn "Lucida Console-12" -bg black -fg grey -sr -e bash --login -i

This will now launch rxvt correctly with a decent looking font, a black background with white text, and 1500 scrollback lines (you can change the number of scrollback lines to whatever you like.  I prefer a high number.)

You can also play around with the font type and size, for example you could also use:

C:\cygwin\bin\rxvt.exe -sl 1500 -fn "courier" -bg wheat -fg grey -sr -e bash --login -i

You get the idea.  But we are not finished.  There are a few things to set up with our bash shell to make it behave decently.  Depending upon how cygwin installed it may or may not have copied the following three files into your home directory: .bash_profile, .bashrc, and .inputrc.  Type cd ~ to switch to your home directory (~ is shorthand for your home directory in the shell), then ls -la to list all files in the directory.  If you do not see them then copy them from /etc/skel.  Now edit .bashrc with the vim editor and uncomment (remove the leading #) the following lines:

set -o notify
export HISTCONTROL=ignoredups

alias less='less -r'
alias rm='rm -i'
alias whence='type -a'
alias ls='ls -F --color=tty'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'

and here are a several more to add:

alias cp='cp -i'
alias mv='mv -i'
alias c:='cd /cygdrive/c'
alias grep='grep --color'
alias vi='vim'
alias cls='clear'
# set a nice looking prompt:
PS1='\u@\h:\W\$ '

#A function to pipe any command to less:
function so {
eval "$@" |less -I~

These aliases tweak several shell commands to make them more useful and safer (for example by causing
rm , cp, and mv to always prompt before overwriting and deleting).  Aliases are only one small part of Bash, which is an extremely powerful and important tool that all users can benefit from highly by knowing.  This last entry is a BASH function which pipes any command to less.  Running so ls for example will pipe the ls command to less, as if ls | less had been typed.  Very useful.

For many, including myself, the shell environment is the most critical part of a system and graphical applications and utilities are often superfluous, distracting, wasteful of resources, and even dangerous.  Most of the command GNU command-line utilities are practically universal and can be used on everything from supercomputers to small handheld devices.

Finally, to
.inputrc you can add the following:

#if you don't like the annoying end-of-line beeps:
set bell-style none

# to show all characters like едц
set meta-flag On
set input-meta On
set output-meta On
set convert-meta Off

"\C-v": paste-from-clipboard

You should now have a decent rxvt shell working under Windows.

How to Copy and Paste text to and from an rxvt terminal

Text which has been copied to the clipboard via
Ctrl-c (or cut with Ctrl-x) can be pasted directly into an rxvt terminal by positioning the cursor in the rxvt terminal where you want the text inserted and holding the shift key while clicking the left mouse button.

To copy text from an rxvt terminal simply
drag the cursor over the region of text you want to select with the mouse while holding the left button down.  Selected text will be highlighted and available in the clipboard for pasting into other applications via Ctrl-vDouble-clicking on a word will select the entire word.  Clicking three times will selected an entire line.  To select a range of words you can double click on the first word, then set the mouse cursor to the right of the last word or letter you want copied, and right-click.


"Cygwin Installation";
"rxvt with bash";
"Cygwin Prompt Here";
"Unix emulation and porting on Win32";

  Home Cygwin Part 1 Cygwin Part 2 Cygwin Part 3 Int'l. Keyboard