文件路径太长,看着不方便。可以手动修改一下配置文件。

 

 

在用户家目录下 修改.bashrc文件

root@linux:~# vim ~/.bashrc 

 

找到

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
...
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

修改成(w换成大写W)

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
...
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '

 

立即生效

root@linux:~# source ~/.bashrc

 

搞定!

Linux终端 命令行路径缩减显示_Linux