0

I often have several SSH terminals open on different servers, and I am looking for a way to keep track of them more easily. I use MacOS Terminal app. I have already customized the prompt on each machine like this:

export PS1="\[\e[1;38;5;160m\]\[\e[48;5;16m\][\u@\h \W]\[\e[0m\]$ "

This makes the prompt foreground and background unique for each machine. But I would like to also change the default background color for all text. If I omit the \e[0m reset command then I can add colors here, however this will be reset the next time I run a command with colorized output like ls. I can use the MacOS Terminal themes, but this requires a lot of mouse action every time I open a new one. I think the trick is to change the default colors, but I don't know how to do this from .bashrc.

1 Answer 1

0

For MacOS Terminal.app (unless this has changed in Mohave) does not recognize the xterm dynamic colors feature which would allow you to do this. iTerm2 does this (but as usual, ymmv).

According to Yoric's lengthy response in How to have a random background color in Terminal.app, you could use AppleScript to do this.

You must log in to answer this question.

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