5

I would like some 83(cols)x40(rows) size on my TTY, so:

xubuntu@xubuntu:~$ stty size
30 90
xubuntu@xubuntu:~$ stty cols 83 rows 40
stty: standard input: Invalid argument
xubuntu@xubuntu:~$ stty size
30 83

As can be seen in my example, cols=40 is not supported on my computer.
So I must try:

xubuntu@xubuntu:~$ stty rows 39
stty: standard input: Invalid argument
xubuntu@xubuntu:~$ stty rows 38
stty: standard input: Invalid argument
xubuntu@xubuntu:~$ stty rows 37
stty: standard input: Invalid argument
xubuntu@xubuntu:~$ stty rows 36
xubuntu@xubuntu:~$

...until I success.

Is there any way to directly set stty to its maximum? Maybe something like:

xubuntu@xubuntu:~$ stty rows max
  • 1
    I have never heard of this kind of limit! What kind of terminal are you running under? xterm? gnome-terminal? ssh? I cannot reproduce this. For me, stty rows accepts arbitrarily large numbers. – Celada Apr 30 '15 at 22:13
  • @Celada, just Ctrl+Alt+Fn. A single text mode terminal, not GUI. – Sopalajo de Arrierez Apr 30 '15 at 22:37
  • OP is referring to a Linux console quirk, as discussed here. – Thomas Dickey Jun 13 '16 at 23:43
4

stty is the wrong tool for this job. You want setupcon, which lets you choose a graphical font size to be displayed on the frame buffer console. The font size, combined with the resolution of the monitor, determines how many rows and columns you can see. stty is for telling a remote kernel you are accessing via a serial terminal what the actual size of your terminal display is.

1

See my functions from this post for a solution using terminal codes: https://unix.stackexchange.com/a/283206

1

As I pointed out in Set number of rows for gnome-terminal or other emulators:

Linux is unusual here: you can reduce the number of lines shown in the virtual console with that stty command (which makes an interesting effect with a virtual machine). Linux initializes the console to a mode which supports a given number of lines and columns. The stty command tells the console I/O driver to use less of it. A similar command to (attempt to) increase the size beyond the initialized mode limits fails.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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