Xresources is a user-level configuration dotfile, typically located at
It can be used to set X resources, which are configuration parameters for X client applications.
Among other things they can be used to:
- configure terminal preferences (e.g. terminal colors)
- set DPI, anti-aliasing, hinting and other X font settings
- change the Xcursor theme
- theme XScreenSaver
- configure low-level X applications like: xorg-xclock, xpdf, rxvt-unicode
Install the xorg-xrdb package.
Load resource file
Resources are stored in the X server, so have to only be read once. They are also accessible to remote X11 clients (such as those forwarded over SSH).
Load a resource file (such as the conventional
.Xresources), replacing any current settings:
$ xrdb ~/.Xresources
Load a resource file, and merge with the current settings:
$ xrdb -merge ~/.Xresources
- Most Display managers load the
~/.Xresourcesfile on login.
- The older
~/.Xdefaultsfile is read when an X11 program starts, but only if xrdb has not been used in the current session. 
If you are using a copy of the default xinitrc as your
.xinitrc it already merges
If you are using a custom
.xinitrc add the following line:
[[ -f ~/.Xresources ]] && xrdb -merge -I$HOME ~/.Xresources
~/.xinitrc. Otherwise, programs launched after xrdb may look for resources before it has finished loading them.
To see the default settings for your installed X11 applications, look in
Detailed information on program-specific resources is usually provided in the man page for the program. xterm's man page is a good example, as it contains a list of X resources and their default values.
To see the currently loaded resources:
$ xrdb -query -all
The syntax of an Xresources file is as follows:
resource substring may contain a separator (
Class will never contain a separator). For example,
Dialog.bodyFont is a XScreenSaver internal resource that is specfied to set the body font and fallback font:
xscreensaver-auth.default.Dialog.bodyFont: times new roman 12, dejavu serif 12
- The name of the application, such as xterm, xpdf, etc
- The classification used to group resources together. Class names are typically uppercase.
- The name of the resource whose value is to be changed. Resources are typically lowercase with uppercase concatenation.
- The actual value of the resource. This can be 1 of 3 types:
- Integer (whole numbers)
- Boolean (true/false, yes/no, on/off)
- String (a string of characters) (for example a word (
white), a color (
#ffffff), or a path (
- A dot (
.) is used to signify each step down into the hierarchy — in the above example we start at name, then descend into Class, and finally into the resource itself. A colon (
:) is used to separate the resource declaration from the actual value.
Question mark (
?) and asterisk (
*) can be used as wildcards, making it easy to write a single rule that can be applied to many different applications or elements.
? is used to match any single component name, while
* is used to represent any number of intervening components including none.
Using the previous example, if you want to apply the same font to all programs (not just XScreenSaver) that contain the class name
Dialog which contains the resource name
headingFont, you could write:
If you want to apply this same rule to all programs that contain the resource
headingFont, regardless of its class, you could write:
For more information about wildcard matching rules see XrmGetResource(3) § MATCHING_RULES.
Lines starting with an exclamation mark (
!) are ignored, for example:
! The following rule will be ignored because it has been commented out !Xft.antialias: true
Note that the exclamation mark must be the first character on the line.
GNU CPP, installed to use this functionality.
To use different files for each application, use
#include in the main file. For example:
#include ".Xresources.d/xterm" #include ".Xresources.d/rxvt-unicode" #include ".Xresources.d/fonts" #include ".Xresources.d/xscreensaver"
If files fail to load, specify the directory to xrdb with the
-I parameter. For example:
xrdb -I$HOME ~/.Xresources
Getting resource values
If you want to get the value of a resource (for example if you want to use it in a bash script) you can use xgetresAUR:
$ xgetres xscreensaver.Dialog.headingFont -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1
The following samples should provide a good understanding of how application settings can be modified using an Xresources file. See this gist for more examples. Refer to the man page of the application in question otherwise.
- Color output in console#Terminal emulators
- Cursor themes#X resources
- Font configuration#Applications without fontconfig support
- xpdf(1) § OPTIONS
Display managers such as GDM may use the
--nocpp argument for xrdb.
No output from xrdb -query
It is not rare for
xrdb -query to output nothing. Try following #Load resource file and #xinitrc from above. And note some of the files mentioned there could be empty.
- Using the Xdefaults File - An in-depth article on how X interprets the Xdefaults file