Installing cygwin at home for ECE532

In the 'C' review notes I make use of the cygwin tools.  The following outlines how to install enough of the cygwin tools so that you can perform the examples.

  1. Use your favorite browser to go to one of the cygwin webpages.

  2. Click on a Install Cygwin now to start downloading the setup.exe program, and save it to a new directory with a path like the following:
    C:\cygwin\download\setup.exe
    
  3. Run the setup.exe file.  You can use a file navigator to find and double click on the file.  Since the default value for each option is the logical choice for most installations, you can get a working minimal Cygwin environment installed by simply clicking the Next button at each page.  I recommend that you use C:\cygwin\download to store your local package dierectory and in choosing a mirror to download Cygwin from, the list of mirrors at http://cygwin.com/mirrors.html provides more details.  I recommend that you pick a site in a nearby state.

  4. When you arrive at the Select Packages page, have the following

  5. From here on out its a long wait till the install completes.  Click yes to make a new icon and a new entry in the start menu.

  6. Start a command shell either by clicking on the Cygwin icon on your desktop, or in the start menu select the Cygwin Bash shell.  If you want to use the DOS editor, enter the following at the keyboard, you should only ever have to do this once. 

    For Windows XP use:
    $ ln -s C:/WINDOWS/system32/edit.com /usr/bin/edit
    
    For Windows NT use:
    $ ln -s C:/WINNT/system32/edit.com /usr/bin/edit
    

    Once this link is created, you can start the DOS editor simply by typing the word edit at the bash prompt, as in the following:

    $ edit hello.c
    

    The edit program itself doesn't know how to paste from other Windows, but the actual window edit runs in can do that.  To paste text from another window, in the upper left window corner click the Cygwin icon and select edit => paste.  BUT if you cannot paste or if you cannot use the mouse in the edit window, then with your mouse click the Cygwin icon in the upper left corner of the window and select Properties.  In the pop-up window, in the Edit Options pane check that

    O QuickEdit mode is not checked
    X Insert mode is checked

    Click okay and in the Apply window, click Modify shortcut that started this window so that when you restart Cygwin, the changes will take effect.  Close edit by selecting File => Exit and close Cygwin by entering exit at the Cygwin prompt.

  7. If you are not familiar with the Unix style command line interface, the following list of commands should help get you started.

    $ pwd
    Reports the so-called current working directory.  Cygwin uses / to refer to the Cygwin install directory so at home you might get /home/UserName.  Cygwin uses /cygdrive to refer to the root of all file systems on your PC.  The PCs on campus use the drive letter Z: to refer your space on the department file server, so you might get /cygdrive/Z
     
    $ ls
    $ ls -a
    This command lists the files in the current directory.  The -a switch is a modifier telling ls to include the so called hidden files in the listing.
     
    $ edit hello.c
    This is not an actual Cygwin command, but rather it executes a Windows/DOS program named edit.com.  See the comment above regarding how to set the link up.
     
    $ gcc -g hello.c
    $ gcc -g hello.c -o hello
    This executes the gcc compiler to produce an executable program.  The -g switch inserts debugging information and the -o switch assigns the name to the executable.  Withouth the -o switch, a program named a.exe is produced. 
     
    $ ./hello
    The default installation does not include the working directory in the PATH searched for executable programs.  The period or '.' means the current working directory so this is actually the short-hand form of the direct path, which avoids that search issue.  If you want to include the current working directory in your search PATH, then use the following to start edit:
    $ edit .bashrc
    
    Inside edit type in the following, then save and exit from the file.  The leading '.' character in the filename will cause ls to normally not show the file in a listing.
    PATH=${PATH}:.
    export PATH
    
    $ insight hello
    The program insight is a handy graphical front-end to a debugger program named gdb.  In being graphically oriented, insight allows you to point and click, but it also provides a gdb console, for keyboard entry.
     
    $ mkdir NewDir
    $ rmdir OldDir
    The make and remove directory commands create and delete a directory, respectively, relative to the current working directory.
     
    $ cd
    $ cd e:/NewDir
    This command is used to change the working directory.  Note the use of upslashes, rather than down slashes.  When used without any argument, the working directory is changed to your login directory.  A drive letter like e: is shorthand for /cygdrive/e
     
  8. To produce a screen shot of a window, click to highlight the window then on the keyboard press Alt and Print-Screen together.  This captures the image of the window into the clipboard.  Next, start a graphical editor program like paint and select Edit => Paste and then print the image.

Please Let me know that you read my web pages.

Revised: Mon Feb 26 01:06:07 EST 2007