Changing the bash prompt












9















Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different.



Speficially I'd like to use (K)Ubuntu's prompt










share|improve this question





























    9















    Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different.



    Speficially I'd like to use (K)Ubuntu's prompt










    share|improve this question



























      9












      9








      9








      Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different.



      Speficially I'd like to use (K)Ubuntu's prompt










      share|improve this question
















      Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different.



      Speficially I'd like to use (K)Ubuntu's prompt







      bash prompt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 13 '10 at 1:55









      xenoterracide

      25.6k52158222




      25.6k52158222










      asked Oct 12 '10 at 8:34









      FalmarriFalmarri

      4,877134462




      4,877134462






















          4 Answers
          4






          active

          oldest

          votes


















          11














          The environment Variables "$PS1" and "$PS2" set the prompt's look. You can check this howto in order to see all the different variables you can put in there.
          `






          share|improve this answer































            6














            As tante said, you have to set the $PS1(left prompt) (and optionally $PS2(second line prompt)).



            (Others variable exists on other shells like $RPS1 (right prompt) for zsh)



            The best thing to do is to edit your .bashrc file in your home directory and add something like :



            export PS1=...


            I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.






            share|improve this answer





















            • 2





              $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

              – sepp2k
              Oct 12 '10 at 9:56






            • 1





              $PS2 contains the second promptline if a shell needs more input, not the right prompt.

              – echox
              Oct 12 '10 at 9:57











            • Indeed, I've just got confused when I wrote this answer. Corrected.

              – Elenaher
              Oct 12 '10 at 10:05











            • You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

              – sepp2k
              Oct 12 '10 at 13:47











            • @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

              – Elenaher
              Oct 12 '10 at 14:52



















            3














            As others have said, this is determined by the environment vars PS1 and PS2.



            Ubuntu's default ps1 is: ${debian_chroot:+($debian_chroot)}u@h:w$



            So you'll want to run the following:



            export PS1=${debian_chroot:+($debian_chroot)}u@h:w$



            To run that every time you log in, put it in your ~/.bashrc file:



            echo "export PS1=${debian_chroot:+($debian_chroot)}u@h:w$" >> ~/.bashrc





            share|improve this answer































              1














              Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt. And for even more fun, this thread in the Arch Forums: What's your PS1?. (Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)






              share|improve this answer























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "106"
                };
                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: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                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%2funix.stackexchange.com%2fquestions%2f3012%2fchanging-the-bash-prompt%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                11














                The environment Variables "$PS1" and "$PS2" set the prompt's look. You can check this howto in order to see all the different variables you can put in there.
                `






                share|improve this answer




























                  11














                  The environment Variables "$PS1" and "$PS2" set the prompt's look. You can check this howto in order to see all the different variables you can put in there.
                  `






                  share|improve this answer


























                    11












                    11








                    11







                    The environment Variables "$PS1" and "$PS2" set the prompt's look. You can check this howto in order to see all the different variables you can put in there.
                    `






                    share|improve this answer













                    The environment Variables "$PS1" and "$PS2" set the prompt's look. You can check this howto in order to see all the different variables you can put in there.
                    `







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 12 '10 at 8:43









                    tantetante

                    4,9842023




                    4,9842023

























                        6














                        As tante said, you have to set the $PS1(left prompt) (and optionally $PS2(second line prompt)).



                        (Others variable exists on other shells like $RPS1 (right prompt) for zsh)



                        The best thing to do is to edit your .bashrc file in your home directory and add something like :



                        export PS1=...


                        I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.






                        share|improve this answer





















                        • 2





                          $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                          – sepp2k
                          Oct 12 '10 at 9:56






                        • 1





                          $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                          – echox
                          Oct 12 '10 at 9:57











                        • Indeed, I've just got confused when I wrote this answer. Corrected.

                          – Elenaher
                          Oct 12 '10 at 10:05











                        • You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                          – sepp2k
                          Oct 12 '10 at 13:47











                        • @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                          – Elenaher
                          Oct 12 '10 at 14:52
















                        6














                        As tante said, you have to set the $PS1(left prompt) (and optionally $PS2(second line prompt)).



                        (Others variable exists on other shells like $RPS1 (right prompt) for zsh)



                        The best thing to do is to edit your .bashrc file in your home directory and add something like :



                        export PS1=...


                        I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.






                        share|improve this answer





















                        • 2





                          $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                          – sepp2k
                          Oct 12 '10 at 9:56






                        • 1





                          $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                          – echox
                          Oct 12 '10 at 9:57











                        • Indeed, I've just got confused when I wrote this answer. Corrected.

                          – Elenaher
                          Oct 12 '10 at 10:05











                        • You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                          – sepp2k
                          Oct 12 '10 at 13:47











                        • @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                          – Elenaher
                          Oct 12 '10 at 14:52














                        6












                        6








                        6







                        As tante said, you have to set the $PS1(left prompt) (and optionally $PS2(second line prompt)).



                        (Others variable exists on other shells like $RPS1 (right prompt) for zsh)



                        The best thing to do is to edit your .bashrc file in your home directory and add something like :



                        export PS1=...


                        I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.






                        share|improve this answer















                        As tante said, you have to set the $PS1(left prompt) (and optionally $PS2(second line prompt)).



                        (Others variable exists on other shells like $RPS1 (right prompt) for zsh)



                        The best thing to do is to edit your .bashrc file in your home directory and add something like :



                        export PS1=...


                        I will give you an additionnal link that I always find useful because there's a good list of the avalaible colors.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Oct 12 '10 at 14:54

























                        answered Oct 12 '10 at 9:26









                        ElenaherElenaher

                        504148




                        504148








                        • 2





                          $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                          – sepp2k
                          Oct 12 '10 at 9:56






                        • 1





                          $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                          – echox
                          Oct 12 '10 at 9:57











                        • Indeed, I've just got confused when I wrote this answer. Corrected.

                          – Elenaher
                          Oct 12 '10 at 10:05











                        • You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                          – sepp2k
                          Oct 12 '10 at 13:47











                        • @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                          – Elenaher
                          Oct 12 '10 at 14:52














                        • 2





                          $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                          – sepp2k
                          Oct 12 '10 at 9:56






                        • 1





                          $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                          – echox
                          Oct 12 '10 at 9:57











                        • Indeed, I've just got confused when I wrote this answer. Corrected.

                          – Elenaher
                          Oct 12 '10 at 10:05











                        • You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                          – sepp2k
                          Oct 12 '10 at 13:47











                        • @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                          – Elenaher
                          Oct 12 '10 at 14:52








                        2




                        2





                        $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                        – sepp2k
                        Oct 12 '10 at 9:56





                        $PS2 is the prompt you get when writing a command over multiple lines, not the right prompt. The right prompt would be $RPS1 (and $RPS2 accordingly for multiple lines) on zsh - bash has no right prompt.

                        – sepp2k
                        Oct 12 '10 at 9:56




                        1




                        1





                        $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                        – echox
                        Oct 12 '10 at 9:57





                        $PS2 contains the second promptline if a shell needs more input, not the right prompt.

                        – echox
                        Oct 12 '10 at 9:57













                        Indeed, I've just got confused when I wrote this answer. Corrected.

                        – Elenaher
                        Oct 12 '10 at 10:05





                        Indeed, I've just got confused when I wrote this answer. Corrected.

                        – Elenaher
                        Oct 12 '10 at 10:05













                        You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                        – sepp2k
                        Oct 12 '10 at 13:47





                        You should probably remove the bit about the right prompt altogether because that only exists in zsh and the question is about bash.

                        – sepp2k
                        Oct 12 '10 at 13:47













                        @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                        – Elenaher
                        Oct 12 '10 at 14:52





                        @seppk : thanks for the comment. I have used zsh for many years and here at work I have to use bash. I didn't notice that RPS1 wasn't available on it.

                        – Elenaher
                        Oct 12 '10 at 14:52











                        3














                        As others have said, this is determined by the environment vars PS1 and PS2.



                        Ubuntu's default ps1 is: ${debian_chroot:+($debian_chroot)}u@h:w$



                        So you'll want to run the following:



                        export PS1=${debian_chroot:+($debian_chroot)}u@h:w$



                        To run that every time you log in, put it in your ~/.bashrc file:



                        echo "export PS1=${debian_chroot:+($debian_chroot)}u@h:w$" >> ~/.bashrc





                        share|improve this answer




























                          3














                          As others have said, this is determined by the environment vars PS1 and PS2.



                          Ubuntu's default ps1 is: ${debian_chroot:+($debian_chroot)}u@h:w$



                          So you'll want to run the following:



                          export PS1=${debian_chroot:+($debian_chroot)}u@h:w$



                          To run that every time you log in, put it in your ~/.bashrc file:



                          echo "export PS1=${debian_chroot:+($debian_chroot)}u@h:w$" >> ~/.bashrc





                          share|improve this answer


























                            3












                            3








                            3







                            As others have said, this is determined by the environment vars PS1 and PS2.



                            Ubuntu's default ps1 is: ${debian_chroot:+($debian_chroot)}u@h:w$



                            So you'll want to run the following:



                            export PS1=${debian_chroot:+($debian_chroot)}u@h:w$



                            To run that every time you log in, put it in your ~/.bashrc file:



                            echo "export PS1=${debian_chroot:+($debian_chroot)}u@h:w$" >> ~/.bashrc





                            share|improve this answer













                            As others have said, this is determined by the environment vars PS1 and PS2.



                            Ubuntu's default ps1 is: ${debian_chroot:+($debian_chroot)}u@h:w$



                            So you'll want to run the following:



                            export PS1=${debian_chroot:+($debian_chroot)}u@h:w$



                            To run that every time you log in, put it in your ~/.bashrc file:



                            echo "export PS1=${debian_chroot:+($debian_chroot)}u@h:w$" >> ~/.bashrc






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Oct 12 '10 at 19:29









                            JoshJosh

                            3,74164265




                            3,74164265























                                1














                                Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt. And for even more fun, this thread in the Arch Forums: What's your PS1?. (Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)






                                share|improve this answer




























                                  1














                                  Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt. And for even more fun, this thread in the Arch Forums: What's your PS1?. (Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)






                                  share|improve this answer


























                                    1












                                    1








                                    1







                                    Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt. And for even more fun, this thread in the Arch Forums: What's your PS1?. (Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)






                                    share|improve this answer













                                    Since you asked specifically about Arch (well, it doesn't really matter, but it makes a nice excuse to add to the answers...), you should look at this entry in the Arch Wiki: Color Bash Prompt. And for even more fun, this thread in the Arch Forums: What's your PS1?. (Pages and pages of people trying to outdo each other with more and more elaborate prompts.... that's the typical Arch user for you.)







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Oct 13 '10 at 6:08









                                    frabjousfrabjous

                                    4,3371825




                                    4,3371825






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                        • 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%2funix.stackexchange.com%2fquestions%2f3012%2fchanging-the-bash-prompt%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

                                        CARDNET

                                        Boot-repair Failure: Unable to locate package grub-common:i386

                                        濃尾地震