How to change screen resolution using xrandr

Change the resolution on distros based on GNOME o KDE very simple. For those who use open box and derivatives, the matter is a bit more complicated. Most of the time, this results in a lengthy explanation of how to change the configuration file of the X server: xorg.conf, located in etc / X11.

Although there is nothing wrong with this method, xorg.conf has been deprecated and can be intimidating for many users.

Use xrandr it's more fast y simple. In addition, it has several graphical interfaces and can be used to other necessities very interesting, such as the configuration of dual monitors, etc.

How to use xrandr

First, list the different resolutions available for your monitor:

xrandr -q

In case the resolution you are looking for is not listed, it may be because your monitor does not really support it or you need to install a better driver (ati, intel, or nvidia).

Then, set the resolution you want to use (change "1400 × 1050" to the desired resolution):

xrandr -s 1400x1050

Adjusting the dpi

The dpi differs from the resolution of your screen (referenced as pixels x inch) and affects the decorations of the windows, the size of the same, the rendering of the fonts, etc.

On many monitors, xrandr will set the dpi automatically. If not, or if you prefer to change this configuration, you can specify it manually:

xrandr --dpi 96 -s 1400x1050

If that fails, you can specify the dpi in ~ / .Xdefaults

I opened an editor and put the following in that file:

xft.dpi: 96

This dpi will be applied to all the new windows you open. You can also log out to see the results of this change (no need to restart the system).

If 96 is not the right dpi for you, you can try 72 or 135.

Dual monitors

It is also possible to use xrandr to configure dual monitors. To do this, you must make use of the –right-of and –left-of options.

Here's an example, using an nvidia card:

First, list the monitors using xrandr.

xrandr -q

The result will be something like the following:

Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 4096 x 4096
DVI-I-1 connected 1920x1200 + 0 + 0 (izannormal 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 and 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 and axis)

Then 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

It has the same effect as:

xrandr --auto --output DVI-I-1 --mode 1920x1200 --right-of DVI-I-2

To set the primary monitor, use the –primary option:

xrandr --auto --output DVI-I-1 --mode 1920x1200 --primary --right-of DVI-I-2

Configure xrandr to boot at startup

This method varies depending on the desktop environment you use (gnome, kde, xfce).

In openbox, add the xrandr command in ~ / .config / openbox / autostart.sh.

In fluxbox, do the same operation but in the file ~ / .fluxbox / startup

Depending on the desktop environment you use, you can add xrandr in ~ / .xinit

Graphical tools

There are very good graphical interfaces for xrandr. Among the best known, we can mention lxrandr, grandr, krandr and arandr.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Alex said

    Good post, some time ago I wrote an article on how to configure two screens under openbox and also generate random wallpapers for each of the screens: link

  2.   Guests_92839 said

    Let's see if I understand ... imagine that I do not have the resolution I want on a monitor, with any of those graphical interfaces will I be able to create that resolution and get it to work at startup?

    And, where do I put that file (in the case that with the graphical interfaces it is not possible) for example in Gnome and KDE ?.

    Thank you very much, I've been looking for a solution to the resolution problem for a long time, but everyone put it with the Xorg file, conf, but that file in the newer versions of the distros is no longer used.

  3.   Let's use Linux said

    If the resolution you want does not appear in the interface that GNOME or KDE brings to change the screen resolution, then you can try this method, yes. In any case, it is VERY likely that if the screen resolution you are looking for does not appear, it is because it is NOT supported by your monitor. Sure, there are exceptions to this rule but they are usually very rare. Hug! Paul.

  4.   Guests_92839 said

    No, in my case my monitor has a maximum and native resolution of 1366 × 768, in Windows it works perfectly well with the Intel driver, the monitor is an emachines (maybe it is because of the brand) .In contrast, in all distros GNU / Linux the maximum resolution was 800 × 600 or 1024 × 600, depending on the distro, but from there it did not go up. I tried with all the distros, but only in one did the correct resolution appear without using the xrandr and cvt commands my monitor, in Ubuntu 10.10, but was unable to use the graphic effects, I don't know why, not even updating ...

    So I'm going to test what you've put here, and I'll tell you if it works ...

    PS: it is strange, because on my brother's HP monitor, which has a native resolution of 1600 × 900 I had no problem with the resolution, I have a theory that it may be because my monitor is not supported or is not recognized by the kernel hardware recognition system.

    A greeting.

  5.   Steve said

    It has worked for me in a resolution configuration failure that has occurred in LinuxMint in my case 12. For some reason when starting the system it does not recognize the resolution of my monitor. But I have solved it by installing 'grandr', creating an icon on the desktop that I must use every startup of the Desktop. I also used 'lxrandr' but I adapted better with 'grandr'. Definitely highly recommended 'grandr'. Greetings 🙂

  6.   Max jonathan said

    I use a script on my netbook that makes use of xrandr, it allows me to use unsupported resolutions or at least not listed by default, since the maximum is 1024 × 600 and with the script I can set it to 1280 × 750
    http://dl.dropbox.com/u/44801426/newrez
    It not only works for gnome, I use it in XFCE
    I can't remember the source where I found it, but just google it; D

  7.   Hang1 said

    I use Xrandr to rotate the desktop position on the netbook only when I really need to, because it gets painfully slow. When I'm done using it I have to kill it and restart X.

  8.   Invites_92839 said

    Could someone tell me why?

  9.   Andrew said

    Hello friend I have the following problem in a centos version 4
    My knowledge of Linux is practically nil and when I try to enter the graphical environment I get an unsupported input message.
    I tried to change the configuration using that method that you explain here and I get Can't open display (null)
    Please tell me how I can do to restore the monitor configuration since using the setup option it does not work either

    Thanks for the help you can give me

    1.    let's use linux said

      It would be nice if you put exactly the commands you enter and the full error messages.
      Cheers! Paul.

    2.    Neutron Poncho said

      This command is used when you are already inside the graphical system (X server). In your case, the graphical system does not start, first you have to make the graphical system that is Xorg start.

  10.   Jonatan said

    I know it's been a long time since the post but someone could tell me how to file the changes in xubuntu would be of great help thanks

  11.   alvaro said

    Thanks for the post you helped me a lot now my screen looks super!

  12.   john said

    Hello, your tutorial has been very useful, I am only one step away from finishing and I would like you to explain to me better how I can start the session, I have xubuntu installed. Cheers

  13.   Rodrigo said

    Flawless thank you very much!