Phill Conrad's Cygwin Tips

Disclaimer: The following page is for my use, and the use of my students at the University of Delaware. It is not an authoritative reference about cygwin. If you find it useful, wonderful. But don't rely on it or consider it a definitive reference.

What is Cygwin?

A Unix emulator for Windows. It makes your PC running Windows "act like" it is running Unix. It is open source, and it is freely downloadable.

Why would I care?

If you want to be able to do all the things you do on "strauss.udel.edu" without actually being logged into strauss, such as editing, compiling, running C and C++ programs, etc. Cygwin might be for you. It can also help you connect to strauss "as if" you were on a Sun Ray (X Terminal.)

How do I install it?

Go to www.cygwin.com, click on "install cygwin now", and take all the defaults. There are only two places you need to do anything special:

  1. Selecting a mirror site. Try to pick one in the US or Canada for good download times... e.g. one from a US University like ufl.edu, or a Candian site (one ending in .ca).
  2. Selecting which packages to install (see below).

Which packages should I select?

If you are enrolled in CISC105, CISC181 or CISC220, the most useful starting set of packages is:

You don't have to install all the packages the first time around. To install or update packages, you just re-run the installer and make different selections.

You may also want to come back later and get the entire X11 tree, but don't do that the first time around; it takes a long time. Once you do that, you can run Cygwin-X, and work just as you do on the Sun Rays (using the mouse in emacs, etc., running Firefox directly from strauss so that you can upload from strauss directly into WebCT, and so forth.)

What can I do with it once I install?

 

What problems can I expect to run into?

 

I don't know how to connect to Strauss

Use:

ssh username@strauss.udel.edu

If you are running in an xterm (i.e. you installed Cygwin-X), use:

ssh -X username@strauss.udel.edu

OR, if that causes some programs to crash, use

ssh -Y username@strauss.udel.edu

I don't know how to copy things to Strauss

To copy from PC to your home directory strauss, use this command (don't forget the colon on the end; otherwise you end up with a file called "username@strauss.udel.edu" on your PC

scp localfile.txt username@strauss.udel.edu:

To copy from PC to another directory, say cisc105/lab03, use this command:

scp localfile.txt username@strauss.udel.edu:cisc105/lab03

This would copy the file AND rename it to foobarfum.txt at the same time:

scp localfile.txt username@strauss.udel.edu:cisc105/lab03/foobarfum.txt

To copy FROM strauss to your local directory, reverse the order of the arguments:

scp username@strauss.udel.edu:cisc105/lab03/foobarfum.txt localfile.txt

To copy a file into the current directory and keep the same name, use a dot as the target (signifying current directory on the local side):

scp username@strauss.udel.edu:cisc105/lab03/foobarfum.txt .

After I ssh into strauss, I can't use emacs

Here is the symptom:

> emacs
emacs: Terminal type cygwin is not defined.
If that is not the actual type of terminal you have,
use the Bourne shell command `TERM=... export TERM' (C-shell:
`setenv TERM ...') to specify the correct type. It may be necessary
to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.
>

Here is the solution:

  1. In cygwin on PC, do:
    infocmp -I -1 cygwin > cygwin.src
  2. Still in cygwin on PC, do this (substitute in your own username):
    scp cygwin.src username@strauss.udel.edu:
  3. Log onto strauss with
    ssh username@strauss.udel.edu
    
    
  4. On strauss do:
    tic -v cygwin.src
  5. Still on strauss do (this assumes /bin/tcsh as your default shell):
    setenv TERMINFO ~/.terminfo
  6. You should now be able to use emacs on strauss from a cygwin shell.

 

Steps 1-5 need to be done only once. Step 6 will have to be done everytime you log in, or else put it at the end of your .localenv file.

None of the Cygwin-X programs is working

Symptom:You select Cygwin-X programs from the start menu (e.g. xterm) but nothing happens.

Solution:The X server must be running on your machine before X windows programs will run.

Look in the directory where you installed cygwin (typically c:\cygwin). Under that directory, look in /usr/X11R6/bin Sort that directory by file type. You should find a file called startxwin.bat. Make a shortcut to that file, and put it on your desktop. Always double click on that file once to start up the "X Server" before you running any X programs. You should see an X in the system tray when the X server is running.

I was told that my mouse would work, but it isn't working. What's up with that?

Regarding the mouse functionality, there is an additional step you have to do: you have to install the X11 package. To install it, go back to the cygwin installer (the same one you used to install cygwin in the first place), and look through the list of packages until you find X11, and select that you want to install that.

After you install it, you need to go into the directory C:\cygwin\usr\X11R6\bin\ and find a file called startxwin.bat.  Make a shortcut to this file and put it on your desktop.  Double click that file to start up X11.   That should bring up a terminal window; in _that_ terminal window, you should find that if you start emacs, it will work with the mouse just like it does with the SunRays.

See also the item above titled "None of the Cygwin-X programs is working"


P. Conrad, University of Delaware