How do I make the apple terminal window auto change colour scheme when I ssh to a specific server

前端 未结 10 1794
甜味超标
甜味超标 2020-12-12 12:58

When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am

10条回答
  •  独厮守ぢ
    2020-12-12 13:40

    You should change the color of username and host machine name.

    add the following line to your ~/.bash_profile file:

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

    The first part (purple colored) is what you're looking for.

    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

提交回复
热议问题