A sample XFree86Config file

That's one big file alright !

On a Red Hat distro, this file lives in /etc/X11/ . Before editing, you should save the original file to eg. XF86Config.orig. It looks pretty big, but when you remove all the comments, it looks more reasonable. Besides, most of the stuff can be left as is, and you'll only have to play with three sections: Your video setup ([Screen] section) is composed of two sections : [Device], which is the video adapter, and [Monitor], which is, er; the monitor. In other words, Screen = Device + Monitor.
 

Important data to collect beforehand

The first thing to do, is to check the features of your video adapter and your monitor in the manual or on the manufacturer's web site. As far as the video adapter is concerned, you'll want to know the name of the manufacturer, the chipset used on your particular adapter, the amount of on-board RAM. To avoid customizing their PCB (the board itself), manufacturers typically do not print the name under which their video adapter is sold, so you should read what it says on the chipset to known what kind of adapter you have (eg. ATI/Rage Pro, S3, Matrox/MGA, etc.)

As for the monitor, check what maximum refresh rates it supports for vertical (in Hz) and horizontal (KHz). An average upper limit for vertical refresh rate on a 17" monitor is about 100Hz for higher end products, while an average maximum horizontal rate would be about 100KHz.

Documentation on X often warns you that you could fry your monitor if you set a maximum rate that is higher than your monitor actually supports, but today's monitors are typically multi-sync, are built to withstand this kind of error for a short period of time, and as long as you don't try rates that are obviously unreasonable for  your particular monitor, it's safe to go by trial and error for a few minutes until you get it right. At least my 3-year old 17" Targa monitor didn't blow up during the past two years I spent learning about Linux :-)
 

Anatomy of the beast

Below is the XFree86Config file I use on that older 17" monitor and a PCI Matrox adapter with 4Meg of on-board RAM. You'll get much better video with cutting edge monitors like Iiyama or Sony, and AGP adapters.
Section "Files"
    RgbPath "/usr/X11R6/lib/X11/rgb"
    FontPath   "unix/:-1"
EndSection
Section "ServerFlags"
EndSection
Section "Keyboard"
    Protocol    "Standard"
    AutoRepeat  500 5
    LeftAlt        Meta
    RightAlt        Meta
   ScrollLock      Compose
   RightCtl        Control
   XkbKeycodes     "xfree86"
   XkbTypes        "default"
   XkbCompat       "default"
   XkbSymbols      "us(pc101)"
   XkbGeometry     "pc"
   XkbRules        "xfree86"
   XkbModel        "pc101"
    XkbLayout       "fr"
EndSection
Section "Pointer"
    Protocol    "PS/2"
    Device      "/dev/mouse"
EndSection
Section "Monitor"
    Identifier  "Generic Multisync"
    VendorName  "Unknown"
    ModelName   "Unknown"
    HorizSync   30-58
    VertRefresh 50-85
    # 1024x768 @ 70 Hz, 56.5 kHz hsync
    Modeline "1024x768"    75    1024 1048 1184 1328   768  771  777  806 -hsync -vsync
EndSection
Section "Device"
    Identifier  "My Video Card"
    VendorName  "Unknown"
    BoardName   "Unknown"
    VideoRam    4096
EndSection
Section "Screen"
    Driver      "svga"
    Device      "My Video Card"
    Monitor     "Generic Multisync"
    Subsection "Display"
        Depth       16
        Modes       "1024x768"
        ViewPort    0 0
    EndSubsection
EndSection
I showed the important parameters in bold letters.
 

"Monitor" section

In the "Monitor" section, the maximum rate of the HorizSync and VertRefresh must match what your monitor actually supports. To avoid hurting your eyes when spending all that time in front of your computer, you must set vertical refresh rate to above 70Hz. A quick and easy test to see if it is set high enough, is to start in graphic mode (If you didn't get X running yet, try with the Other OS), open a window with a lot of white in it (eg. NotePad in Windows), and look about 10 inches/25 cm above the monitor. You can tell if the picture is stable (good) or flickering (not good). If the latter, you're killing your eyes.

The second important parameter in this section is the Modeline. Once you have X running with the right definition (eg. 1024x768), you can run character-mode application xvidtune to tune up this setting, but to get X started, the numerous Modeline lines in the original file should be good enough. Check the comments above each line, and see whether any matches the horizontal and vertical refresh rates you indicated in this section. In the file above, I only kept the Modeline that matched my monitor : I told X that its top horizontal refresh rate was 58KHz and its top vertical refresh rate was 85Hz, so the only Modeline that matched is this one (56.6Khz as horizontal rate, and 70Hz as vertical rate.)

Most likely, you'll find more fine-tuned Modeline settings on the web once you got X running. Check www.xfree86.org for more.
 

"Device" section

The only important setting here is the amount of on-board RAM. The more RAM, the more colors and the higher the definition.
 

"Screen" section

This is where the monitor and device sections are turned into your actual video setting. Driver must match the X server that is installed in your host, eg. XFree86_SVGA in this case. On a Red Hat distribution, this program lives in /usr/bin/, and there's a symlink in /etc/X11/ which is X.

Device and Monitor must match the Identifier setting in the Device and Monitor sections so X can find them.

Depth is the number of colors you want to use (16 is 16-bit color; 8 is 8-bit color, ie. up to 256 colors.)

Modes is the screen definition you want to use. If there are several Modelines in your Monitor section, you can have several Modes setting, eg. Modes "1152x864" "1024x768" "800x600", which lets  you switch definition by using the CTRL-ALT-+ key combination.
 

Fine tuning X

Once you have X running, open a terminal window and run xvidtune to finish setting up the Modeline parameter. xvidtune will let you change the left/righ/up/down setting along with making the picture narrower/wider/smaller/taller. Once you're satisfied with the result, click on Fetch, and xvidtune will paste the current setting in the terminal window, which you can then copy/paste with the mouse into your XFree86Config file.
 

The picture is curved on the sides!

That's because you set the maximum horizontal rate too high. Choose a smaller value.