Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

Ubuntuのターミナル表示を変更する。

Ubuntuはデフォルトでも楽に使える反面いろいろお節介を焼いてくれる場合があります。

たとえば、デフォなら

$PS1="[\W]"

だけで変更できる端末表示変更も受け付けません。。

Ubuntuの場合は.bashrcを弄ることで対処します。

# line 62
if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00\
m\]:\[\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

ここのPS1=以下を変更してあげれば完了です。