I followed this tutorial and now I'm able to connect to serial line. Now I want to change the width of terminal. How can I do this by using screen or minicom or something else?
2 Answers
Serial connections don't have a standard way of setting terminal geometry. The assumed geometry is often 80x23 or 80x24 (terminals with zero to two status lines).
Once you're logged in, you can set your preferred geometry via the shell, using something like
stty rows 50 cols 132
This will last for the duration of your terminal session, but is not persistent across terminal sessions (e.g. logging out and logging in again).
Unfortunately, resizing the GUI window the terminal emulator runs in won't update this unless some cunning magic is taking place I'm entirely unaware of.
-
I also found that despite that
sh
might say thing likestty: number 0 is not in 1..2147483647 range
, setting to the maximum number would be silently ignored. But e.g. 500 works.– Hi-AngelAug 18, 2015 at 10:09 -
4
-
2For some reason in my docker container, "stty cols 132" does not fix the problem for me however "stty cols 132 && exec bash" does. "tput cols" shows it is updated but it does not fix until I re-run bash. Jan 3, 2018 at 22:42
-
Useful when I use Putty connect FreeBSD via Serial connection. Thanks! It would better if it can be set permanently in Putty.– obnewsSep 7, 2022 at 19:50
-
Instead of launching minicom by typing:
minicom
type the following instead:
TERM=linux minicom
-
Maybe/maybe not: minicom doesn't do anything with that value; you may have some application that assumes a particular geometry and sets the terminal size using
stty
. Oct 15, 2017 at 10:42 -
1I don't understand why, but hell it works exactly the way I want! Thank you sir! I suggest making alias in /etc/.bashrc for anyone that uses it frequently:: alias='TERM=linux minicom -s– While-EMar 19, 2018 at 17:57
-
@While-E, your alias is incorrect. Should it be
alias TERM='linux minicom -s'
??– lordhogApr 18, 2018 at 0:49 -
Above aliases don't work for me. Instead use
alias minicom='TERM=linux minicom'
(works w/ bash 4.4.12 in GNU/Linux Debian 9.6 stretch). Feb 28, 2019 at 3:18 -
1This specification of
TERM
works fine for e.g.vim
,journalctl
and some other programs, but not forman
,gdb
and maybe some more. For these I had to usestty cols 316 rows 94
.– RuslanAug 25, 2020 at 20:45