通过查询,找到一种简单的处理方式,就是讲如下代码加到~/.bashrc的最后位置。
(一)修改title名字
1 title 通过添加来实现
vim ~/.bashrc
function set-title() {if [[ -z "$ORIG" ]]; thenORIG=$PS1fiTITLE="\[\e]2;title的名字\a\]"PS1=${ORIG}${TITLE}}set-title
2 直接改~/.bashrc文件。
case "$TERM" inxterm*|rxvt*)PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@title的名字: \w\a\]$PS1";;*);;esac

(二)修改命令行的名字
vim ~/.bashrc
if [ "$color_prompt" = yes ]; thenPS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\命令行的名字\[033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ 'elsePS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ 'fi
source ~/.bashrc
