Can I change the input color of my bash prompt to something different than the terminal default

后端 未结 4 473
醉话见心
醉话见心 2020-12-03 15:38

My default terminal color is gray, that\'s fine.

My bash prompt displays a bunch of colors, this works fine:

PS1=\"${COLOR_RED}\\u${COLOR_WHITE}@${CO         


        
4条回答
  •  萌比男神i
    2020-12-03 16:07

    Simply add the following line:

    export PS1=" \[\033[34m\]\u@\h \[\033[33m\]\w\[\033[31m\]\[\033[00m\] $ "
    

    Preview:

    This is my preferred colors. You can customize each part of prompt's color by changing m codes (e.g. 34m) which are ANSI color codes.

    List of ANSI Color codes:

    • Black: 30m
    • Red: 31m
    • Green: 32m
    • Yellow: 33m
    • Blue: 34m
    • Purple: 35m
    • Cyan: 36m
    • White: 37m

提交回复
热议问题