I remember when I install X.Org for the first time, it troubles me what tool I should use to generate the /etc/X11/xorg.conf file. There are multiple choices: hwd, Xorg -configure or nvidia-xconfig (for NVIDIA users), or you can copy and paste an existing one (no warranty of compatibility).

From my own experience, since I use NVIDIA graphics card, the best tool is nvidia-xconfig. It generates a simple but applicable configuration file. The operations it performs can be found in the man page of nvidia-xconfig as follows:

nvidia-xconfig is a tool intended to provide basic control over configuration options available in the NVIDIA X driver.

nvidia-xconfig performs its operations in several steps:

  1. The system X configuration file is found and read into memory. If no configuration file can be found, nvidia-xconfig generates one from scratch using default settings; in this case, nvidia-xconfig will automatically determine the name of the X configuration file to create: /etc/X11/xorg.conf if the X server in use is X.org or /etc/X11/XF86Config if the X server in use is XFree86.
  1. The configuration in memory is modified to support the NVIDIA driver. This consists of changing the display driver to “nvidia”, removing the commands to load the “GLcore” and “dri” modules, and adding the command to load the “glx” module.
  1. The configuration in memory is modified according to the options specified on the command line. Please see the NVIDIA README for a description of the NVIDIA X configuration file options. Note that nvidia-xconfig does not perform any validation of the X configuration file options requested on the command line; X configuration file option validation is left for the NVIDIA X driver.
  1. The configuration is written back to the file from which it was read. A backup of the original configuration is created with “.backup” appended. For example, if your X configuration is /etc/X11/xorg.conf then nvidia-xconfig will copy it to /etc/X11/xorg.conf.backup before writing the new configuration. The –post-tree (-T) option can be used to print the new configuration to standard out in tree form instead. This option is useful to see what nvidia-xconfig will do while leaving the original configuration intact.

nvidia-xconfig also has some options for you to choose. The options, such as –no-logo, will be written into xorg.conf in a correct form as well.

Finally, there is a sample of /etc/X11/xorg.conf generated by nvidia-xconfig:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 256.44  (buildmeister@builder97.nvidia.com)  Thu Jul 29 02:00:07 PDT 2010

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"

Section "Files"

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "NoLogo" "True"
    SubSection     "Display"
        Depth       24
        Modes      "1280x800"