
在命令列中,長目錄路徑可能會佔據整行:
類似的問題也被問過:
採取的步驟:
- 在 Debian 中找到 .bashrc 文件
/etc/bash.bashrc
- 從終端機中的 /etc 目錄:
sudo gedit bash.bashrc
- 找到該行:
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
- 將小寫“w”改為大寫“W”(粗體):
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\瓦\$ '
- 保存(如 sudo)並重新載入 .bashrc 文件暫時解決了問題,但在新的終端機視窗中沒有解決。顏色也會改變(綠色和藍色被淘汰,所有文字都變成白色)
答案1
您可能有自己的PS1
定義~/.bashrc
(除非您是 root)覆蓋系統範圍/etc/bash.bashrc
(沒有顏色)。你應該PS1
在那裡編輯。
在我看來,~/.bashrc
這些PS1
東西看起來像這樣(預設的 Debian 延伸):
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
第一個定義是帶有顏色的定義。換成你的\w
,你應該會很好。\W
~/.bashrc