mate-terminal: trigger profile on command











up vote
1
down vote

favorite












When I start an ssh session I want some constant on screen signal, such as a color change, that reminds me that this session is not local. I keep a lot of terminals open and I too often don't notice what host a session is running on.










share|improve this question




























    up vote
    1
    down vote

    favorite












    When I start an ssh session I want some constant on screen signal, such as a color change, that reminds me that this session is not local. I keep a lot of terminals open and I too often don't notice what host a session is running on.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      When I start an ssh session I want some constant on screen signal, such as a color change, that reminds me that this session is not local. I keep a lot of terminals open and I too often don't notice what host a session is running on.










      share|improve this question















      When I start an ssh session I want some constant on screen signal, such as a color change, that reminds me that this session is not local. I keep a lot of terminals open and I too often don't notice what host a session is running on.







      command-line gnome-terminal ubuntu-mate






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 5 at 2:19

























      asked Nov 2 at 19:09









      Stephen Boston

      6992618




      6992618






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          It's easy, because ssh sets some enviroment variables. I logged in via ssh local host:



          walt@bat:~(0)$ env | grep SSH
          SSH_CLIENT=127.0.0.1 52602 22
          SSH_TTY=/dev/pts/5
          SSH_CONNECTION=127.0.0.1 52602 127.0.0.1 22


          Then, in your ~/.bashrc on the target, you can:



          if [[ ! -z "$SSH_CLIENT" ]] ; then
          # change terminal colors 30=black text, 41=red background
          echo '^[[30;41m'
          fi


          If you must do it on the source system,



          alias redssh="echo '^[[30;41m';ssh"


          The clear command will reset the colors.



          See http://www.termsys.demon.co.uk/vtansi.htm#colors for more color choices.






          share|improve this answer























          • This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
            – Stephen Boston
            Nov 3 at 13:26












          • "wrong thing to do"? What does this mean?
            – waltinator
            Nov 3 at 13:42










          • It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
            – Stephen Boston
            Nov 3 at 17:49












          • I have changed my question to highlight the requirement rather than the implementation.
            – Stephen Boston
            Dec 4 at 20:02











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1089569%2fmate-terminal-trigger-profile-on-command%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          It's easy, because ssh sets some enviroment variables. I logged in via ssh local host:



          walt@bat:~(0)$ env | grep SSH
          SSH_CLIENT=127.0.0.1 52602 22
          SSH_TTY=/dev/pts/5
          SSH_CONNECTION=127.0.0.1 52602 127.0.0.1 22


          Then, in your ~/.bashrc on the target, you can:



          if [[ ! -z "$SSH_CLIENT" ]] ; then
          # change terminal colors 30=black text, 41=red background
          echo '^[[30;41m'
          fi


          If you must do it on the source system,



          alias redssh="echo '^[[30;41m';ssh"


          The clear command will reset the colors.



          See http://www.termsys.demon.co.uk/vtansi.htm#colors for more color choices.






          share|improve this answer























          • This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
            – Stephen Boston
            Nov 3 at 13:26












          • "wrong thing to do"? What does this mean?
            – waltinator
            Nov 3 at 13:42










          • It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
            – Stephen Boston
            Nov 3 at 17:49












          • I have changed my question to highlight the requirement rather than the implementation.
            – Stephen Boston
            Dec 4 at 20:02















          up vote
          2
          down vote



          accepted










          It's easy, because ssh sets some enviroment variables. I logged in via ssh local host:



          walt@bat:~(0)$ env | grep SSH
          SSH_CLIENT=127.0.0.1 52602 22
          SSH_TTY=/dev/pts/5
          SSH_CONNECTION=127.0.0.1 52602 127.0.0.1 22


          Then, in your ~/.bashrc on the target, you can:



          if [[ ! -z "$SSH_CLIENT" ]] ; then
          # change terminal colors 30=black text, 41=red background
          echo '^[[30;41m'
          fi


          If you must do it on the source system,



          alias redssh="echo '^[[30;41m';ssh"


          The clear command will reset the colors.



          See http://www.termsys.demon.co.uk/vtansi.htm#colors for more color choices.






          share|improve this answer























          • This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
            – Stephen Boston
            Nov 3 at 13:26












          • "wrong thing to do"? What does this mean?
            – waltinator
            Nov 3 at 13:42










          • It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
            – Stephen Boston
            Nov 3 at 17:49












          • I have changed my question to highlight the requirement rather than the implementation.
            – Stephen Boston
            Dec 4 at 20:02













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          It's easy, because ssh sets some enviroment variables. I logged in via ssh local host:



          walt@bat:~(0)$ env | grep SSH
          SSH_CLIENT=127.0.0.1 52602 22
          SSH_TTY=/dev/pts/5
          SSH_CONNECTION=127.0.0.1 52602 127.0.0.1 22


          Then, in your ~/.bashrc on the target, you can:



          if [[ ! -z "$SSH_CLIENT" ]] ; then
          # change terminal colors 30=black text, 41=red background
          echo '^[[30;41m'
          fi


          If you must do it on the source system,



          alias redssh="echo '^[[30;41m';ssh"


          The clear command will reset the colors.



          See http://www.termsys.demon.co.uk/vtansi.htm#colors for more color choices.






          share|improve this answer














          It's easy, because ssh sets some enviroment variables. I logged in via ssh local host:



          walt@bat:~(0)$ env | grep SSH
          SSH_CLIENT=127.0.0.1 52602 22
          SSH_TTY=/dev/pts/5
          SSH_CONNECTION=127.0.0.1 52602 127.0.0.1 22


          Then, in your ~/.bashrc on the target, you can:



          if [[ ! -z "$SSH_CLIENT" ]] ; then
          # change terminal colors 30=black text, 41=red background
          echo '^[[30;41m'
          fi


          If you must do it on the source system,



          alias redssh="echo '^[[30;41m';ssh"


          The clear command will reset the colors.



          See http://www.termsys.demon.co.uk/vtansi.htm#colors for more color choices.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 4 at 22:27

























          answered Nov 2 at 19:30









          waltinator

          21.8k74169




          21.8k74169












          • This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
            – Stephen Boston
            Nov 3 at 13:26












          • "wrong thing to do"? What does this mean?
            – waltinator
            Nov 3 at 13:42










          • It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
            – Stephen Boston
            Nov 3 at 17:49












          • I have changed my question to highlight the requirement rather than the implementation.
            – Stephen Boston
            Dec 4 at 20:02


















          • This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
            – Stephen Boston
            Nov 3 at 13:26












          • "wrong thing to do"? What does this mean?
            – waltinator
            Nov 3 at 13:42










          • It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
            – Stephen Boston
            Nov 3 at 17:49












          • I have changed my question to highlight the requirement rather than the implementation.
            – Stephen Boston
            Dec 4 at 20:02
















          This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
          – Stephen Boston
          Nov 3 at 13:26






          This is great. Except how do I reset the mate-terminal profile? I put mate-terminal --profile alternate under your condition and boy oh boy was that the wrong thing to do!
          – Stephen Boston
          Nov 3 at 13:26














          "wrong thing to do"? What does this mean?
          – waltinator
          Nov 3 at 13:42




          "wrong thing to do"? What does this mean?
          – waltinator
          Nov 3 at 13:42












          It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
          – Stephen Boston
          Nov 3 at 17:49






          It meant that every time .bashrc was processed it opened a new mate-terminal session which processed .bashrc which opened a new mate-terminal session which eventually locked the system. I had to reboot and open a virtual console to edit the bashrc.
          – Stephen Boston
          Nov 3 at 17:49














          I have changed my question to highlight the requirement rather than the implementation.
          – Stephen Boston
          Dec 4 at 20:02




          I have changed my question to highlight the requirement rather than the implementation.
          – Stephen Boston
          Dec 4 at 20:02


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1089569%2fmate-terminal-trigger-profile-on-command%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido