我如何更改目录并通过终端显示我留在主目录命令行?

Ras*_*han -1 command-line

如果我想更改目录并且终端显示默认目录保留,

当更改目录khan@raselkhan:~$ cd '/media/khan/Development/Express' 然后在下面显示我

khan@raselkhan:/media/khan/Development/Express$
Run Code Online (Sandbox Code Playgroud)

但是,我想要目录更改(/media/khan/Development/Express)并且终端显示我喜欢khan@raselkhan:~$目录

我该如何解决这个问题?

αғs*_*нιη 5

编辑您的.bashrc文件 ( gedit ~/.bashrc) 并将您的 PS1 更改为如下所示或将其添加到文件末尾:

PS1='\u@\h:~\$ '
Run Code Online (Sandbox Code Playgroud)

保存文件,关闭并重新打开终端或再次获取它(. ~/.bashrcsource ~/.bashrc)并查看更改。

\u - username of the current user (= $LOGNAME),
\h - the name of the computer running the shell (hostname),
\$ - display "$" for normal users and "#" for the root,
@  - display "@"
~  - display "~"
Run Code Online (Sandbox Code Playgroud)