天天看點

linux不顯示使用者名和檔案,Linux終端不再顯示目前使用者名和檔案目錄

Linux終端不再顯示目前使用者名和路徑

為了在虛拟機上安裝VASP,我們首先要在centOS虛拟機上安裝Intel編譯包。安裝成功以後,重新開機虛拟機,打開終端,出現了目前使用者名和路徑不顯示的問題,如下所示:

Intel(R) Parallel Studio XE 2019 Update 1 for Linux*

Copyright (C) 2009-2018 Intel Corporation. All rights reserved.

ls

anaconda-ks.cfg Documents initial-setup-ks.cfg Music Public Videos

Desktop Downloads log.lammps Pictures Templates

# 打開終端

# 輸入指令,編輯.bash_profile檔案

vim ~/.bash_profile

# 再檔案的最後一行加上:

export PS1=‘[\[email protected]\h \W]\$‘

# 儲存更改并傳回終端,輸入指令:

source ~/.bash_profile

# Linux終端成功恢複!

Intel(R) Parallel Studio XE 2019 Update 1 for Linux*

Copyright (C) 2009-2018 Intel Corporation. All rights reserved.

[[email protected] ~]#

然而,上述方法隻能使目前終端顯示路徑,每打開一個終端,都需要執行一次"source ~/.bash_profile",非常不友善。為了讓終端預設打開,我們可以将上述指令添加到".bashrc"檔案中,如下所示

# 打開終端

# 輸入指令,編輯.bashrc檔案

vim .bashrc

# 再檔案的最後一行加上:

export PS1=‘[\[email protected]\h \W]\$‘

# 儲存更改并傳回終端,輸入指令:

source .bashrc

# Linux終端成功恢複!

Intel(R) Parallel Studio XE 2019 Update 1 for Linux*

Copyright (C) 2009-2018 Intel Corporation. All rights reserved.

[[email protected] ~]#

wuhu~

原文:https://www.cnblogs.com/fengxiaoqiang/p/14089126.html