How do I keep terminal line from overwriting itself?












6














In a terminal window any smaller than fullscreen, if I type in a long command it starts overwriting the current line I'm on. If I type an additional line's worth, it finally moves to the next line. Does anyone know how to fix this?



This is what happens visually:



enter image description here



Edit: These are my prompt settings:
PS1: [e]0;u@h: wa]${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$
TERM: xterm
.bashrc:



if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
else
PS1='${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$ '
fi

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="[e]0;${debian_chroot:+($debian_chroot)}u@h: wa]$PS1"
;;
*)
;;
esac









share|improve this question





























    6














    In a terminal window any smaller than fullscreen, if I type in a long command it starts overwriting the current line I'm on. If I type an additional line's worth, it finally moves to the next line. Does anyone know how to fix this?



    This is what happens visually:



    enter image description here



    Edit: These are my prompt settings:
    PS1: [e]0;u@h: wa]${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$
    TERM: xterm
    .bashrc:



    if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
    else
    PS1='${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$ '
    fi

    # If this is an xterm set the title to user@host:dir
    case "$TERM" in
    xterm*|rxvt*)
    PS1="[e]0;${debian_chroot:+($debian_chroot)}u@h: wa]$PS1"
    ;;
    *)
    ;;
    esac









    share|improve this question



























      6












      6








      6


      2





      In a terminal window any smaller than fullscreen, if I type in a long command it starts overwriting the current line I'm on. If I type an additional line's worth, it finally moves to the next line. Does anyone know how to fix this?



      This is what happens visually:



      enter image description here



      Edit: These are my prompt settings:
      PS1: [e]0;u@h: wa]${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$
      TERM: xterm
      .bashrc:



      if [ "$color_prompt" = yes ]; then
      PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
      else
      PS1='${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$ '
      fi

      # If this is an xterm set the title to user@host:dir
      case "$TERM" in
      xterm*|rxvt*)
      PS1="[e]0;${debian_chroot:+($debian_chroot)}u@h: wa]$PS1"
      ;;
      *)
      ;;
      esac









      share|improve this question















      In a terminal window any smaller than fullscreen, if I type in a long command it starts overwriting the current line I'm on. If I type an additional line's worth, it finally moves to the next line. Does anyone know how to fix this?



      This is what happens visually:



      enter image description here



      Edit: These are my prompt settings:
      PS1: [e]0;u@h: wa]${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$
      TERM: xterm
      .bashrc:



      if [ "$color_prompt" = yes ]; then
      PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '
      else
      PS1='${debian_chroot:+($debian_chroot)}u@h:w33[1m`__git_ps1`33[0m$ '
      fi

      # If this is an xterm set the title to user@host:dir
      case "$TERM" in
      xterm*|rxvt*)
      PS1="[e]0;${debian_chroot:+($debian_chroot)}u@h: wa]$PS1"
      ;;
      *)
      ;;
      esac






      command-line






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 9 '12 at 17:16









      Jorge Castro

      35.9k105422617




      35.9k105422617










      asked Aug 3 '12 at 21:07









      thebaer

      20529




      20529






















          3 Answers
          3






          active

          oldest

          votes


















          4














          For some reason the terminal size is mis-reporting. It should change when you resize the terminal.



          Try this in your .bashrc command file:



          # check the window size after each command and, if necessary,
          # update the values of LINES and COLUMNS.
          shopt -s checkwinsize





          share|improve this answer





















          • It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
            – thebaer
            Aug 4 '12 at 19:48










          • Hmm, what are the values of LINES and COLUMNS when the text is messed up?
            – Julian Knight
            Aug 7 '12 at 20:56










          • LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
            – thebaer
            Aug 8 '12 at 15:39










          • Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
            – Julian Knight
            Aug 8 '12 at 20:41










          • I updated the question with these answers.
            – thebaer
            Aug 10 '12 at 15:43



















          3














          I found the answer here. The answer with the most votes solved it for me.



          To sum it up I had to wrap my formats in [ ]
          export PS1='[33[1;32m]$(whoami)@$(hostname): [33[0;37m]$(pwd)$ [33[0m]'






          share|improve this answer































            0














            For those using PuTTY terminal (v0.67) and terminal size is not updated correctly. You can do right click on the window's left hand icon, select Change Setting... Witin PuTTY Reconfiguration, from left hand sidebar, click on Window > Set the size of the window > Columns. Update the Column value manually, I changed mine to 255 and that stop terminal overwriting on its own line (when I type).enter image description here



            enter image description here






            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%2f171694%2fhow-do-i-keep-terminal-line-from-overwriting-itself%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









              4














              For some reason the terminal size is mis-reporting. It should change when you resize the terminal.



              Try this in your .bashrc command file:



              # check the window size after each command and, if necessary,
              # update the values of LINES and COLUMNS.
              shopt -s checkwinsize





              share|improve this answer





















              • It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
                – thebaer
                Aug 4 '12 at 19:48










              • Hmm, what are the values of LINES and COLUMNS when the text is messed up?
                – Julian Knight
                Aug 7 '12 at 20:56










              • LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
                – thebaer
                Aug 8 '12 at 15:39










              • Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
                – Julian Knight
                Aug 8 '12 at 20:41










              • I updated the question with these answers.
                – thebaer
                Aug 10 '12 at 15:43
















              4














              For some reason the terminal size is mis-reporting. It should change when you resize the terminal.



              Try this in your .bashrc command file:



              # check the window size after each command and, if necessary,
              # update the values of LINES and COLUMNS.
              shopt -s checkwinsize





              share|improve this answer





















              • It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
                – thebaer
                Aug 4 '12 at 19:48










              • Hmm, what are the values of LINES and COLUMNS when the text is messed up?
                – Julian Knight
                Aug 7 '12 at 20:56










              • LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
                – thebaer
                Aug 8 '12 at 15:39










              • Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
                – Julian Knight
                Aug 8 '12 at 20:41










              • I updated the question with these answers.
                – thebaer
                Aug 10 '12 at 15:43














              4












              4








              4






              For some reason the terminal size is mis-reporting. It should change when you resize the terminal.



              Try this in your .bashrc command file:



              # check the window size after each command and, if necessary,
              # update the values of LINES and COLUMNS.
              shopt -s checkwinsize





              share|improve this answer












              For some reason the terminal size is mis-reporting. It should change when you resize the terminal.



              Try this in your .bashrc command file:



              # check the window size after each command and, if necessary,
              # update the values of LINES and COLUMNS.
              shopt -s checkwinsize






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Aug 3 '12 at 21:44









              Julian Knight

              1,4201018




              1,4201018












              • It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
                – thebaer
                Aug 4 '12 at 19:48










              • Hmm, what are the values of LINES and COLUMNS when the text is messed up?
                – Julian Knight
                Aug 7 '12 at 20:56










              • LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
                – thebaer
                Aug 8 '12 at 15:39










              • Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
                – Julian Knight
                Aug 8 '12 at 20:41










              • I updated the question with these answers.
                – thebaer
                Aug 10 '12 at 15:43


















              • It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
                – thebaer
                Aug 4 '12 at 19:48










              • Hmm, what are the values of LINES and COLUMNS when the text is messed up?
                – Julian Knight
                Aug 7 '12 at 20:56










              • LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
                – thebaer
                Aug 8 '12 at 15:39










              • Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
                – Julian Knight
                Aug 8 '12 at 20:41










              • I updated the question with these answers.
                – thebaer
                Aug 10 '12 at 15:43
















              It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
              – thebaer
              Aug 4 '12 at 19:48




              It looks like this was already in my .bashrc file. Running shopt shows that checkwinsize is on.
              – thebaer
              Aug 4 '12 at 19:48












              Hmm, what are the values of LINES and COLUMNS when the text is messed up?
              – Julian Knight
              Aug 7 '12 at 20:56




              Hmm, what are the values of LINES and COLUMNS when the text is messed up?
              – Julian Knight
              Aug 7 '12 at 20:56












              LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
              – thebaer
              Aug 8 '12 at 15:39




              LINES is 24, COLUMNS is 80. Resizing the window does change these values, but the text is still messed up.
              – thebaer
              Aug 8 '12 at 15:39












              Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
              – Julian Knight
              Aug 8 '12 at 20:41




              Ah. OK, I suspect the setting for the PROMPT now. Can you post the values of PS1 and TERM. In fact, post the line defining PS1 in .bashrc
              – Julian Knight
              Aug 8 '12 at 20:41












              I updated the question with these answers.
              – thebaer
              Aug 10 '12 at 15:43




              I updated the question with these answers.
              – thebaer
              Aug 10 '12 at 15:43













              3














              I found the answer here. The answer with the most votes solved it for me.



              To sum it up I had to wrap my formats in [ ]
              export PS1='[33[1;32m]$(whoami)@$(hostname): [33[0;37m]$(pwd)$ [33[0m]'






              share|improve this answer




























                3














                I found the answer here. The answer with the most votes solved it for me.



                To sum it up I had to wrap my formats in [ ]
                export PS1='[33[1;32m]$(whoami)@$(hostname): [33[0;37m]$(pwd)$ [33[0m]'






                share|improve this answer


























                  3












                  3








                  3






                  I found the answer here. The answer with the most votes solved it for me.



                  To sum it up I had to wrap my formats in [ ]
                  export PS1='[33[1;32m]$(whoami)@$(hostname): [33[0;37m]$(pwd)$ [33[0m]'






                  share|improve this answer














                  I found the answer here. The answer with the most votes solved it for me.



                  To sum it up I had to wrap my formats in [ ]
                  export PS1='[33[1;32m]$(whoami)@$(hostname): [33[0;37m]$(pwd)$ [33[0m]'







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 13 '17 at 12:23









                  Community

                  1




                  1










                  answered Oct 9 '16 at 15:55









                  Jerinaw

                  17619




                  17619























                      0














                      For those using PuTTY terminal (v0.67) and terminal size is not updated correctly. You can do right click on the window's left hand icon, select Change Setting... Witin PuTTY Reconfiguration, from left hand sidebar, click on Window > Set the size of the window > Columns. Update the Column value manually, I changed mine to 255 and that stop terminal overwriting on its own line (when I type).enter image description here



                      enter image description here






                      share|improve this answer


























                        0














                        For those using PuTTY terminal (v0.67) and terminal size is not updated correctly. You can do right click on the window's left hand icon, select Change Setting... Witin PuTTY Reconfiguration, from left hand sidebar, click on Window > Set the size of the window > Columns. Update the Column value manually, I changed mine to 255 and that stop terminal overwriting on its own line (when I type).enter image description here



                        enter image description here






                        share|improve this answer
























                          0












                          0








                          0






                          For those using PuTTY terminal (v0.67) and terminal size is not updated correctly. You can do right click on the window's left hand icon, select Change Setting... Witin PuTTY Reconfiguration, from left hand sidebar, click on Window > Set the size of the window > Columns. Update the Column value manually, I changed mine to 255 and that stop terminal overwriting on its own line (when I type).enter image description here



                          enter image description here






                          share|improve this answer












                          For those using PuTTY terminal (v0.67) and terminal size is not updated correctly. You can do right click on the window's left hand icon, select Change Setting... Witin PuTTY Reconfiguration, from left hand sidebar, click on Window > Set the size of the window > Columns. Update the Column value manually, I changed mine to 255 and that stop terminal overwriting on its own line (when I type).enter image description here



                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 11 at 6:39









                          Nasri Najib

                          1011




                          1011






























                              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%2f171694%2fhow-do-i-keep-terminal-line-from-overwriting-itself%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

                              Mont Emei

                              Province de Neuquén

                              Journaliste