Change the number of rows and columns in the TTY

48,962

There are two major types of glass console on Linux: graphical and text modes.

You get graphical consoles if your video subsystem is supported by the Linux kernel directly, and you have enabled this / have not disabled this (depends on the distribution). If there's a driver, your screen will be autodetected and you'll get (by default) 9×16 pixel text at its native resolution. Then you'll have the opposite problem: tiny text. If CONFIG_FONTS and CONFIG_FONTS_* is enabled in the kernel, you can change the boot-time font to something larger, or you can just load a larger font after the system boots. There are two ways to change the resolution itself if it fails to autodetect:

  • The ‘gods, I feel so old’ way, with the kernel command line argument vga=, as detailed in this forum post. You'd need to reconfigure your boot loader for this, of course. The vga= option can get you both text (modes < 256) and VESA-compatible graphics modes (modes ≥ 256). The latter will be graphical but unaccelerated, so scrolling a very large framebuffer may look interesting, for slow values of ‘interesting’.
  • The new way, using Kernel Mode Setting. If you learn one of these, learn this one unless you're doing a lot of embedded or retro work. The vga= method may go away at some point.

If your video card isn't supported, its driver isn't loaded, etc, you'll find yourself with a text mode console. Text mode consoles are limited by the range of text modes of your graphics card. 80×25, 80×43 and 80×50 are the standard VGA ones. The original non-IBM VGA and SVGA cards always had nice additional text modes, but modern cards generally don't (‘who'd ever want text?’). There's a solution here: you can manipulate the VGA registers directly to reprogram the CRTC part of the chip to get higher resolutions. A 90s program called SVGATextMode could do this for you without kernel reconfiguration. It was a tiny bit like xrandr, but for text consoles, and may still work for you. I loved it: I could get something bizarre like 100×37 on my crappy 14" CRT. It made it decent for development back in 1994. To set a mode at boot time, your only recourse is to use vga= and use a VESA mode.

About the stty command: it tells the kernel about your terminal, but can't change the terminal itself. stty rows 200 will tell the kernel your remotely attached glass terminal has 200 lines per screen. Why this is the case is explained in the answers to this question.

Share:
48,962

Related videos on Youtube

BiGYaN
Author by

BiGYaN

I attack everything in life with a mix of extraordinary genius and naive incompetence; it is often difficult to tell which is which :P Presently I'm a student pursuing ME in CSE from IISc, India. I intend to specialize in Machine Learning techniques for large scale data. Usually I use C/C++ and occasionally Java to code along with Matlab. Of lately I have been fiddling around with Python, which seems to have brought back the "fun" part in programming.

Updated on September 18, 2022

Comments

  • BiGYaN
    BiGYaN over 1 year

    I want to resize the terminal which comes up when you press CtrlAltF1 (or F2,F3,...). 25x80 is small for a 24" screen.

    Tried using stty, but the commands stty columns 200 and stty rows 50 does not work directly. Am I missing something OR is this a wrong approach.

    Ideally looking for a generalized solution, but would be content with something that works in RHEL5 and Ubuntu. It would be better if its possible using some commands which I can put in a script file rather than changing some boot-level stuff.

    • BiGYaN
      BiGYaN over 10 years
      @jasonwryan, I checked that solution, but it involves modification of grub.conf. As I mentioned, I would prefer something which does not involve tinkering with boot-time files.
    • jasonwryan
      jasonwryan over 10 years
      You can change the size of the font without touching grub's config...
    • Auspex
      Auspex about 9 years
      yes, you probably can—but that other answer doesn't tell you how, and that's what I was looking for, too. I don't mind my console coming up with a tiny font most of the time, but right now, I want it bigger!
  • Rolazaro Azeveires
    Rolazaro Azeveires about 7 years
    I upgraded to kernel 4.4.49-16 (64bits) (with openSuse 42.2) and "vga=ask" started resulting in a error on startup (something as ask option not supported, I have not taken note of the exact sentence). Other options still result in no error, but anyway none of them seem to work for me (I'll take a look at the kernel mode one of these days...)
  • Rolazaro Azeveires
    Rolazaro Azeveires about 7 years
    Oh. Wait. It worked. But I had to reboot twice?... Not sure, I reboot rarely, maybe I did not on the first try...