Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Terminal background color when I open new tab?

I wanted to change color when I login to remote server by ssh.

The problem solved by this question.

How do I make the apple terminal window auto change colour scheme when I ssh to a specific server

But the solution above have a little problem.

  1. Connet to remote server by ssh. (Background color is changed)
  2. Open new terminal Tab.
  3. This Tab's background is still changed.

So I want to "reset" background color when I open new Terminal Tab. How can I do it?

like image 607
ironsand Avatar asked Sep 10 '13 10:09

ironsand


1 Answers

By default, Terminal creates new tabs with the same settings as the current tab. You can change it to always use your default profile for new tabs in Preferences > Startup by changing New tabs open with: to Default Settings.

Note that there’s a built-in way to automatically set the background color for specific commands instead of using the script from that other answer:

You can set the name of a settings profile to a command name and Terminal will select that profile when you create a new terminal via either Shell > New Command… or Shell > New Remote Connection….

For example, duplicate your default profile, name it “ssh” and set its background color to red. Then use New Command… to run ssh host.example.com.

It also matches on arguments, so you can have it choose different settings for different remote hosts, for example. You could have one named “ssh host.example.com” with a blue background and another named “ssh” with a red background to handle any ssh commands that don’t match other profiles.

like image 124
Chris Page Avatar answered Oct 18 '22 10:10

Chris Page