How to suppress (or customize) Mac Terminal shell prompt

前端 未结 4 1118
南方客
南方客 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:32

    2019 onwards, MacOS default shell is Z Shell. To customize command prompt, add a file named .zshrc in user home and put following line that sets a PS1 environment variable with desired prompt format:

    export PS1="[%n]%~> "
    

    Open new terminal

    This is result of following format expansion:

    • %n User name
    • %~ Current directory

    See full list of available expansions here.

提交回复
热议问题