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?
How to set the color of terminal text in ssh session exact same as local session
bashcolorterminalthemes
Related Question
- MacOS – Change output color of terminal (in Mac) to be different from typed text color
- MacOS – Set the result of command to variable in Terminal post execution
- Open new Terminal in same SSH session
- Terminal command that is the same as copy paste in Finder
- Colors are different when SSHing onto a Linux machine from iTerm2. How to standardize them
Best Answer
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.
Something like [ "$BASH_COMMAND" =~ "^ssh" ] && return in the preexec_invoke_exec function.