打造完美的cygwin环境
用惯了linux,在windows里边操作,总感觉到处受阻,因此,需要有一款类似于linux的东东,让你在windows里边也能手指如飞,快速实现你的想法。cygwin就是这样的一款软件,稍微加以打磨,你就可以在windows里边手指如飞,能量满满。
1 安装
安装地址是:
https://cygwin.com/install.html
为了加快软件安装速度,配置一下国内镜像:http://mirrors.163.com/cygwin/
2 安装软件
安装一个apt-cyg后,就可以像使用apt一样在cygwin里边安装软件了。
apt-cyg主页:
https://github.com/transcode-open/apt-cyg/
安装方法:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg install apt-cyg /bin
3 使用ssh
windows10默认有了ssh客户端,虽然在cmd里边运行是ok的,但是在cygwin里边用的话,会提示报错,需要新装一个。
错误提示内容为:
Pseudo-terminal will not be allocated because stdin is not a terminal.
新装一个ssh命令:
apt-cyg install openssh
安装后,关闭cygwin,重新进入即可正常使用ssh。
4 修改配置
在cygwin窗口左上角的图标,点击右键,选择Options…菜单,即可进行相关的配置了。
5 使用tab
默认的cygwin是不支持tab的。可以使用第三方工具fatty来支持新建tab。
https://github.com/juho-p/fatty
安装该软件依赖于下面的组件:
- gcc-g++
- make
- w32api-headers
- git
如果通过apt-cyg装不上,则需要用到cygwin的安装文件来安装了。
git clone https://github.com/juho-p/fatty.git cd fatty make cp src/fatty.exe /bin
要实现彩色输出,需要在~/.bashrc
加入下面的配置:
# Some shortcuts for different directory listings alias ls='ls -hF --color=tty' # classify files in colour alias dir='ls --color=auto --format=vertical' alias vdir='ls --color=auto --format=long' alias ll='ls -l' # long list alias la='ls -A' # all but . and .. alias l='ls -CF' #
增加一个快捷方式,内容如下,使得可以直接双击打开支持tab的cygwin窗口。
C:\cygwin64\bin\fatty.exe -i /Cygwin-Terminal.ico -
打开新窗口的快捷键是ctrl
+shift
+t
,当然,点击右键,也是能看到”New tab”的菜单的。
最终效果如下: