UPDATE: it appears to be related to GNU screen and termcap: see new clues at bottom.

I'm running Bash 4.3 on a small embeddable device, and having a problem convincing it that I have more than 80 columns in my terminal.

If I type a command that goes past 80 columns, instead of continuing (the best case) or wrapping to the next line (acceptable but not ideal) it begins putting new characters on the same line that I'm typing on.

If I run

set | grep COLUMNS

I see COLUMNS=80. But if I try to increase this

export COLUMNS=200

there is no change in behavior.

The prescription mentioned here of using shopt -s checkwinsize did not help.

Various details that could possibly be relevant:

  • The computer I'm connecting from is OS X 10.11.6.
  • My terminal is iTerm2 (Build 3.1.beta.4).
  • I've been opening a new terminal window each time to ensure fresh terminal settings.
  • the embeddable device is a C.H.I.P. Pro.
  • The C.H.I.P. Pro is running Debian:
    Linux chip 4.4.30-pro #1 SMP Wed Dec 21 01:50:18 UTC 2016 armv7l GNU/Linux
  • Bash is 4.3.30, compiled for ARM (of course):
    GNU bash, version 4.3.30(1)-release (arm-unknown-linux-gnueabihf)
  • I'm using GNU screen to connect to the C.H.I.P. Pro.
  • I've disabled my ~/.screenrc to get default settings.
  • The output of shopt is:

    autocd          off
    cdable_vars     off
    cdspell         off
    checkhash       off
    checkjobs       off
    checkwinsize    on
    cmdhist         on
    compat31        off
    compat32        off
    compat40        off
    compat41        off
    compat42        off
    complete_fullquote      on
    direxpand       off
    dirspell        off
    dotglob         off
    execfail        off
    expand_aliases  on
    extdebug        off
    extglob         off
    extquote        on
    failglob        off
    force_fignore   on
    globstar        off
    globasciiranges off
    gnu_errfmt      off
    histappend      on
    histreedit      off
    histverify      off
    hostcomplete    on
    huponexit       off
    interactive_comments    on
    lastpipe        off
    lithist         off
    login_shell     on
    mailwarn        off
    no_empty_cmd_completion off
    nocaseglob      off
    nocasematch     off
    nullglob        off
    progcomp        on
    promptvars      on
    restricted_shell        off
    shift_verbose   off
    sourcepath      on
    xpg_echo        off


  1. I just discovered that using screen's width command (C-a W) gives me the message "Your termcap does not specify how to change the terminal's width to 132."

  2. However, using width 300, width -w 300, and width -d 300 don't solve the problem.


I'd use resize: it updates the stty settings (which is what's lost by connecting directly to the embedded device — and also what's needed by screen).

resize is a command-line utility (developed with xterm), which checks for the actual screen-size (using VT100 escape-sequences) and updates stty to reflect that size as well as printing commands which can be executed to update environment variables.

Changing $COLUMNS within screen is not very effective, since screen "knows" how large the terminal screen is, and will interfere with programs that assume a different size.

| improve this answer | |
  • I was just looking at that command, but it appears to deal only with height of panes: gnu.org/software/screen/manual/html_node/Resize.html . I'm not splitting my window into different panes, and I'm having a problem only with the width. If I'm making some false assumptions or interpretations of the documentation, could you give an example of how to use resize to expand the width? – iconoclast Jun 30 '17 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.