📄 config-howto.txt
字号:
## Users can override these settings and/or add others in their# $HOME/.bash_profile# 用户可在$HOME/.bash_profile中取消这些设定和(或)增加其他设定# set a decent path# 设定可行的路径echo $PATH | grep X11R6 > /dev/nullif [ $? = 1 ] ; then # add entries to the path PATH="$PATH:/usr/X11R6/bin:$HOME/bin:."fi# notify the user: login or non-login shell. If login, the prompt is# coloured in blue; otherwise in magenta. Root's prompt is red.# 通知用户:登录(login)或不登录(non-login)的外围程序(shell)。# 如果登录,则提示符为蓝色,否则为紫红色。Root的提示符为红色。USER=`whoami`if [ $LOGNAME = $USER ] ; then COLOUR=44else COLOUR=45fiif [ $USER = 'root' ] ; then COLOUR=41fi# put a real escape character instead of ^[# 用真正的换码字符代替^[PS1='^[[$COLOUR;37;1m$HOSTNAME:^[[37;40;1m\w\$ 'PS2="Continue> "# no core dumps, please# 请勿转储内存信息ulimit -c 0# set umask# 设定umaskif [ `id -gn` = `id -un` -a `id -u` -gt 14 ]; then umask 002else umask 022fi# a few variables# 几项变数USER=`id -un`LOGNAME=$USERMAIL="/var/spool/mail/$USER"EDITOR=jedHOSTNAME=`/bin/hostname`HISTSIZE=1000HISTFILESIZE=1000export PATH PS1 PS2 USER LOGNAME MAIL EDITOR HOSTNAME HISTSIZE HISTFILESIZE# enable colour ls# 设定ls的颜色eval `dircolors /etc/DIR_COLORS -b`export LS_OPTIONS='-F -s -T 0 --color=tty'# customize less# 设定lessLESS='-M-Q'LESSEDIT="%E ?lt+%lt. %f"LESSOPEN="| lesspipe.sh %s"VISUAL=jedLESSCHARSET=latin1export LESS LESSEDIT LESSOPEN VISUAL LESSCHARSET# customise the keyboard# 设定键盘/sbin/kbdrate -s -r 16 -d 500for i in /etc/profile.d/*.sh ; do if [ -x $i ]; then . $i fidone _________________________________________________________________ 此处为 /etc/bashrc: _________________________________________________________________ # /etc/bashrc# System wide functions and aliases# 整个系统的功能和别名## Environment stuff goes in /etc/profile# /etc/profile中的环境参数#alias which="type -path"alias d="ls"alias dir="d" _________________________________________________________________ 此处为 .bashrc: _________________________________________________________________ # $HOME/.bashrc# Source global definitionsif [ -f /etc/bashrc ]; then . /etc/bashrcfi# this is needed to notify the user that they are in non-login shell# 需要以下设定,以便通知处於不登录(non-login)外围程序(shell)中的用户COLOUR=45# put a real escape character instead of ^[# 用真正的换码字符代替^[PS1='^[[$COLOUR;37m$USER:^[[37;40m\w\$ '# aliases# 别名alias cp='cp -i'alias l=lessalias lyx='lyx -width 900 -height 700'alias mv='mv -i'alias rm='rm -i'alias x=startx# A few useful functions# 几个有用的功能inst() # Install a .tar.gz archive in the current directory.{ gzip -dc $1 | tar xvf - }cz() # List the contents of a .zip archive.{ unzip -l $* }ctgz() # List the contents of a .tar.gz archive.{ for file in $* ; do gzip -dc ${file} | tar tf - done}tgz() # Create a .tgz archive a la zip.{ name=$1 ; tar -cvf $1 ; shift tar -rf ${name} $* gzip -S .tgz ${name}} _________________________________________________________________ 此处为.bash_profile: _________________________________________________________________ # $HOME/.bash_profile# User specific environment and startup programs# 用户特定的环境参数和启动程式## This file contains user-defined settings that override# those in /etc/profile# 这个文档中存有用户自订的设置,可取代/etc/profile 中的数值## Get aliases and functions# 设定别名和功能#if [ -f ~/.bashrc ]; then . ~/.bashrcfi# re-get PS1 settings# 重新设定PS1数值if [ $USER = 'root' ] ; then COLOUR=41else COLOUR=44fi# put a real escape character instead of ^[# 用真正的换码字符代替^[PS1='^[[$COLOUR;37;1m$HOSTNAME:^[[37;40;1m\w\$ 'export PS1 _________________________________________________________________ 此处为 .bash_logout: _________________________________________________________________ # $HOME/.bash_logoutclear _________________________________________________________________ 此处为 .inputrc: _________________________________________________________________ # $HOME/.inputrc# key bindings# 主要绑定"\e[1~": beginning-of-line"\e[3~": delete-char"\e[4~": end-of-line# (F1 .. F5) are "\e[[A" ... "\e[[E"# (F1 .. F5) 分别为 "\e[[A" ... "\e[[E""\e[[A": "info \C-m"set bell-style visible # please don't beep # --喇叭不发声set meta-flag On # allow 8-bit input (i.e, accented letters) # --允许8-位元输入(例如重音字符)译注:用于欧洲 # 文字或GB码及Big5码)set convert-meta Off # don't strip 8-bit characters # 不取消8-位元字符set output-meta On # display 8-bit characters correctly # 正确显示8-位元字符set horizontal-scroll-mode Onset show-all-if-ambiguous On _________________________________________________________________ 设定下列参数使 backspace 和 delete 两键在xterm 和其他X11应用中运作正常 : * 在.xinitrc中添加: usermodmap=$HOME/.Xmodmapxmodmap $usermodmap * 在.Xmodmap中添加: keycode 22 = BackSpacekeycode 107 = Delete 以上就设定了主控台的参数。 要修改xterm,则更改如下: * 在.Xdefaults中增添: xterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\ <Key>Delete: string(0x1b) string("[3~")\n\ <Key>Home: string(0x1b) string("[1~")\n\ <Key>End: string(0x1b) string("[4~")\n\ Ctrl<Key>Prior: string(0x1b) string("[40~")\n\ Ctrl<Key>Next: string(0x1b) string("[41~")nxterm*VT100.Translations: #override <Key>BackSpace: string(0x7F)\n\ <Key>Delete: string(0x1b) string("[3~")\n\ <Key>Home: string(0x1b) string("[1~")\n\ <Key>End: string(0x1b) string("[4~")\n\ Ctrl<Key>Prior: string(0x1b) string("[40~")\n\ Ctrl<Key>Next: string(0x1b) string("[41~") 在bash(1) 和 readline(3) 的man说明中有更多这方面的资料。 不要以为这些设定在每种应用中都可正常运作。例如,在xterm中运行joe,有些 键位就不起作用;运行rxvt也有相同的问题。有人说,这是termcap的问题。 3.2 ls(1) ls可显示目录,并用颜色提示不同种类的文档。要使用这项功能,则 在/etc/profile中增添以下内容: eval `dircolors /etc/DIR_COLORS -b`export LS_OPTIONS='-F -T 0 --color=tty' 这样就设定了LS_COLORS的环境参数,其中存有/etc/DIR_COLORS中的颜色变数表 。注意:这项设置对rxvt的有些版本无效,原因不明。不妨改用xterm中的一些其 他特性。可能rxvt中仍有程序错误,以致有时不能运用设定的环境参数。 3.3 less(1) 利用这个优越的页面调度程序不仅能浏览一般文字文档,也能观看压缩的gzip文 档和以tar和zip格式储存的档案文档,其设置如下: * 如要配合使用方向键,则将以下以ASCII编写的一般文字档.lesskey 置 于home目录内: ^[[A back-line^[[B forw-line^[[C right-scroll^[[D left-scroll^[OA back-line^[OB forw-line^[OC right-scroll^[OD left-scroll^[[6~ forw-scroll^[[5~ back-scroll^[[1~ goto-line^[[4~ goto-end^[[7~ goto-line^[[8~ goto-end 然後运行指令lesskey。这会生成绑定键位的二进制文档.less。 * 编制下列称为/usr/bin/lesspipe.sh的文档: _____________________________________________________________ #!/bin/sh# This is a preprocessor for 'less'. It is used when this environment# variable is set: LESSOPEN="|lesspipe.sh %s"# 此为‘less’的预处理器。当环境参数定为LESSOPEN="|lesspipe.sh %s"# 时,便起用这个预处理器。##lesspipe() { case "$1" in *.tar) tar tf $1 2>/dev/null ;; # View contents of .tar and .tgz files # 阅读.tar和.tgz档的内容 *.tgz|*.tar.gz|*.tar.Z|*.tar.z) tar ztf $1 2>/dev/null ;; *.Z|*.z|*.gz) gzip -dc $1 2>/dev/null ;; # View compressed files correctly # 正确阅读压缩文档 *.zip) unzip -l $1 2>/dev/null ;; # View archives # 阅读档案文档 *.arj) unarj -l $1 2>/dev/null ;; *.rpm) rpm -q -p -i -l $1 2>/dev/null ;; *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.man) FILE=`file -L $1` FILE=`echo $FILE | cut -d ' ' -f 2` if [ "$FILE" = "troff" ]; then groff -s -p -t -e -Tascii -mandoc $1 fi ;; *) FILE=`file -L $1` ; # Check to see if binary # 检查是否为二进制文档 FILE1=`echo $FILE | cut -d ' ' -f 2` FILE2=`echo $FILE | cut -d ' ' -f 3` if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \ -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then strings $1 fi ;; esac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -