Long commands typed in bash overwrite the same line

9,633

Solution 1

Change your TERM variable. For instance, if I do

~$ export TERM=xterm

Then the behaviour is nicely wrap, like before your update

With

~$ export TERM=linux

The behaviour is the one after your update

This post on askubuntu may help you if you have a colored PS1.

Solution 2

Short answer:

echo "set horizontal-scroll-mode off" >> ~/.inputrc

Bit longer answer:

In an interactive bash shell, user input is handled by the READLINE library (look for it in bash man page to get more informations). Per bash documentation, the default behaviour is to wrap to a new line when the input is longer than the screen width. You can override this default by setting the horizontal-scroll-mode variable.

As you don't get the default behaviour you might want to check:

  • the file pointed by $INPUTRC to see if horizontal-scroll-mode is set. Worth noting that a readline variable is set if it reads to empty, null, on (case insensitive) or 1.
  • the configure options you used if you compiled your version of bash
Share:
9,633

Related videos on Youtube

vegatripy
Author by

vegatripy

Updated on September 18, 2022

Comments

  • vegatripy
    vegatripy over 1 year

    Since We updated Bash to 4.3.27 whenever I type a long command, if it reach the end of terminal window, instead of continuing in a new line, it overwrites over the same line using a ">" at the beginning to mark that the line was wrapped (I can go back and forward over the line. I mean, it doesn't just overwrites the current line)

    Something like:

    Lets say my terminal its 30 chars width

    Before update user@HOSTNAME ~$ echo "hello w orld!"

    After update <ME ~$ echo "hello world!"

    Nothing was changed in my environment since that bash update. $BASHOPTS shows the same values as it has before except "complete_fullquote"

    How can I restore the "multiline behaviour"?

    Regards

  • vegatripy
    vegatripy over 9 years
    Didn't worked. :\ . And yes, I use to have a coloured PS1 but this also happen in simplest PS1 uncoloured combinations
  • DaveGauer
    DaveGauer over 5 years
    Setting $TERM to xterm did the trick for me (tested with a PS1 with escape characters and one without (old-school > , which gave me some 1980 vibes). Interestingly, I had the undesired overwrite behavior with xterm-256color, so it's back to plain old xterm for me!