修改之前
wxd@ubuntu:/mnt/hgfs/share/mytest/shell/$
修改
打开配置文件
sudo vi ~/.bashrc
底行模式查找 PS1
/PS1
按 n 找到以下位置,并注释/备份原来的。
替换并修改(注意w的大小写)
52 if [ "$color_prompt" = yes ]; then
53 # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
54 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
55 else
56 # PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
57 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
保存并退出后,使文件生效
source ~/.bashrc
修改后效果
只显示当前路径,便捷
wxd@ubuntu:shell$