Whenusing text-mode tools, chances are you want to take best advantage ofyour video hardware. Many Linux tools are written with a display ofroughly 80 characters by 25 lines with monochrome text in mind. Evenvery old IA-32 hardware, however, can display more and wider lines thanthis, and can display text in various colors. GUI xtermwindows are also much more flexible in their display capabilities.Knowing how to take advantage of these modes can make text mode muchmore appealing.
One of the problems faced during the earlydevelopment of Unix was the wide array of terminal hardware with whichthe OS had to cope. The codes that would clear the screen on oneterminal might have no effect on another, and they would cause a thirdto perform some wholly inappropriate action. Because of this, programscouldn't be written to use specific terminal codes to perform specificactions. The solution to this problem was to create a database ofinformation on terminal types. Originally, this database was known as termcap, and it relied on data stored in /etc/termcap. Newer programs use a more recent database known as terminfo, which stores data in files in the /usr/share/terminfo directory tree.
In both cases, programs rely upon the TERM environment variable to identify the terminal type. Examples of values this variable might hold include linux (for text-mode Linux logins), xterm (for xterm windows under X), and vt100 (for the popular DEC VT-100 terminal or any terminal or program that emulates it). Type echo $TERM in a shell to learn what terminal your system believes it's using.
Of course, you should change vt100, if necessary, to whatever value is appropriate. Try browsing through /etc/termcap and the filenames in the /usr/share/terminfodirectory to try to find one that matches the terminal or terminalemulator you're using. If you can't find a match, consult the terminalor terminal emulator's documentation; it may support another model'scodes. Failing that, the hardware or software may come with anappropriate termcap or terminfo database entry that you can add to your system.
Most IA-32 computers boot up in a basic videomode that displays 80 columns and 25 rows of text. By default, Linuxworks in this mode, but it's possible to change it in two ways. First,you can load a new font. You might do this in order to supportlanguage-specific characters or simply because you don't like thedefault font. Second, you can alter the screen resolution, yieldingmore or fewer columns or rows of text. You could do this to take betteradvantage of a large screen by displaying smaller text—or to help yousee the text on a small screen or to enlarge the fonts if you'revisually impaired.
The fontconfig utility isunique to Slackware. It presents a menu of font choices and enables youto try a font before setting it for your login session. If you want tomake the change permanent, fontconfig writes a startup script, /etc/rc.d/rc.font, which calls setfontto do the job every time the system boots. The location of the consolefont files and the packages from which they're installed varysubstantially from one distribution to another, as Table 5.5 shows.
Most console fonts are eight or nine pixels wideand between eight and sixteen pixels high. An 8 × 16 font yields 25lines of text. You can double the number of lines of text displayed intext mode by switching to an 8 × 8 font, or you can set an intermediatevalue with a font of another size.
Modifying the Kernel You can alter a kernel to use a specific video mode using the vidmode command. You pass numerical codes to be used as video modes; for instance, -2 enables an extended VGA mode that doubles the number of lines of the display. To use this mode, you'd type vidmode /boot/bzImage -2, where /boot/bzImageis your Linux kernel filename. One problem with this approach is thatit's difficult to test, because you must reboot before the new modetakes effect.
Passing Kernel Options You can pass options to thekernel using your boot loader to enable a specific video mode at systemstartup. For instance, if you use the Linux Loader (LILO), you can usethe vga=mode line in lilo.conf, where mode is normal for an 80 × 25 display or ext for an 80 × 50 display. Like modifying the kernel, passing kernel options requires a reboot.
Using SVGATextMode The SVGATextMode program (headquartered at http://freshmeat.net/projects/svgatextmode/)is a flexible program for setting text modes without modifying thekernel. You can set up text modes that aren't available in any otherway using this tool, and you can change the text mode without rebootingthe computer. Using this program overrides any options set in thekernel or by passing options to the kernel.
Chipset The Chipset line sets the video card chipset. The default value of VGAworks with most modern video cards, but you may be able to get more orbetter options by selecting your true video card. Comment out the Chipset "VGA" line by placing a hash mark (#)at the start of the line, then locate the appropriate line for yourvideo card and uncomment it. If you can't find an appropriate line, youmay need to use the generic VGA configuration. You must also change thechipset clocks configuration when you change the chipset.
Chipset Clocks Different video cards support different dot clocks, which are low-level timing parameters. The VGA configuration includes a single Clocks line that sets two dot clocks. The configurations for specific video chipsets include one or more Clocks lines that specify many additional video clocks. Comment out the VGA configuration's Clocks line and uncomment the Clocks lines for your target video card.
Default Video Mode The DefaultModeline specifies the video mode the program sets if it is not given anexplicit mode—80 × 25 is the default value. Change this line to readsomething else that you prefer, such as 132x50x8.Most modes are specified by the number of columns of characters bynumber of rows of characters by the character width in pixels. (Theassumption is that characters are 16 pixels in height.) You cansometimes omit the character width, and some modes are preceded byspecial characters, such as v116x48. Most of the latter half of the TextConfigfile is devoted to defining video modes, so you can pick a name fromamong these modes. You may want to leave this option alone until you'vetested several modes and found the one you like.
Disk Synchronization A line that reads Option "SyncDisks"flushes your disk cache before doing anything. This is a safety measurein case the program causes a system hang. Once you've tested theprogram, you can comment this line out to speed up operation.
Font Selection The FontProg line points the system at a tool to set console fonts. " You can also specify the location and names of font files that SVGATextModewill load to create various display sizes. Some distributions, such asSuSE, may override these values with others specified in other files,such as /etc/sysconfig/console.
Video Refresh Rates Locate the lines, which are commented out by default, that set the HorizSync and VertRefresh values. Uncomment these lines and enter the values used in your XFree86 configuration file (XF86Config or XF86Config-4, in /etc or /etc/X11).These values tell the system about your monitor's capabilities. You canalso find the horizontal and vertical refresh rate values for yourmonitor in its manual.
This example call configures the system to use a 132 ×50 display, using a 9-character-wide font. Try a few configurationsusing modes defined in the final half or so of the TextConfig file until you find one you like.
Once you've found a text mode that you like, you can set it as the default in the DefaultMode line in /etc/TextConfig. "Bypassing Automatic Configurations To Gain Control," to set this mode whenever the system boots.
Modern video cards can all produce colordisplays, even in text mode. Many text-mode programs, though, don'ttake advantage of this fact; they display plain text, possibly with afew effects such as bold or blinking text.
Linuxsupports a wide variety of text-mode programs, many of which are quitepowerful. Using these tools to their fullest without running X, though,requires that you be able to configure your text-mode environment totake advantage of your terminal, including setting features such asyour video mode and font. Using multiple virtual terminals can alsoimprove your productivity, as can knowledge of the many Linuxfile-manipulation commands, such as cp and mv.Combined, these tools make a text-mode Linux installation a powerfulsystem. Of course, you can also use text-mode programs from an xterm window under X, and get all the advantages of X in that way, too.