6

I connect to a Slackware server. When a command is longer than the size of the putty window, the line continues in the same line, and the start of the command disappears as I continue adding to the same command, just putting a "<" at the beginning of the line.

slackwareserver

When I work on the Red Hat server, I can see the whole command because the console just adds lines as it needs.

RedHatServer

I don't know where I turn on word wrapping. Where can I set the Slackware server to wrap words as my Red Hat server does? P.S.: Excuse my English.

4
  • 3
    Can you paste text as text. Images are hard to read, especially for blind people. When you do, I will up-vote. Commented Jun 17, 2019 at 18:08
  • There will be something in your ~/.bashrc file, ~/.profile, or one of the other configuration files, in your home directory. I have a setting that the command is always on the 2nd line. However I would be interested, in seeing how to make it more dynamic. If you find out for your self then post the answer here. Commented Jun 17, 2019 at 18:12
  • 1
    Related: unix.stackexchange.com/q/196038/117549 Commented Jun 17, 2019 at 18:34
  • 1
    If you use ksh, look at this question with no answer! here .I make a long time to understand that it come from ksh. Commented Jun 17, 2019 at 18:49

1 Answer 1

6

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

From man readline:

horizontal-scroll-mode (Off)
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 Off:

set horizontal-scroll-mode Off

Readline uses /etc/inputrc only if ~/.inputrc doesn't exist or cannot be read (~/.inputrc may also $include /etc/inputrc), so even if there's On in /etc/inputrc and you cannot or don't want to change it, you can always overwrite the setting by editing ~/.inputrc.

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.

1
  • "bind 'set horizontal-scroll-mode off'" works for macOS and centos, but may fail on some other systems. For example, I have tried it on Ubuntu 22.04, but it does not work. XXXXX# bind 'set horizontal-scroll-mode off' XXXXX# #short text <long text long text long text long text long text long text long text Commented Dec 30, 2024 at 12:48

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.