xrdb - X server resource database utility


xrdb [-option ...] [filename]


The xrdb(1) utility is used to get or set the contents of the RESOURCE_MANAGER property on the root window of screen 0, or the SCREEN_RESOURCES property on the root window of any or all screens, or everything combined. You would normally run this program from your X startup file.

Most X clients use the RESOURCE_MANAGER and SCREEN_RESOURCES properties to get user preferences about such things as colors, fonts, and so on for applications. Having this information in the server (where it is available to all clients) instead of on disk solves the problem in previous versions of X that required you to maintain defaults files on every computer that you might use. It also allows for dynamic changing of defaults without editing files.

The RESOURCE_MANAGER property is used for resources that apply to all screens of the display. The SCREEN_RESOURCES property on each screen specifies additional (or overriding) resources to be used for that screen. (When there is only one screen, SCREEN_RESOURCES is normally not used, all resources are just placed in the RESOURCE_MANAGER property.)

The file specified by filename (or the contents from standard input if - or no file name is given) is optionally passed through the C preprocessor with the following symbols defined, based on the capabilities of the server being used:

The number of significant bits in an red-green-blue (RGB) color specification. This is the log base 2 of the number of distinct shades of each primary that the hardware can generate. Note that it usually is not related to PLANES.
One of StaticGray, GrayScale, StaticColor, PseudoColor, TrueColor, DirectColor. This is the visual class of the root window of the default screen.
Defined only if CLASS is one of StaticColor, PseudoColor, TrueColor, or DirectColor.
The height of the default screen in pixels.
The host-name portion of the display to which you are connected.
The same as SERVERHOST.
The name of the host on which xrdb(1) is running.
The number of bit planes (the depth) of the root window of the default screen.
The vendor release number for the server. The interpretation of this number will vary depending on VENDOR.
The X protocol minor version supported by this server (currently 0).
The X protocol major version supported by this server (should always be 11).
A string specifying the vendor of the server.
The width of the default screen in pixels.
The x resolution of the default screen in pixels per meter.
The y resolution of the default screen in pixels per meter.

Lines that begin with an exclamation mark (!) are ignored and can be used as comments.

Note that since xrdb(1) can read from standard input, it can be used to the change the contents of properties directly from a terminal or from a shell script.


The xrdb(1) program accepts the following options:
Perform the operation on the screen-independent resource property (RESOURCE_MANAGER), as well as the screen-specific property (SCREEN_RESOURCES) on every screen of the display. For example, when used in conjunction with -query, the contents of all properties are output. For -load and -merge, the input file is processed once for each screen. The resources that occur in common in the output for every screen are collected, and these are applied as the screen-independent resources. The remaining resources are applied for each individual per-screen property. This the default mode of operation.
-backup string
Generate a backup file with -edit, using string as a suffix appended to the file name used with -edit.
-cpp filename
Use filename as the C preprocessor program( CPP) to be used. Although xrdb(1) was designed to use CPP, any program that acts as a filter and accepts the -D, -I, and -U options can be used.
Define symbols for use with conditionals such as #ifdef; this option is passed through to the preprocessor.
-display display
Use the X server specified by display; X(5). It also specifies the screen to use for the -screen option, and it specifies the screen from which preprocessor symbols are derived for the -global option.
-edit filename
Edit the contents of the specified properties into the given file, replacing any values already listed there. This allows you to put changes that you have made to your defaults back into your resource file, preserving any comments or preprocessor lines.
Perform the operation only on the screen-independent RESOURCE_MANAGER property.
Print a brief description of the allowable options and parameters to be printed; any unsupported option causes the message to be printed.
Load the input as the new value of the specified properties, replacing whatever was there (that is, removing the old contents). This is the default action.
Instead of replacing the current contents of the specified properties, merge the input with it. This option does a lexicographic sorted merge of the two inputs, which is almost certainly not what you want, but remains for backward compatibility.
Display the result of the command without really doing it. Changes to the specified properties (when used with -load or -merge) or to the resource file (when used with -edit) are shown on the standard output but not performed.
Do not run the input file through a preprocessor before loading it into properties.
Print the current contents of the specified properties onto standard output. Since preprocessor commands in the input resource file are part of the input file, not part of the property, they will not appear in the output from this option. The -edit option can be used to merge the contents of properties back into the input resource file without damaging preprocessor commands.
Do not display warnings about duplicate entries.
Remove the specified properties from the server.
Do not reset the server if xrdb(1) is the first client. This should never be necessary under normal conditions, since xdm(1) and xinit(1) always act as the first client.
Perform the operation only on the SCREEN_RESOURCES property of the default screen of the display.
Perform the operation only on the SCREEN_RESOURCES property of each screen of the display. For -load and -merge, the input file is processed for each screen.
Print onto the standard output the symbols that are defined for the preprocessor.


Generalizes ~/.Xdefaults files.


Contains which display to use.


The default for no arguments should be to query, not to overwrite, so that it is consistent with other programs.


Copyright 1991, Digital Equipment Corporation and MIT.


Bob Scheifler, Phil Karlton, rewritten from the original by Jim Gettys



Xlib Resource Manager documentation

Xt resource documentation