So this is almost a copy from my previous question: Change output color of terminal (in Mac) to be different from typed text color for which I got a great answer here: https://apple.stackexchange.com/a/218736/34070. However, the only problem is that when I use ssh, all the text in the ssh session is now lightblue (see screenshot). How can I get the ssh session to use the same color scheme as my local session, and also have different output color for type commands and output?

enter image description here

1 Answer 1


The main issue here is that the prompt command and colouring options are sourced from the computer you are logged into. So when you ssh somewhere, you must change the colouring/prompts on that server as well.

There are a couple of options.

  • Depending on the OS of the server you are logging into you could reset the prompt colours in the login scripts there. Or;
  • Add an exception in the preexec command you installed before so it doesn't change the foreground colour for ssh commands

Something like [ "$BASH_COMMAND" =~ "^ssh" ] && return in the preexec_invoke_exec function.


You must log in to answer this question.

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