歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> 在freebsd下面tcsh和bash的常用配置文件

在freebsd下面tcsh和bash的常用配置文件

日期:2017/2/28 11:13:36   编辑:關於Unix


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
Copyright © Linux教程網 All Rights Reserved