This may be because you're using
bash (or other shell which uses readline) and in your
~/.inputrc (or global
/etc/inputrc) you have
set horizontal-scroll-mode On
When set to
On, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line.
Solution: delete the line (the default setting is
Off) or explicitly set the option to
set horizontal-scroll-mode Off
/etc/inputrc only if
~/.inputrc doesn't exist or cannot be read (
~/.inputrc may also
$include /etc/inputrc), so even if there's
/etc/inputrc and you cannot or don't want to change it, you can always overwrite the setting by editing
The change won't automatically affect already running shells. You can reload the config with
bind -f ~/.inputrc
(see this), or change only that setting with
bind 'set horizontal-scroll-mode off'
The readline library will also fall back to
horizontal-scroll-mode if the
TERM environment variable is set to a terminal name not found in the terminfo database; you can check if that's the case with the
infocmp command. See here for how you can remediate the situation.
A similar interface (but displaying the
< mark at the right end of the line) is used in some pdksh-derived shells which do not use readline (notably
mksh, the default on Android). For that case there's no possible work-around.