Cygwin Shell
(last updated: Mar 23, 2009)

Select font size:
The Cygwin installation creates a Bash shell along with a UNIX environment by which you can compile and run UNIX-like programs. Using this one can even create an emulated X server on your windows box and run UNIX-like GUI software tools.

The following installation steps illustrate a minimal installation which allows secure-shell access to a remote server.
  1. Go to the Cygwin/X site: Click the Install Cygwin Now and thereby download the setup.exe file. I would sugges placing this into a separate folder since it creates other companion folders for each download site used.
  2. Double-click on setup.exe to run it.
  3. Click Next in introductory window.
  4. Take the defaults (i.e., just click Next) in the Choose A Download Source to install from the internet.
  5. Take the defaults in the Select Root Install Directory.
  6. Take the defaults in the Select Local Package Directory.
  7. Take the defaults in the Select Your Internet Connection. If your doing this download in a company, especially, you may need to chose the "proxy server" setting. This information would need to be obtained from your network administrator.
  8. Pick a site of your choice in Choose a download site.
  9. Select Packages: The following package selection serves a variety of needs.

    Keep clicking the View button until it becomes Full. Add the following packages by clicking on the entry in the New line, changing it from Skip to a software version number. You may add others if you wish, but keep it simle to start since you can always go back and install additional packages later.

    Of the choices below, the red ones are needed for the X installation. If you just want secure shell access, you can skip them.

    The last two, nano and vim are shell-based editors. Neither are absolutely necessary since you can always edit the files from Windows. If you're unfamiliar with vim, I would probably recommend nano.
    xinit                brings in basic X functionality
    X-start-menu-icons 
    WindowMaker          a Cygwin/X window manager
    font-adobe-dpi100    basic X font stuff
    font-adobe-dpi75
    font-aliases
    openssh              for ssh
    nano                 simple shell editor
    vim                  for vim junkies
    

    Hit Next to do the download/installation. Download time will depend on the network speed. The installation goes pretty fast.
  10. Create Icons: as you wish. You probably want to at least create icon on desktop.
  11. Cygwin installs into the directory c:\cygwin with subdirectories: bin, etc, home, lib, tmp, usr, var and the files cygwin.bat and cygwin.ico. The desktop icon created by installation is just a shortcut to cywgin.bat.
  12. After installation is complete, run Cygwin from your desktop icon. The first time you do this the skeleton files are copied into your directory.

    You are positioned in your home directory which whose path name is: /home/MY_WINDOWS_LOGIN but is actually the directory c:\cygwin\home\MY_WINDOWS_LOGIN.

Secure shell client access to remote server

If you have an account on the WCU computer science student Linux server, you can test the secure-shell login as follows:
$ ssh -l MY_TAZ_LOGIN taz.cs.wcupa.edu
Password: MY_TAZ_PASSWORD

Set up X server

Create the file ~/.xinitrc. with just this one c:\cygwin\home\MY_WINDOWS_LOGIN\.xinitrcline:
exec wmaker
There are several possibilities for doing so: Then start the X server from the Cygwin shell:
$ xinit
This should start the WindowMaker window manager. The terminal you need, xterm, is easily activated by double-clicking the blue terminal icon on the right-hand side. A more complete menu (which may not be too useful) can be gotten by right-clicking on the screen.

Again, if you have an account on the WCU computer science student Linux server, you can use X-forwarding from this server to your computer running Cygwin/X. As an example, we forward xemacs as follows:
$ ssh -Y -l MY_TAZ_LOGIN taz.cs.wcupa.edu
Password:
[taz]$ xemacs &
Note that the usual option to invoke X-forwarding is "-X", but we need to use the fake-authenticated replacement "-Y" in this situation.

Create an simplifying alias

Open the Cygwin shell and edit the file ~/.bashrc. Use either the Cygwin shell editor nano or vim, or access this file from Windows in a manner discussed in the previous section. Go to the end of the ~/.bashrc file and add this line:
alias taz='ssh -l MY_TAZ_LOGIN -Y taz.cs.wcupa.edu'
When you start up a new shell, simply type this to access taz.cs.wcupa.edu:
taz

Other Suggested Modifications

The Cygwin executable, by default, opens up in the user's home directory. This tends to be inconvenient if you really want it to open up "where it is", like in the Desktop. To fix this problem you need to modify 2 files:
  1. Edit the main startup script, /Cygwin.bat, (which is c:\cygwin\Cygwin.bat). If you use nano from within the cygwin shell, type:
    nano /Cygwin.bat
    
    If you prefer vim over nano, make this substitution. Rewrite the script as this:
    @echo off
    
    C:\cygwin\bin\bash --login -i
    
  2. Edit /etc/profile (which is c:\cygwin\etc\profile). This is the script called whenever bash is started as a login shell (as it is in cygwin.bat). Search for the section:
    #Make sure we start in home unless invoked by CHERE
    if [ ! -z "${CHERE_INVOKING}" ]; then
      unset CHERE_INVOKING
    else
      cd "${HOME}"
    fi
    
    Basically, I want to avoid the cd "${HOME}" command from being called. The most blunt way to do so is to add the line
    CHERE_INVOKING=1
    
    just prior to this section (note: no spaces around the "=" operator)
Afterwards, when you run the cygwin executable (by double-clicking an icon), you will be positioned in the directory where you double-clicked it. If you do need to access files in your home directory, simply type:
$ cd