Bash: window size is too short, how do I change it?
So I’m logged on to a Linux server using Bash shell over an ssh connection using Poderosa client.
When I time a long command for some reason the cursor at some point moves over to the beginning of the same line overwriting the command and everything becomes a mess. This is specially annoying while typing something you would like to cut and paste on an email for example.
So, what’s going on?
Bash has a variable that reports the number of columns setup:
$ echo $COLUMNS 80
Interesting, it is configured for 80 columns but my terminal window has 137 columns. Why is that?
There’s a Bash setting that will adapt the window size after each command:
checkwinsize- If set, Bash checks the window size after each command and, if necessary, updates the values of
LINESandCOLUMNS.
Let’s see what is it’s current value:
$ shopt -p | grep checkwinsize shopt -u checkwinsize
That means it is disabled… Let’s enable it:
$ shopt -s checkwinsize
Now it is enable. Let’s check the COLUMNS value now:
$ echo $COLUMNS 137
Great!