How change display resolution settings using xrandr

Sponsored Link
Xrandr is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size. There are a few global options; the rest modify a particular output and follow the specification of that output on the command line.
Open the terminal and run the following commands

First you need to enter the following command

$ xrandr

This will display the allowed resolutions

Sample output

Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA1 connected 800×600+0+0 (normal left inverted right x axis y axis) 267mm x 200mm
800×600 85.1* +
640×480 75.0 60.0
720×400 70.1

If you want to add a mode with resolution 1024X768, you can enter the following command: (The output is shown following.)

$ cvt 1024 768

Sample output

# 1024×768 59.92 Hz (CVT 0.79M3) hsync: 47.82 kHz; pclk: 63.50 MHz
Modeline "1024x768_60.00″ 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

Now you need to create a modeline

$ xrandr --newmode <Modeline>

copy the modeline of the previous output to the place mode line

$ xrandr --newmode "1024x768_60.00″   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync

Now you need to add the above mode using the following command

$ xrandr --addmode VGA1 1024x768_60.00

here for VGA1 you have to use what ever that was there for $ xrandr output

$ xrandr --output VGA1 --mode 1024x768_60.00

Running these would change your resolution but this is temporary.these steps were done to make sure that these commands work

Now we need to make these changes permanent

Now you need to edit the default file

$gksudo gedit /etc/gdm/Init/Default

Look for the following lines

PATH=/usr/bin:$PATH
OLD_IFS=$IFS

and Add the the following lines below them

xrandr --newmode "1024×768″ 70.00 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

xrandr --addmode VGA1 1024x768_60.00

xrandr --output VGA1 --mode 1024×768

Save and exit the file

Credit goes here

Sponsored Link

Incoming search terms:

Related posts

