
コマンドラインでは、長いディレクトリ パスが行全体を占める場合があります。
同様の質問が寄せられています:
実行された手順:
- 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
定義が(rootでない限り)あるでしょう。そこで編集する必要があります。~/.bashrc
/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