37

This question already has an answer here:

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?

marked as duplicate by hildred, Satō Katsura, GAD3R, Tim Kennedy, don_crissti Apr 4 '17 at 19:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

65

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 like stty: number 0 is not in 1..2147483647 range, setting to the maximum number would be silently ignored. But e.g. 500 works. – Hi-Angel Aug 18 '15 at 10:09
  • 4
    Extremely useful in Docker environment. Thanks a lot. – Shahriyar Imanov Apr 13 '17 at 11:52
  • 1
    For 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. – Curtis Yallop Jan 3 '18 at 22:42
5

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. – Thomas Dickey Oct 15 '17 at 10:42
  • I 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-E Mar 19 '18 at 17:57
  • @While-E, your alias is incorrect. Should it be alias TERM='linux minicom -s'?? – lordhog Apr 18 '18 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). – Elliptical view Feb 28 at 3:18

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