Cygwin安装及简单说明

1 简介

官方说明:Cygwin is a Linux-like environment for Windows. It consists of a DLL (cygwin1.dll), which acts as an emulation layer providing substantial POSIX (Portable Operating System Interface) system call functionality, and a collection of tools, which provide a Linux look and feel. The Cygwin DLL works with all x86 and AMD64 versions of Windows NT since Windows XP SP3. The API follows the Single Unix Specification as much as possible, and then Linux practice. The major differences between Cygwin and Linux is the C library (newlib instead of glibc).

简单的说:Cygwin是一个在Windows系统下运行的仿Linux环境。通过它就可以执行POSIX标准的系统调用函数,而不需要去安装一个Linux系统。

官方地址:Cygwin

官方用户文档:Cygwin User's Guide

2 安装

首先从官网下载安装文件,这里以64位系统进行说明。

image-20210428142853779

下载完整后,点击安装,直接选择下一步,选择安装模式,我这里选择从网络安装。

image-20210428143158875

接下来,选择安装路径,然后选择下载文件存放路径。

接着选择配置网络模式,我选择的是直连网络。

image-20210428143556299

接下来,选择从哪个网址下载,选择默认的即可。

image-20210428143642828

接下来选择安装哪些组件,默认装了base的组件。

image-20210428144123983

建议装上Vim、GCC、GDB。可直接搜索组件。

image-20210428144316510

image-20210428144422070

image-20210428145928174

接下来,继续点击下一步,等待安装完成即可。

3 简单的使用

安装完成后,点击图标,启动。

image-20210428144559659

启动终端之后,默认进入的是home/用户名 目录,这个目录是在安装Cygwin的同级目录下。这个目录下有很多其它目录,和真实安装一个Linux系统的目录结构差不多。

image-20210428145647780

进入磁盘命令:

$ cd f:/	

使用vim编写简单的示例代码:

$ vim test.c

使用GCC编译代码:

$ gcc test.c -o test.exe

执行test.exe:

$ ./test.exe

使用ssh连接远程终端:

$ ssh grace@192.168.17.128

使用scp拷贝其它Linux系统的文件:

$ scp grace@192.168.17.128:/home/grace/c/a.out ./

还有很多其它的命令及使用方式,可参考官方文档。

posted @ 2021-04-28 16:08  zhengcixi  阅读(1689)  评论(0编辑  收藏  举报
回到顶部