1

I am trying to change the prompt in my VSCode's terminal.

My OS is MacOS Monterey 12.6.

I use the zsh and I change the PS1 in .zprofile,such like this.

.zshprofile file screenshot

Then I use echo to test.The others can work except PS1.

VS Code Terminal screenshot

How to change the prompt?Is there any simple way?

2
  • Please don’t put text (the .zprofile contents) in an image. Instead, put it in a code block.
    – Daniel B
    Commented May 24 at 12:00
  • Oh,sry,it's my fault.
    – Luxury
    Commented May 24 at 14:30

1 Answer 1

0

The default shell in MacOS is usually zsh, but it could also be bash. In your case, it appears to be zshrc:

For zshrc:

vim ~/.zshrc

Modify the prompt:

export PROMPT='%F{blue}%n%f@%F{green}%m%f %F{yellow}%1~%f %# '

Enable the change:

source ~/.zshrc 

But, if you have bash, edit .bash_profile or .bashrc in your home directory:

vim ~/.bash_profile

Or

vim ~/.bashrc

Modify the prompt:

export PS1='\u@\h \w \$ '

Apply the change:

source ~/.bash_profile

or

source ~/.bashrc

That should do it!

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .