How do I add welcome message to Linux?












1















I want to add a welcome message (and change a greetings row) to Linux.



I added



echo "Hello"
PS1="u $: "


to “.profile” file, but nothing happens after the reboot. Why?










share|improve this question


















  • 2





    When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

    – terdon
    Feb 23 '17 at 15:00
















1















I want to add a welcome message (and change a greetings row) to Linux.



I added



echo "Hello"
PS1="u $: "


to “.profile” file, but nothing happens after the reboot. Why?










share|improve this question


















  • 2





    When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

    – terdon
    Feb 23 '17 at 15:00














1












1








1








I want to add a welcome message (and change a greetings row) to Linux.



I added



echo "Hello"
PS1="u $: "


to “.profile” file, but nothing happens after the reboot. Why?










share|improve this question














I want to add a welcome message (and change a greetings row) to Linux.



I added



echo "Hello"
PS1="u $: "


to “.profile” file, but nothing happens after the reboot. Why?







command-line sudo .profile






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 23 '17 at 14:49









KosararKosarar

1417




1417








  • 2





    When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

    – terdon
    Feb 23 '17 at 15:00














  • 2





    When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

    – terdon
    Feb 23 '17 at 15:00








2




2





When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

– terdon
Feb 23 '17 at 15:00





When should this be shown? On the GUI login screen? After logging in from the GUI? On the command line login? Again, before or after logging in? Or maybe when connecting through ssh? Please edit your question and clarify what you are trying to do.

– terdon
Feb 23 '17 at 15:00










3 Answers
3






active

oldest

votes


















3














In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded). ~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my ~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.



My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your ~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.



The solution would be to place that message at the end of ~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.






share|improve this answer


























  • I do not know what "sourced" means, but it works!

    – Kosarar
    Feb 23 '17 at 16:00











  • @user3107513 just means "loaded". Nothing more nothing less :)

    – Sergiy Kolodyazhnyy
    Feb 23 '17 at 16:01



















1














If you want to get a custom message when you log in via ssh, you need to put a text file in /etc/update-motd.d. Give it a name like 11-my-banner-message and make the permissions -rwxr-xr-x.



The file can look like this



#!/bin/sh
#
#
printf "n"
printf " Howdy There!n"





share|improve this answer































    0














    You can do so by simply adding a few lines in the ~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.






    share|improve this answer























      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',
      autoActivateHeartbeat: false,
      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%2f886529%2fhow-do-i-add-welcome-message-to-linux%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded). ~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my ~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.



      My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your ~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.



      The solution would be to place that message at the end of ~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.






      share|improve this answer


























      • I do not know what "sourced" means, but it works!

        – Kosarar
        Feb 23 '17 at 16:00











      • @user3107513 just means "loaded". Nothing more nothing less :)

        – Sergiy Kolodyazhnyy
        Feb 23 '17 at 16:01
















      3














      In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded). ~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my ~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.



      My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your ~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.



      The solution would be to place that message at the end of ~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.






      share|improve this answer


























      • I do not know what "sourced" means, but it works!

        – Kosarar
        Feb 23 '17 at 16:00











      • @user3107513 just means "loaded". Nothing more nothing less :)

        – Sergiy Kolodyazhnyy
        Feb 23 '17 at 16:01














      3












      3








      3







      In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded). ~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my ~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.



      My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your ~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.



      The solution would be to place that message at the end of ~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.






      share|improve this answer















      In order to make this work, you need to understand the order and when each config file for shell is being sourced( aka loaded). ~/.profile is sourced at the time of logging in. It will be shown in TTY console perfectly fine - I personally have a message like that in my ~/.profile for when I go into TTY specifically. If you call a shell again from that session, it won't be sourced. Same thing in GUI. You log-in , the file is sourced only once.



      My guess is that you are trying to show the message in the GUI terminal. When you log in into desktop your ~/.profile is already sourced, which also means it will not be sourced again in any terminal under that session, and message won't be shown. There's your problem.



      The solution would be to place that message at the end of ~/.bashrc. That file is sourced when each interactive session is open, regardless of whether you are logging-in or not.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Feb 23 '17 at 15:47

























      answered Feb 23 '17 at 15:42









      Sergiy KolodyazhnyySergiy Kolodyazhnyy

      74k9154323




      74k9154323













      • I do not know what "sourced" means, but it works!

        – Kosarar
        Feb 23 '17 at 16:00











      • @user3107513 just means "loaded". Nothing more nothing less :)

        – Sergiy Kolodyazhnyy
        Feb 23 '17 at 16:01



















      • I do not know what "sourced" means, but it works!

        – Kosarar
        Feb 23 '17 at 16:00











      • @user3107513 just means "loaded". Nothing more nothing less :)

        – Sergiy Kolodyazhnyy
        Feb 23 '17 at 16:01

















      I do not know what "sourced" means, but it works!

      – Kosarar
      Feb 23 '17 at 16:00





      I do not know what "sourced" means, but it works!

      – Kosarar
      Feb 23 '17 at 16:00













      @user3107513 just means "loaded". Nothing more nothing less :)

      – Sergiy Kolodyazhnyy
      Feb 23 '17 at 16:01





      @user3107513 just means "loaded". Nothing more nothing less :)

      – Sergiy Kolodyazhnyy
      Feb 23 '17 at 16:01













      1














      If you want to get a custom message when you log in via ssh, you need to put a text file in /etc/update-motd.d. Give it a name like 11-my-banner-message and make the permissions -rwxr-xr-x.



      The file can look like this



      #!/bin/sh
      #
      #
      printf "n"
      printf " Howdy There!n"





      share|improve this answer




























        1














        If you want to get a custom message when you log in via ssh, you need to put a text file in /etc/update-motd.d. Give it a name like 11-my-banner-message and make the permissions -rwxr-xr-x.



        The file can look like this



        #!/bin/sh
        #
        #
        printf "n"
        printf " Howdy There!n"





        share|improve this answer


























          1












          1








          1







          If you want to get a custom message when you log in via ssh, you need to put a text file in /etc/update-motd.d. Give it a name like 11-my-banner-message and make the permissions -rwxr-xr-x.



          The file can look like this



          #!/bin/sh
          #
          #
          printf "n"
          printf " Howdy There!n"





          share|improve this answer













          If you want to get a custom message when you log in via ssh, you need to put a text file in /etc/update-motd.d. Give it a name like 11-my-banner-message and make the permissions -rwxr-xr-x.



          The file can look like this



          #!/bin/sh
          #
          #
          printf "n"
          printf " Howdy There!n"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 23 '17 at 16:18









          Organic MarbleOrganic Marble

          11.4k63459




          11.4k63459























              0














              You can do so by simply adding a few lines in the ~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.






              share|improve this answer




























                0














                You can do so by simply adding a few lines in the ~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.






                share|improve this answer


























                  0












                  0








                  0







                  You can do so by simply adding a few lines in the ~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.






                  share|improve this answer













                  You can do so by simply adding a few lines in the ~/.bashrc file, which would make changes for only the current user for the default shell Bash. Check this out for the full explanation on showing custom-message/ASCII-art/random-one-liner as welcome to the linux terminal.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 10 at 11:09









                  Devarshi Devarshi

                  1




                  1






























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f886529%2fhow-do-i-add-welcome-message-to-linux%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

                      How to make a Squid Proxy server?

                      Is this a new Fibonacci Identity?

                      19世紀