(轉)cygwin個人化配置

來源:互聯網
上載者:User

標籤:

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 中的服務程式

  • 配置 apache httpd2 服務
  • 配置 proftpd 服務
  • 配置應用程式
    • 配置rxvt
    • 定製特色的提示符
    • 定義環境變數
  • bash設定檔
    • ~/.bashrc
    • ~/.inputrc
配置 cygwin 中的服務程式^

詳細情況閱讀 /usr/share/doc/Cygwin/cygserver.README,要讓一個apache httpd或者 proftpd成功運行,在winxp下:

  • 需要把 /bin/cygrunsrv 以 LocalSystem 的身份設定為系統服務,最簡單的方法就是運行 指令碼 /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-RxvtRxvt*geometry:          90x40-10+30Rxvt*background:        #BFDF74Rxvt*foreground:        #001123Rxvt*scrollBar_right:   trueRxvt*colorBD:           1Rxvt*font:              courier newRxvt*blodFont:          Courier NewRxvt*saveLines:         2000Rxvt.backspacekey:      ^?Rxvt*loginShell: True!! VIM-like colorsRxvt*color0:    #000000!Rxvt*color1:   #FFFFFFRxvt*color1:    #911B08Rxvt*color2:    #00A800Rxvt*color3:    #DD0000Rxvt*color4:    #0000A8Rxvt*color5:    #A800A8Rxvt*color6:    #00A8A8Rxvt*color7:    #D8D8D8Rxvt*color8:    #B5613BRxvt*color9:    #966BEBRxvt*color10:   #00A800Rxvt*color11:   #FFFF00Rxvt*color12:   #0000A8Rxvt*color13:   #A800A8Rxvt*color14:   #00A8A8Rxvt*color15:   #B5613B

把下邊這段寫入 cygwin.bat:

@echo offset CYGWIN=serverset HOME=d:\MyDocd:chdir d:\cygwin\binrxvt -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` in0) PS1="${PS1}# ";;*) PS1="${PS1}$ ";;esac
定義環境變數^

設定locale為Windows的預設locale,否則中文檔案名稱會顯示亂碼:

LC_CTYPE=zh_CN.gbkCHARSET=GBKexport LC_CTYPE CHARSET
bash設定檔^~/.bashrc^
# -*- coding: chinese-gbk -*LC_CTYPE=zh_CN.gbkCHARSET=GBK #glib2需要使用找個環境變數確定檔案名稱的編碼export LC_CTYPE CHARSETexport LESSCHARSET=latin1export INPUTRC=$HOME/.inputrcexport TERM=rxvt# aliasalias 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 charactersalias whence=‘type -a‘                        # where, of a sortalias grep=‘grep --color‘                     # show differences in colour# Some shortcuts for different directory listingsalias ls=‘ls -hF --color=tty --show-control-chars‘                 # classify files in colouralias 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 listalias 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/outputset meta-flag on# 關閉bash命令列8位元組字元轉義符的轉換set convert-meta off# 使bash命令列支援8位元組字元輸入set input-meta on# 使bash命令列支援8位元組字元輸出set output-meta on

(轉)cygwin個人化配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.