You are on page 1of 18

Cygwin Training Seminar

March 4, 2004 MDL AWIPS (Room 10246)

Presenters

Ash Gokhale Arthur Taylor

Agenda
1. 2.

3.

Installation Guidelines Highlights of Cygwin features (Basic and Advanced) Reference Guide

1. Installation Guidelines

MDL has standardized it's X11 and ssh (replacing telnet and ftp), interface software for PC's. The major goal is to allow better access from desktops PC's to the various Unix servers that MDL and other divisions support.

Three software packages have been chosen. Cygwin, WINscp, and Putty terminal software.
There are different situations under which each package will serve a user best. Consequently, the following recommendations are being made:

1. Installation Guidelines (Contd)

Use Cygwin for remote secure access through which X11 tool and applications will be employed. Use Putty terminal in secure mode when terminal access is needed but X11 display functions are not. Generally, if you use Cygwin, you can forgo using Putty. Use WINscp for secure, ftp-like, file transfers between PC's and Unix hosts. Alternatively, the command 'scp' may be used under Cygwin.

1. Installation Guidelines (Contd)

The Cygwin software and localized installation directions can be found at: http://www.mdl.nws.noaa.gov/pub/Cygwin

Putty terminal software can be found at

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

WINscp software can be found at: http://winscp.vse.cz/eng/

Please address any questions to <admins@thunder.nws.noaa.gov>

2. Advanced cygwin features

Overview

Cygwin offers a UNIX like environment on top of MS-Windows.

Gives the ability to use familiar UNIX tools without losing access to typical MS-Windows programs Does not require a UNIX administrators level of expertise to setup and maintain. Most security issues can be left to MS-Windows administrators, since it is not a new operating system, but rather a set of programs in the MSWindows operating system

Not necessarily a catch all

Task
Remote SSH session Fast install / uninstall (on a borrowed machine)

Putty / Cygwin CygwinX Exceed Winscp


Yes Yes Yes No Excessive No Needs patch. No

Remote GUI Desktop (and tools) (note: hogs communication lines)


Local GUI Desktop (and tools) (xemacs, xv) Command line local UNIX tools (compiler, makefiles, scripting, editors, diff, etc, cron, imagemagick) GemPak Cost (usage at home / telecommuting)

No
No No

No
No Yes

Yes
Yes Excessive

Yes
No No

No Free

No Free

No Free

Yes Expensive

Cygwin: Features beyond the basic


Command line tools:

Compiler (gcc, g77, g++, make) Network tools (ssh, scp, rsync) Programming tools (splint, indent) Version control system (cvs, rcs) File tools (diff / patch, head / tail / cut, od) Shell scripting (bash, tcsh, zsh) Archive (tar, gzip, bzip) Man Pages Interpreters (expect, Tcl/Tk, perl, python) Editors (vi, pico (see pine), emacs) Easy copy / paste between cygwin and MS-Windows programs (rxvt) Scheduled task capability (cron) {Extension: ImageMagick (convert)} {Extension: CD Images (mkisofs)}

GUI based tools:


Xemacs xv Ghostscript {Extension: GrADS}

Command line tools: compilers


Example hello.c:
#include <stdio.h> int main (int argc, char **argv) { printf (Hello world\n); return 0; }

Example hello.f
PROGRAM HELLO WRITE (*,*) Hello World END

> gcc hello.c mno-cygwin o hello > ./hello Hello World > ls hello.exe

> g77 hello.f mno-cygwin -o hello > ./hello Hello World > ls hello.exe

Note: -mno-cygwin flag compiles the code so that it is not dependent on /bin/cygwin1.dll. This means hello.exe can be run on any MS-Windows operating system.

Command line tools: Network

Network tools

ssh: Secure connection scp: Secure file transfer ftp: File transfer protocol (Primarily for anonymous ftp connections) rsync: Syncronize file trees (Doesnt always work for large file trees).

Note: It is possible to set cygwin up so that it acts as an ssh server or ftp server for specific IP addresses, but one needs to consider security.

Command line: Programming tools / Utils

Programming tools:

Indent: Useful for making C code indent properly. Splint: Similar to lint, is available in cygwin, but has not (yet) been used by MDL. cvs/rcs, are available but have not (yet) been used by MDL.

Version control systems:

File utils:

diff / patch, head / tail / cut behave as they normally do. od does an octal dump as usual, but has some minor endian issues in its output.

Command line: Shells / Archives / Man Page

Cygwin comes with bash and tcsh.

Evaluation branch has done several cygwin bash scripts (primarily for NDFD verification purposes). Note: Sometimes MS-Windows paths (c:\windows) can cause confusion. It is useful to know that c:/windows = c:\windows = /cygdrive/c/windows.
tar / gzip / bzip all behave similarly to the standard UNIX tools (no need for winzip)

Archive tools

Man Pages

Command line tools: Interpreters

expect: This is an extension to Tcl/Tk that assists with automating tasks that require user input.

tclsh: Used when dealing with a complicated script that can not be done easily in bash. Examples:

Evaluation branch uses it primarily for automating anonymous ftp sessions. Also used for multiple scp sessions where the password is the same and we want to enter it once. Need to manipulate time. Need to use a C extension to Tcl. Testing CGI scripts Testing CGI scripts

perl:

python

Command line tools: Editors

Editors:

Easy copy / paste (rxvt):


vim pico (if you install pine) emacs The standard cygwin interface is through the cygwin.bat program which provides a MS-DOS command prompt interface. The rxvt terminal doesnt, which allows it to enable highlighting, and middle button pasting to the MS-Windows clipboard

Cron jobs

One can use this to run jobs at specific times (if the computer is on). Evaluation branch uses this for updating the extra-tropical storm surge web site (www.nws.noaa.gov/mdl/etsurge) every 2 hours.

GUI tools

Standard desktops: fvwm / twm The evaluation branch tends to avoid the GUI aspects of Cygwin as it takes time to bring up. However both xv and ghostscript have been used from time to time. Xemacs is available (has not been used)

Extending Cygwin

KDE

A very good desktop environment that works with cygwin


Cygwin does not come with ImageMagick, but the Evaluation branch has managed to compile it in Cygwin. Cygwin does not come with GrADS, but the Evaluation branch has managed to install GrADS, either by compiling it, or configuring it for Cygwin. Creates CD images without reliance on Joliet (MSWindows) standard (so it can be read by HP systems)

ImageMagick

GrADS

Mkisofs