码迷,mamicode.com
首页 > Windows程序 > 详细

(转)cygwin个性化配置

时间:2015-01-25 17:59:51      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:

http://blog.cong.co/cygwin.html#%E5%AE%9A%E4%B9%89%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F配置 cygwin 中的服务程序

配置 cygwin 中的服务程序^

详细情况阅读 /usr/share/doc/Cygwin/cygserver.README,要让一个apache httpd或者 proftpd成功运行,在winxp下:

  • 需要把 /bin/cygrunsrvLocalSystem 的身份设置为系统服务,最简单的方法就是运行 脚本 /usr/bin/cygserver-config。这将在 "Control Panel > Admin Tools > Services" 里边出现一个名为 CYGWIN cygserver 的服务项目。
  • 然后设置环境变量 CYGWIN,最简单的方法就是在 cygwin.bat 中添加一句:
    set CYGWIN=server

配置服务或应用程序之前,阅读 =/usr/share/doc= 中罗列的文档

配置 apache httpd2 服务^

配置 httpd2 很简单,直接用 setup 的安装程序安装好 httpd2。然后运行如下命令即可:
apachectl2 start
要是找不到 apachectl2,看看 /usr/sbin 有没有加入到 PATH 中。

配置 proftpd 服务^

阅读 /usr/share/doc/proftpd-1.2.10/* 下的一堆文档,按照配置来,先test。

配置应用程序^

配置rxvt^

win的cmd实在太难用了,而我又不用cygwin的X系统,所以rxvt成了我最好的选择,这里是 我的颜色配置,写入 ~/.Xdefaults 即可:

Rxvt*title:             Cygwin-Rxvt
Rxvt*geometry:          90x40-10+30
Rxvt*background:        #BFDF74
Rxvt*foreground:        #001123
Rxvt*scrollBar_right:   true
Rxvt*colorBD:           1
Rxvt*font:              courier new
Rxvt*blodFont:          Courier New
Rxvt*saveLines:         2000
Rxvt.backspacekey:      ^?
Rxvt*loginShell: True
!! VIM-like colors
Rxvt*color0:    #000000
!Rxvt*color1:   #FFFFFF
Rxvt*color1:    #911B08
Rxvt*color2:    #00A800
Rxvt*color3:    #DD0000
Rxvt*color4:    #0000A8
Rxvt*color5:    #A800A8
Rxvt*color6:    #00A8A8
Rxvt*color7:    #D8D8D8
Rxvt*color8:    #B5613B
Rxvt*color9:    #966BEB
Rxvt*color10:   #00A800
Rxvt*color11:   #FFFF00
Rxvt*color12:   #0000A8
Rxvt*color13:   #A800A8
Rxvt*color14:   #00A8A8
Rxvt*color15:   #B5613B

把下边这段写入 cygwin.bat

@echo off
set CYGWIN=server
set HOME=d:\MyDoc
d:
chdir d:\cygwin\bin
rxvt -title "Cygwin-Rxvt" -sr -sl 2000 -tn Cygwin -fn "bitstream vera sans mono-19" -e /bin/bash -login
定制特色的提示符^

~/.bashrc 或者 ~/.bash_profile 中定制特色的提示符

PS1="`whoami`@`hostname | sed ‘s/..*//‘`"
PS1="[e[32;1m]${PS1}[e[0m]:[e[31;1m]w[e[0m]n"
case `id -u` in
0) PS1="${PS1}# ";;
*) PS1="${PS1}$ ";;
esac
定义环境变量^

设置locale为Windows的默认locale,否则中文文件名会显示乱码:

LC_CTYPE=zh_CN.gbk
CHARSET=GBK
export LC_CTYPE CHARSET

bash配置文件^

~/.bashrc^
# -*- coding: chinese-gbk -*
LC_CTYPE=zh_CN.gbk
CHARSET=GBK #glib2需要使用找个环境变量确定文件名的编码
export LC_CTYPE CHARSET
export LESSCHARSET=latin1
export INPUTRC=$HOME/.inputrc
export TERM=rxvt
# alias
alias rm=‘rm -i‘
alias cp=‘cp -i‘
alias mv=‘mv -i‘
alias df=‘df -h‘
alias du=‘du -h‘
# Misc :)
alias less=‘less -r --raw-control-chars‘                          # raw control characters
alias whence=‘type -a‘                        # where, of a sort
alias grep=‘grep --color‘                     # show differences in colour
# Some shortcuts for different directory listings
alias ls=‘ls -hF --color=tty --show-control-chars‘                 # classify files in colour
alias dir=‘ls --color=auto --format=vertical --show-control-chars‘
alias vdir=‘ls --color=auto --format=long --show-control-chars‘
alias ll=‘ls -la --show-control-chars‘                              # long list
alias la=‘ls -A --show-control-chars‘                              # all but . and ..
alias l=‘ls -lF --show-control-chars‘                              #
# 添加清屏处理
alias clear=‘clearn‘
alias clr=‘clearn‘
# 添加whereis的别名
alias whereis=‘which‘
alias autoexec=autoexec.bat
~/.inputrc^

主要是加入一些中文编码支持

# -*- coding: chinese-gbk -*-
# base-files version 3.6-1
# Insert Key
"e[2~":paste-from-clipboard
# equivalent to "C-?": delete-char
"e[3~": delete-char
# VT
"e[1~": beginning-of-line
"e[4~": end-of-line
# kvt
"e[H": beginning-of-line
"e[F": end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"e[7~": beginning-of-line
"e[8~": end-of-line
# VT220
"eOH": beginning-of-line
"eOF": end-of-line
# Allow 8-bit input/output
set meta-flag on
# 关闭bash命令行8字节字符转义符的转换
set convert-meta off
# 使bash命令行支持8字节字符输入
set input-meta on
# 使bash命令行支持8字节字符输出
set output-meta on

(转)cygwin个性化配置

标签:

原文地址:http://www.cnblogs.com/zhang-pengcheng/p/4248489.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!