Transcription of Cygwin User’s Guide - Lawrence Berkeley National …
1 Cygwin user s GuideCygwin user s GuideCopyright 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, of Contents1. Cygwin What is it?.. Quick Start Guide for those more experienced with Quick Start Guide for those more experienced with Are the Cygwin tools free software?.. A brief history of the Cygwin Highlights of Cygwin Supporting both Windows NT and Permissions and File Text Mode vs. Binary ANSI C Process Setting Up Internet Download Selecting an Install Local Package Connection Choosing Choosing Download and Installation Post-Install Environment Changing Cygwin s Maximum NT security and usage NT Process File NT SIDs in The mapping The ACL New setuid Switching user Special values of user and group Customizing Using Mapping path The Cygwin Mount Additional Path-related Text and Binary The The default Cygwin Binary or text?
2 File Special DOS POSIX The .exe The /proc The The Cygwin environment What is Cygserver?.. Cygserver command line How to start How to use the Cygserver The Cygserver configuration Cygwin Using Cygwin effectively with Console Cygwin and Windows The cygutils Creating shortcuts with Printing with Programming with Using GCC with Console Mode GUI Mode Debugging Cygwin Building and Using Building Linking Against Defining Windows of Examples2-1. / / /etc/passwd:..212-4. /etc/group:..212-5. / / Displaying the current set of mount Using Using the kill Setting up the groups file for local Setting up the passwd file for local Using an alternate home Displaying the current set of mount Adding mount Changing the default Building Hello World with Compiling with "break" in Debugging with command line 1.
3 Cygwin What is it? Cygwin is a Linux-like environment for Windows. It consists of a DLL ( ), which acts asan emulation layer providing substantial POSIX ( #POSIX) (Portable OperatingSystem Interface) system call functionality, and a collection of tools, which provide a Linux look andfeel. The Cygwin DLL works with all x86 versions of Windows since Windows 95. The API follows theSingle Unix Specification ( ) as much aspossible, and then Linux practice. Two other major differences between Cygwin and Linux are the Clibrary (newlibinstead ofglibc) and default/bin/sh, which isashon Cygwin butbashon most Cygwin installed, users have access to many standard UNIX utilities. They can be used from one ofthe provided shells such asbashor from the Windows Command Prompt.
4 Additionally, programmersmay write Win32 console or GUI applications that make use of the standard Microsoft Win32 APIand/or the Cygwin API. As a result, it is possible to easily port many significant UNIX programs withoutthe need for extensive changes to the source code. This includes configuring and building most of theavailable GNU software (including the development tools included with the Cygwin distribution). Quick Start Guide for those more experienced withWindowsIf you are new to the world of UNIX, you may find it difficult to understand at first. This Guide is notmeant to be comprehensive, so we recommend that you use the many available Internet resources tobecome acquainted with UNIX basics (search for "UNIX basics" or "UNIX tutorial").
5 To install a basic Cygwin environment, run and clickNextat each page. Thedefault settings are correct for most users. If you want to know more about what each option means, seeSection time you want to update or install a Cygwin package. If you are installingCygwin for a specific purpose, use it to install the tools that you need. For example, if you want tocompile C++ programs, you need the gcc-g++ package and probably a text editor like nano. , clicking on categories and packages in the package installation screen will provideyou with the ability to control what is installed or option is to install everything by clicking on theDefaultfield next to , be advised that this will download and install several hundreds of megabytes of software toyour computer.
6 The best plan is probably to click on individual categories and install either entirecategories or packages from the categories themselves. After installation, you can find Cygwin -specificdocumentation in the/usr/share/doc/ 1. Cygwin OverviewDevelopers coming from a Windows background will find a set of tools capable of writing console orGUI executables that rely on the Microsoft Win32 API. Thedlltoolutility may be used to write WindowsDynamically Linked Libraries (DLLs). The resource compilerwindresis also provided. All tools maybe used from the Microsoft command prompt, with full support for normal Windows Quick Start Guide for those more experienced withUNIXIf you are an experienced UNIX user who misses a powerful command-line environment, you will enjoyCygwin.
7 Note that there are some workarounds that cause Cygwin to behave differently than mostUNIX-like operating systems; these are described in more detail inSection time you want to update or install a Cygwin package, use the Bydefault, installs a minimal set of packages, so look around and choose your favoriteutilities on the package selection screen. You may also search for specfic tools on the Cygwin website sSetup Package Search ( ) For more information about what each option , seeSection option is to install everything by clicking on theDefaultfield next to , be advised that this will download and install several hundreds of megabytes of software toyour computer. The best plan is probably to click on individual categories and install either entirecategories or packages from the categories themselves.
8 After installation, you can find Cygwin -specificdocumentation in the/usr/share/doc/ coming from a UNIX background will find a set of utilities they are already comfortableusing, including a working UNIX shell. The compiler tools are the standard GNU compilers most peoplewill have previously used under UNIX, only ported to the Windows host. Programmers wishing to portUNIX software to Windows NT or 9x will find that the Cygwin library provides an easy way to portmany UNIX packages, with only minimal source code Are the Cygwin tools free software?Yes. Parts are GNU ( ) software (gcc,gas,ld, etc.), parts are covered by the standardX11 license ( ), some of it is public domain, some of it waswritten by Red Hat and placed under the GNU General Public License( ) (GPL).
9 None of it is shareware. You don t have to pay anyone touse it but you should be sure to read the copyright section of the FAQ for more information on how theGNU GPL may affect your use of these tools. If you intend to port a proprietary application using theCygwin library, you may want the Cygwin proprietary-use license. For more information about theproprietary-use license, please go to ( ). Customers of the native Win32 GNUPro should feel2 Chapter 1. Cygwin Overviewfree to submit bug reports and ask questions through the normal channels. All other questions should besent to the project mailing list A brief history of the Cygwin projectNote:A more complete historical look Cygwin is Geoffrey J. Noer s 1998 paper, "Cygwin32: A FreeWin32 Porting Layer for UNIX Applications" which can be found at the 2nd USENIX Windows NTSymposium Online Proceedings( ).
10 Cygwin began development in 1995 at Cygnus Solutions (now part of Red Hat Software). The first thingdone was to enhance the development tools (gcc,gdb,gas, etc.) so that they could generate and interpretWin32 native object files. The next task was to port the tools to Win NT/9x. We could have done this byrewriting large portions of the source to work within the context of the Win32 API. But this would havemeant spending a huge amount of time on each and every tool. Instead, we took a substantially differentapproach by writing a shared library (the Cygwin DLL) that adds the necessary UNIX-like functionalitymissing from the Win32 API (fork,spawn,signals,select,sockets, etc.). We call this newinterface the Cygwin API. Once written, it was possible to build working Win32 tools usingUNIX-hosted cross-compilers, linking against this this point, we pursued the goal of producing native tools capable of rebuilding themselves underWindows 9x and NT (this is often called self-hosting).