linux终端缩短当前目录名
vim ~.bashrc
搜索带PS1的那几行,把w替换为W
1 if [ "$color_prompt" = yes ]; then
2 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
3 else
4 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
5 fi
6 unset color_prompt force_color_prompt
7
8 # If this is an xterm set the title to user@host:dir
9 case "$TERM" in
10 xterm*|rxvt*)
11 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \W\a\]$PS1"
12 ;;
2 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
3 else
4 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
5 fi
6 unset color_prompt force_color_prompt
7
8 # If this is an xterm set the title to user@host:dir
9 case "$TERM" in
10 xterm*|rxvt*)
11 PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \W\a\]$PS1"
12 ;;
重启后就生效了。