From time to time I see posts on various Linux forums asking how to set a screen resolution.
Often this results in a discussion about writing a configuration file, xorg.conf ( /etc/X11/xorg.conf )
While there is nothing wrong with writing a xorg.conf, xorg.conf is depreciated and writing an xorg.conf is intimidating to many users.
Using xrandr is potentially faster and easier.
How to use xrandr
First display a list of your monitor resolutions
xrandr -q
Note: If you do not see the resolution you desire listed, either your monitor does not support that particular resolution or you may need to install a driver (ati, intel, or nvidia are the big 3). The technical details of installing these drivers varies by graphics card and will not be covered in this blog.
Then set the resolution you want to use (change the “1400×1050″ to your desired resolution).
xrandr -s 1400x1050
Adjusting the dpi (dots per inch)
dpi refers to the resolution of your monitor (pixels per inch) and affects window decorations, window size, and font. See this page for additional information.
On many monitors xrandr will set the dpi automatically. When it does not, or if you prefer an alternate setting, you can try specifying a dpi manually.
xrandr --dpi 96 -s 1400x1050
If that fails, you can specify a dpi in ~/.Xdefaults
Open any editor and enter the following configuration:
Xft.dpi: 96
This dpi will then be applied to any new windows you open. Alternately you can log off and back on (no need to reboot).
If 96 is not the right size for your, try a smaller ( 72 ) or larger ( 135 ) value.
Dual monitors
To use xrandr to configure dual monitors, use the --right-of or --left-of options.
Example, using a nvidia card:
First list your monitors with xrandr, note the monitor names (in bold).
bodhi@zenix:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 4096 x 4096
DVI-I-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 520mm x 320mm
1920×1200 60.0*+
1600×1200 60.0
1680×1050 60.0
1280×1024 75.0
1280×960 60.0
1152×864 75.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 60.0
720×400 70.1
DVI-I-2 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 520mm x 320mm
1920×1200 60.0*+
1600×1200 60.0
1680×1050 60.0
1280×1024 75.0
1280×960 60.0
1152×864 75.0
1024×768 75.1 70.1 60.0
832×624 74.6
800×600 72.2 75.0 60.3 56.2
640×480 72.8 75.0 60.0
720×400 70.1
TV-1 disconnected (normal left inverted right x axis y axis)
Use xrandr to configure the monitors. Change the names “DVI-I-1″ and “DVI-I-2″ to the names of your monitors. You may also need to adjust the resolution and change “--left-of to” “--right-of”
xrandr --auto --output DVI-I-2 --mode 1920x1200 --left-of DVI-I-1
Has the same effect as
xrandr --auto --output DVI-I-1 --mode 1920x1200 --right-of DVI-I-2
Set a primary display
To set a primary display, use the --primary option.
xrandr --auto --output DVI-I-1 --mode 1920x1200 --primary --right-of DVI-I-2
Configuring xrandr to run when you log in
The method to do this varies by desktop and with most major desktop environments (gnome, kde, xfce) you would add the xrandr command to your start up options / applications.
With openbox, add the xrandr command to ~/.config/openbox/autostart.sh.
With fluxbox, use ~/.fluxbox/startup
Alternately, depending on your window manager, you can add the xrandr command to ~/.xinit
For a link on using ~/.xinit, see this fluxbox wiki page or, as an alternate, the Arch wiki Slim page.
Graphical tools
I am aware of 3 5 (thanks to charlie-tca and KenP) graphical font ends for xranadr : lxrandr , grandr, the grandr applet, ARandR, and Krandr.
lxrandr is a part of the lxde and is lightweight and fast, but does not have all of the xrandr options available.
grandr has more a few more options, including rotation, but again not all the xrandr options are available from the graphical interface.
grandr applet is a small application (gnome applet) that would run in your panel and similar to lxrandr allows one to set a resolution.
Krandr is a KDE applet to set your resolution.
arandr is similar to grandr, but IMO the interface seems less intuitive. Arandr will write a script for you to set your resolution at login.
For additional information on using xrandr, see the xrandr man page.