更改shell提示行

更改shell提示行


Table of Contents

  • 1 通过$PS1更改
  • 2 通过~/.bashrc更改


1 通过$PS1更改


$PS1表示bsah提示符,通常情况下都是PS1='${debianchroot:+($debianchroot)}\u@\h:\w\$ '。


其中\u表示目前的用户名,\h表示当前主机名,\w表示当前目录,\$表示如果非root则显示$,root显示#。


在终端输入export $PS1='…'就可实现更改shell提示符。但是这种更改在下次重新启动的时候就会恢复。


2 通过~/.bashrc更改


在~/.bashrc中有这么一段,将其中的东西更改为你需要的即可,可长久保存。


if [ "$color_prompt" = yes ]; then
#    将原提示符更改目前的提示符,如果不合适可将注释行去掉。
#    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
#
#   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    PS1='${debian_chroot:+($debian_chroot)}\w\$ '
fi




Date: 2012-08-05 日

Author: lishuo

Org version 7.9.1 with Emacs version 23

Validate XHTML 1.0

你可能感兴趣的:(Debian,XHTML,shell,table,emacs,终端)