Welcome
  Home
  News
  Resume
  Contact

Personal
  Profile
  Photos
  Friends
  Interests
  Computer

Research
  JSCC
  TFR
  Software
  Papers
  Tutorials

Miscellaneous
  Links
  Quotes
  Timetable
  Message
Step 3: Installing the CYGWIN Package
Overview   |   Shell   |   Console   |   CYGWIN   |   Applications   |   Utilities   |   Links

Installing the CYGWIN package is probably the most important step in making your Windows machine working like a UNIX environment, since it comes with not only the GCC/G++ compiler that you are familiar with, it also brings you the entire distribution of GNU programs such as bash, binutils, textutils, binutils, sed, awk... you can even run a simulated Xserver if you really want to (I recommend against that, though, that's one step too far, if you have to run Xwindow programs, install Linux or at least get a native one like Micro X-Win32 or Exceed). Best of all, now you are free to compile all the programs that you need, it works most of the time.

Installing CYGWIN is easy, first get the small installer program, and run it, follow the instruction and that's it! If you are not familiar with those optional programs, just install the whole thing, you might end up not using a lot of them, but just having them lying around in my hard drive makes me feel wonderful all over :-) I recommend that you install the program in the default location or some place like c:\UNIX.

The next step is to configure cygwin/bash and make it work the way you like. The first thing you would have to do is to make sure that you have a home directory, create one say c:\home, and then set the environmental variable HOME to point to it (in Win9x/ME, this is done in autoexec.bat, in WinNT/2K, this is done in control panel). CYGWIN installation program should have already put a shortcut on your desktop pointing to cygwin.bat, you should modify the property of this shortcut, such as screen size, fonts, etc. Add in extra environment variables in cygwin.bat.

Create a .bashrc file in your HOME directory to modify the bash behavior. One thing I like is the colorized output of ls. So that's what I put in my .bashrc file:

LS_COLORS_1=di='01;33':ex='01;31':ln='01;35':bd=35:cd=31:fi=37
LS_COLORS_2='*.c'='01;32':'*.h'='01;32':'*.cpp'='01;32'
LS_COLORS_3='*.m'='01;36':'*.tex'='01;35':'*.sh'='01;31'
LS_COLORS=$LS_COLORS_1:$LS_COLORS_2:$LS_COLORS_3
export LS_COLORS
alias ls="ls -F --color"

The colors and their corresponding values are:

Black 0;30 | Dark Gray 1;30 | Blue 0;34 | Light Blue 1;34 | Green 0;32 | Light Green 1;32 | Cyan 0;36 | Light Cyan 1;36 | Red 0;31 | Light Red 1;31 | Purple 0;35 | Light Purple 1;35 | Brown 0;33 | Yellow 1;33 | Light Gray 0;37 | White 1;37
Black 0;30 | Dark Gray 1;30 | Blue 0;34 | Light Blue 1;34 | Green 0;32 | Light Green 1;32 | Cyan 0;36 | Light Cyan 1;36 | Red 0;31 | Light Red 1;31 | Purple 0;35 | Light Purple 1;35 | Brown 0;33 | Yellow 1;33 | Light Gray 0;37 | White 1;37

Now, let's go to step 4: Installing important UNIX applications.