bash隐藏当前工作目录

详细教程:https://blog.csdn.net/xjwJava/article/details/8687969

查看当前的设置:

echo $PS1

我的结果:

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

然后把里面的\w去掉就好了:

export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\[\033[00m\]\$"

效果:

searchstar@searchstar-PC:$Command here

如果想要极致精简,可以这样:

export PS1="$ "

效果:

$ Command here

相关链接:https://askubuntu.com/questions/16728/hide-current-working-directory-in-terminal

posted @ 2024-09-28 14:11  寻找繁星  阅读(0)  评论(0编辑  收藏  举报