cygwin

最後更新: 2018-05-19

介紹

A large collection of GNU and Open Source tools

cygwin provide functionality similar to a Linux distribution on Windows

A DLL (cygwin1.dll) which provides substantial POSIX API functionality.

目錄

 


Install

 

# 32bit

https://cygwin.com/setup-x86.exe

# 64bit

https://cygwin.com/setup-x86_64.exe

* Only the minimal base packages

Setup accept command-line arguments

-C --categories                   Specify entire categories to install
-L --local-install                Install from local directory
-l --local-package-dir            Local package directory
-B --no-admin                     Do not check for and enforce running as Administrator
-q --quiet-mode

Default Install Path: "C:\cygwin" OR "C:\cygwin64"

 


cygcheck Usage

 

cygcheck - List system information, check installed packages, or query package database.

Check Version

cygcheck -V

cygcheck (cygwin) 1.7.32

# List Only (no verify)

-d, --dump-only

# show installed version of PACKAGE and verify integrity

-c, --check-setup

cygcheck -c

Cygwin Package Information
Package                  Version            Status
_autorebase              000229-1           OK
_update-info-dir         00316-1            OK
alternatives             1.3.30c-10         OK
base-cygwin              3.3-1              OK
base-files               4.2-3              OK
bash                     4.1.11-2           OK

# produce diagnostic system information (implies -c -d)

-s, --sysinfo

cygcheck -s

Cygwin Configuration Diagnostics
Current System Time: Sun Sep 21 09:00:55 2014

Windows 7 Ultimate Ver 6.1 Build 7601 Service Pack 1

Path:   C:\cygwin64\usr\local\bin
        C:\cygwin64\bin
        C:\Program Files (x86)\AMD APP\bin\x86_64
        C:\Program Files (x86)\AMD APP\bin\x86
        C:\Windows\system32
        C:\Windows
        C:\Windows\System32\Wbem
        C:\Windows\System32\WindowsPowerShell\v1.0
        C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static
        C:\Python27

Output from C:\cygwin64\bin\id.exe
UID: 1000(tim)      GID: 513(None)
513(None)           0(root)             544(Administrators) 545(Users)
1001(HomeUsers)

SysDir: C:\Windows\system32
WinDir: C:\Windows

USER = 'tim'
PWD = '/home/tim'
HOME = '/home/tim'

Use '-r' to scan registry

...............................................

 


Usage Example

 

Call a Shell

C:\cygwin64\bin\mintty.exe

Package List

# 有什麼 package 可以安

http://cygwin.com/packages/

# list contents of PACKAGE

-l, --list-package

# search

-p, --package-query REGEXP

# 找出某 file 屬於那 package

-f, --find-package <file>

 


Automated Cygwin installation

 

# -l downloaded package tree

setup-x86_64.exe -q -L -l x:\cygwin-local\

Help

setup-x86.exe --help

Opts

-q, --quiet
-X --no-verify                    
-n --no-shortcuts
-N --no-startmenu
-d --no-desktop

-D --download                 # Download from internet
-s --site

-L --local-install                # Install from local directory
-l --local-package-dir

-P --packages                  # Specify packages to install

Script:

SET SITE=http://cygwin.mirrors.pair.com/
SET LOCALDIR=%CD%
SET ROOTDIR=C:/cygwin
SET PACKAGES=rsync,wget

setup --quiet-mode --no-desktop --download --local-install --no-verify -s %SITE% -l "%LOCALDIR%" -R "%ROOTDIR%" -P %PACKAGES%

 


cygwin install package command line

 

# install rsync

setup-x86_64.exe -q -P rysnc

 


Cygwin service

 

# List all services

cygrunsrv -L

# stop

cygrunsrv --stop service_name

# remove

cygrunsrv --remove service_name

Cygserver

designed to run as a background service.

It provides Cygwin applications with services

 


Windows and UNIX paths

 

# convert between Windows and UNIX paths

cygpath --unix C:/cygwin/bin/ls.exe

/usr/bin/ls.exe

 


Folder Path

 

# Windows                                    # Cygwin

C:\WORK\*          -->           /cygdrive/c/work/*

 


Bundle Cygwin with my product for free

 

If you ship applications that link with cygwin1.dll,

you must either provide those applications' source code under a GPL-compatible license,

or purchase a cygwin license from Red Hat.

 



Package

 

Core Package

  •  

常用 Package

  • rsync
  •  

 


Other

 

 


Old Version

 

Note that Cygwin version 2.5.2 was the last version supporting Windows XP and Server 2003.

The last version of Setup.exe to support XP is 2.874

Run setup*.exe with the -X option, using the following mirror:

-X --no-verify                    Don't verify setup.ini signatures

Go to the time machine top-level

32-bit version

http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/index.html

64-bit version

http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/index.html

These represent the revisions of Cygwin as of the date shown.

The URLs on the right side of the table are meant to be used as a package source path when you run setup.exe.

 


DOC

https://cygwin.com/cygwin-ug-net/using-utils.html

 

 

Creative Commons license icon Creative Commons license icon