daqingshu
西双版纳
freebsd下面提供的shell默认是csh,用户体验很不好。很多人更加习惯linux下的bash可以使用下面的方式更换shell。

  1. 更改用户的shell为bash:

  通过chsh命令来更改。注意,如果通过ports方式安装的bash,其目录在/usr/local/bin/bash

  安装bash:

  cd /usr/ports/shell/bash2

  make

  make install clean

  改用bash: chsh -s /usr/local/bin/bash

  复原csh:chsh -s /bin/csh

  如果需要csh正常支持中文显示等,就需要修改配置文件了。现提供两种方式下的配置文件:

  1.tcsh配置文件

  引用

  # /etc/cshrc ~/.cshrc

  alias h history 25

  alias j jobs -l

  alias la ls -a

  alias lf ls -FA

  alias ll ls -lA

  # A righteous umask

  umask 22

  set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin)

  #让 ls 命令显示目录的时候带 / 斜杠区分普通文件

  alias ls ls -FG

  set prompt='%B%n%b@%U%m%u %S%/%s\ %# '

  set prompt2="%R?"

  set prompt3="CORRECT> %B%R%b (y|n|e)?"

  #设置命令补全

  set autolist

  #合并多连接状态的历史

  set history=2048

  set savehist = 2048 merge

  # 让中文显示在终端上正确显示

  setenv LANG en_US.ISO8859-1

  setenv LC_ALL en_US.ISO8859-1

  setenv EDITOR vi

  setenv PAGER more

  setenv BLOCKSIZE K

  if ($?prompt) then

  # An interactive shell -- set some stuff up

  #set prompt = "`/bin/hostname -s`# "

  set filec

  #set history = 100

  #set savehist = 100

  set mail = (/var/mail/$USER)

  if ( $?tcsh ) then

  bindkey "^W" backward-delete-word

  bindkey -k up history-search-backward

  bindkey -k down history-search-forward

  endif

  endif

  2Bash配置文件

  引用

  #/etc/profile ~/.profile

  alias ll='ls -FAl'

  LANG=en_US.ISO8859-1

  LC_ALL=en_US.ISO8859-1

  # 提示符: [username@hostname /path/to/current/dir/]

  PS1="[\u@\h \w]\\$ "

  export LANG LC_ALL PS1

NetBSD 使用 ' /etc/rc.conf ' 作为系统设定的开始,这个档案决定了在系统开机时,要执行什么程序和

  命令。了解这个档案的作用及掌握正确的配置是非常重要的。

  要查看详细的文档,请使用man手册:

  # man rc.conf

  3:中文环境;

  3.1:3.1:设置适合中文环境的 locale;

  通过执行 'locale' 命令可以查看当前系统的 ' locale' 变量设置。一般中文用户所必须的一个变量是

  LC_CTYPE

  为了使用中文,所以我们将它设置为 ' zh_CN.eucCN '。

  3.1.1:使用 '/bin/ksh'的用户;

  如果你使用的shell是 ' /bin/ksh ',那么把这一句添加到 ' ~/.profile ' 中:

  export LC_CTYPE='zh_CN.eucCN'

  3.1.2:使用 ' /bin/csh ' 的用户;

  如果你使用的shell是 ' /bin/csh ',那么把这一句添加到 ' ~/.cshrc ' 中:

  setenv LC_CTYPE 'zh_CN.eucCN'

  注:locale需要在系统重新启动之后才能生效。

  重启之后可以通过执行 ' locale '命令看到修改的变量是否生效。

posted on 2008-01-06 00:31  Edvard  阅读(598)  评论(0)    收藏  举报