まんま!の備忘録

ソフトウェア・ファームウェア・ハードウェア関連の備忘録

Linuxのプロンプトカラー変更

以下のコマンドを打った時の青文字部分を変更する。

cat .bashrc | grep -E "PS1" -C 2

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
--
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)

色は以下の感じ。

カラーコード 設定値
#000000 30 black
#ff0000 31 red
#00ff00 32 green
#ffff00 33 yellow
#0000ff 34 blue
#ff00ff 35 magenta
#00ffff 36 cyan
#ffffff 37 white