119 thoughts on “How change display resolution settings using xrandr

  1. Excellent article – what a breath of fresh air! I had an issue with Ubuntu Lucid 64 losing my display resolution after I unplugged some hardware to test out a microphone. I tried every trick I could think of to get my good resolution back. (I think it has something to do with ATI dropping support for my older Radeon). Using this method, I was able to do one better and set the resolution to my monitor’s optimum (which it had never been able to do before).

    [Reply]

  2. when i type this command
    hahaha@ubuntu:~$ xrandr –newmode
    this comes
    bash: syntax error near unexpected token `newline’

    i am stuck here please help me out i want to set my resolution at 1024×768

    [Reply]

  3. hahaha@ubuntu:~$ cvt 1024 768
    # 1024×768 59.92 Hz (CVT 0.79M3) hsync: 47.82 kHz; pclk: 63.50 MHz
    Modeline “1024x768_60.00″ 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

    hahaha@ubuntu:~$ xrandr –newmode
    bash: syntax error near unexpected token `newline’

    I am stuck here please help me out here

    [Reply]

  4. Works for me temporarily Not so sure this file mentioned is the correct place to do this all else fails I guess I could just wack out a script for this

    [Reply]

  5. I had to re-install ubuntu 10.04. earlier i had no issue with the resolution, it was perfect, i.e. optimal, now the resolution has worsened. it is now 1024×768, 60 hz where as the optimal is 1440×900 60 hz. my monitor is DEll E178WFP. please help to solve this problem.
    Indranil.

    [Reply]

  6. @Danial Khan
    It seems you don’t have xrandr
    install it.
    or
    after the newmode you have to give the you received from the cvt command, especially after Modeline.ie.
    “1024x768_60.00? 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

    [Reply]

  7. $ xrandr –newmode “2048x1152_60.00″ 197.97 2048 2184 2408 2768 1152 1153 1156 1192 -HSync +Vsync

    $ xrandr –addmode LVDS1 2048x1152_60.00
    X Error of failed request: BadMatch (invalid parameter attributes)
    Major opcode of failed request: 150 (RANDR)
    Minor opcode of failed request: 18 (RRAddOutputMode)
    Serial number of failed request: 33
    Current serial number in output stream: 34

    Im stuck here, please help me

    [Reply]

  8. And this, ladies and gentlemen is why Linux and xfce will never reach mainstream. Helpful as the posting was to geeks can you imagine your ‘average man in the street’ trying to do this.

    They’ll switch to Windows and be happy with it.

    I’ve spent 25 years managing developers trying to move away from this abstruse bullshit way of setting up systems.

    [Reply]

  9. Just switched from Windows 7 to Ubuntu 10.10 and this helped me get my displays exactly like I wanted them. An additional handy tip is that you can designate the primary monitor by adding:

    xrandr –output VGA-1 –primary

    Substitute the name of the monitor you want for VGA-1. To find out what monitors you have, use:

    xrandr –prop | grep “[^dis]connected” | cut –delimiter=” ” -f1

    That will show you a list of their name(s).

    Cheers!

    [Reply]

  10. Can anyone suggest how to make the changes permanent in KDE environment ?
    The xrandr commands work fine in my case, but I’m on Kubuntu and obviously there is no gdm file. I don’t know where to add the lines…

    [Reply]

  11. It is working for me. but the change is not permanent. Once, i shut down, it is back to the same problem. every time i have to do all the steps. I have edited the default file also, but that does not solve the problem. Please do help. Indranil.

    [Reply]

  12. BTW my earlier post was “I had to re-install ubuntu 10.04. earlier i had no issue with the resolution, it was perfect, i.e. optimal, now the resolution has worsened. it is now 1024×768, 60 hz where as the optimal is 1440×900 60 hz. my monitor is DEll E178WFP. please help to solve this problem.
    Indranil.”
    Indranil.

    [Reply]

  13. Congratulations! This article solved my problem. Thank you very much!!!

    My Best Regards,

    [Reply]

  14. hi friends i am from chennai…
    latest user of ubuntu can any one help me….
    i did all the comments as above here is my steps

    when i give the first comment

    xrandr
    Screen 0: minimum 320 x 200, current 800 x 600, maximum 8192 x 8192
    VGA1 connected 800×600+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
    800×600 60.3*
    640×480 59.9

    2nd
    $ cvt 1024 768
    # 1024×768 59.92 Hz (CVT 0.79M3) hsync: 47.82 kHz; pclk: 63.50 MHz
    Modeline “1024x768_60.00″ 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

    on the third comment i face the problem

    xrandr –newmode “1024x768_60.00? 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
    X Error of failed request: BadName (named color or font does not exist)
    Major opcode of failed request: 149 (RANDR)
    Minor opcode of failed request: 16 (RRCreateMode)
    Serial number of failed request: 21
    Current serial number in output stream: 21

    [Reply]

  15. It worked for me, I’m on 11.04 with Inspiron 1720 I was not getting the proper resolutions for my external LCD monitor (panasonic Viera) I actually entered two new resolutions after the command

    $gksudo gedit /etc/gdm/Init/Default

    [Reply]

  16. When I put this code
    sayed@sayed-desktop:~$ xrandr --newmode

    I got this result
    sayed@sayed-desktop:~$ xrandr --newmode
    bash: syntax error near unexpected token `newline'

    [Reply]

  17. Same problem, any ideas?

    When I put this code
    sayed@sayed-desktop:~$ xrandr –newmode

    I got this result
    sayed@sayed-desktop:~$ xrandr –newmode
    bash: syntax error near unexpected token `newline’

    [Reply]

  18. @Ellen O’Day, you wrote:
    “And this, ladies and gentlemen is why Linux and xfce will never reach mainstream. Helpful as the posting was to geeks can you imagine your ‘average man in the street’ trying to do this.

    They’ll switch to Windows and be happy with it.

    I’ve spent 25 years managing developers trying to move away from this abstruse bullshit way of setting up systems.”

    Ellen, I had to laugh a bit at this – so how do your developers troubleshoot anything that does not work? Don’t they have to review verbose log files?

    I can’t imagine a developer worth a grain of salt who will not say, “this method using xrandr is far superior to the old way of modifying the xorg.conf”… Then again, most developers I know are not myopic and limited to your draconian windows-only IDE and not have to do any actual code debugging. I can only imagine what kind of developer you are breeding, and what restrictions of what languages they can develop on. Sad really…

    [Reply]

  19. Im sorry but this is BS.

    Im not fan of windows and I love Linux but this is the most horrible, horrible way of doing meat and potatoes desktop config that I have ever had the misfortune to witness.

    OMFG.

    No wonder the Windows/Apple fanbois are laughing their fucking asses off.

    [Reply]

  20. Great post – thankyou so much! Sure, it wasn’t quite as simple as Windows, but was still a lot easier than things have been in the past. At least i didn’t have to mess around with sync ranges, which has always been a problem because my monitor is a pain in the *$%.

    Now got my Yuraku YV216WB2 working with Ubuntu 11.04 using the following three lines:

    xrandr –newmode “1280x1024_60.00″ 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
    xrandr –addmode VGA1 1280x1024_60.00
    xrandr –output VGA1 –mode 1280x1024_60.00

    Hope this shows up in google for somebody else with the same problem one day :)

    Thanks again
    Rolf

    [Reply]

  21. Man, thanks a lot. My resolution messed up after I connected to KVM switch (Keyboard & Monitor). Finally succeed to put the correct resolution back thanks to this tutorial.

    All the best,
    Frank

    [Reply]

Leave a comment

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