How to suppress (or customize) Mac Terminal shell prompt

前端 未结 4 1150
南方客
南方客 2021-01-29 21:53

Currently in my Terminal, every shell prompt looks like ComputerName: FooDir UserName$. The UserName part simply wastes too much space out of my precio

4条回答
  •  無奈伤痛
    2021-01-29 22:36

    Here's an excellent article with a full list of Variables and Colors:

    Customize your Shell Command Prompt

    For a simple, minimalistic prompt, you can try this. Add the following line to your .bash_profile or simply test it first by running it in your terminal:

    export PS1="\[\033[0m\]\w\$ "
    

    It'll look something like this:

    Simple Terminal Prompt

    Here's my Prompt (source), also very simple:

    export PS1="\[\033[1;97m\]\u: \[\033[1;94m\]\w \[\033[1;97m\]\$\[\033[0m\] "
    

    enter image description here

提交回复
热议问题