else
##    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
      PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
 ##   PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
      PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \W\a\]$PS1"
     ;;
*)
    ;;
esac

保存,执行下面的命令或重启终端

$ source ~/.bashrc

执行上面步骤后,在终端页就短路径显示当前路径了。

本文地址: Ubuntu 14 下,命令行终端显示短路径