HomeHome  PortalPortal  FAQFAQ  SearchSearch  RegisterRegister  Log in  

Share | 
 

 Managing the Text-Mode Environment

View previous topic View next topic Go down 
AuthorMessage
welan
Admin
avatar

Posts : 248
Join date : 2010-02-23
Age : 53
Location : snow drift in minnesota

PostSubject: Managing the Text-Mode Environment   Sat Mar 27, 2010 7:05 pm

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.
Using an Appropriate termcap or terminfo

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.

In most cases, Linux auto-detects the terminal type, soyou don't need to adjust it. Sometimes, though, this auto-detectiondoesn't work correctly. In these cases, you may need to set theterminal type manually. If the /etc/termcap file and /usr/share/terminfo directory tree contain appropriate entries, you can do so by setting the TERM environment variable, as shown here:

$ export TERM=vt100

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.
Modifying Console Fonts

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.
Setting the Console Font

You can adjust the size and appearance of text byaltering the fonts displayed by the video card. Linux provides severaltools designed to do this: consolechars, setfont, and fontconfig. Which tools are available depends upon which distribution you're using, as specified in Table 5.5.The first two programs work in a very similar way. Both take a numberof options, but you can usually run them by passing a font filename tothe command with -f (for consolechars) or -v (for setfont):

$ setfont -v /usr/lib/kbd/consolefonts/t.psf.gz

Distribution


Font-Setting Utilities


Package Holding Font-Setting Utilities


Package Holding Font Files


Location of Font Files

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.
Setting the Text Resolution

One key attribute of graphical video modes asused by X is their resolution—how many pixels are displayed, bothhorizontally and vertically. Text mode, too, sets a specificresolution. The combination of this resolution and the size of thecharacters that make up the font determine how many characters can bedisplayed on the screen. Therefore, one way to adjust the number ofcharacters displayed on the screen is to adjust the underlyingresolution. There are two ways to do this:

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.

Because SVGATextMode is so flexible and complex, it deserves more explanation. This program comes with Debian, Mandrake, and SuSE in the svgatextmode, SVGATextMode, and svgatext packages, respectively. This tool uses a configuration file, /etc/TextConfig,that's similar to the XFree86 configuration file. The defaultconfiguration file is set up to support video modes that should workwith any modern video card; but to get the most out of the package, youmust reconfigure several details:

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.

There are many other configuration options in /etc/TextConfig,but most of these relate to very advanced settings, such as definitionsfor new video modes. You can select from any video mode you like byspecifying it when you call the program; for instance:

# SVGATextMode 132x50x9

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.
Using Color in Text Logins

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.

One common use of color in text mode is in file listings as produced by ls. You can see this effect by typing ls --color. Some distributions configure themselves to use this option by default whenever you type ls. If yours doesn't, but if you want to use this feature, edit your ~/.bashrc file or a global shell configuration file, such as /etc/bashrc, to include the following line:

alias ls='ls --color'

_________________
An expert is a man who tells you a simple thing in a confused way in such a fashion as to make you think the confusion is your own fault. 
Back to top Go down
welan
Admin
avatar

Posts : 248
Join date : 2010-02-23
Age : 53
Location : snow drift in minnesota

PostSubject: Re: Managing the Text-Mode Environment   Sat Mar 27, 2010 7:07 pm

Summary

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.

_________________
An expert is a man who tells you a simple thing in a confused way in such a fashion as to make you think the confusion is your own fault. 
Back to top Go down
 
Managing the Text-Mode Environment
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» how to select text from a disabled field?
» Entering a time stamp in comment / text box?
» WEB DRIVER ALTERNATIVE FOR SELENIUM IDE WAIT AND WAITFOR TEXT PRESENT COMMAND
» Command for auto populated text verification.
» count of text

Permissions in this forum:You cannot reply to topics in this forum
SUSEUnbound :: Help Section :: Tips and Tweaks-
Jump to: