January 7, 2010 · General · Email This Post

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

118 Comments to “How change display resolution settings using xrandr”

  1. Frank says:

    Suggestion.
    Everything worked out for me, still, there is one more thing to do.

    After finished the process, choose: System->Preferences->Monitor and make the new resolution default.
    Otherwise, after restart, it will return to previous, lower resolution.

    All the best,
    Frank

    [Reply]

  2. Mario says:

    Can’t make it permanent in ubuntu 11.10 beta 2, the etc/gdm/Init/Default files does not exist, any help here :S

    [Reply]

  3. Marco says:

    Running ubuntu 11.10 official release. Instructions work very well, but they are not persistent across reboots.
    /etc/gdm/Init/Default does not seem to exist like noted above :-(

    [Reply]

  4. J. says:

    Mario, Marco:

    Try looking for /etc/gdm3/Init/Default instead — Ubuntu 11.10 uses a newer version of gdm.

    I was able to successfully implement the commands in that file (using Debian sid).

    [Reply]

    Mario Reply:

    Couln’t find gdm3 inside the ~/etc or gdm folder, even with the “show hidden files” turned on.

    Also I wasn’t able to set the proper ratio for my external display no more, I used to be able in Natty to set 1024×768 6:9 but now I only get the 4:3 ratio option whenever I add that resolution using xrandr.
    :s

    [Reply]

  5. Michael says:

    Ubuntu 11.10 switched from gdm to lightdm. There is a lightdm folder under /etc with 3 configuration files. Perhaps placing the code there would work?

    [Reply]

    Michael Reply:

    Update:
    I added the code to lightdm.conf, restarted, and it preserved my settings.

    (Note: I never restarted before trying this, so I am only presumed that it wouldn’t have preserved these settings otherwise, as seems to be the case with those who posted above)

    [Reply]

    frakie Reply:

    What code did you placed in lighttdm.conf?
    Where did you place those lines?

    [Reply]

    Michael Turner Reply:

    Here’s the code, but there’s a problem with putting it in lightdm.conf

    xrandr –newmode “1280x720_60.00″ 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
    xrandr –addmode VGA1 1280x720_60.00
    xrandr –output VGA1 –mode 1280x720_60.00 –right-of LVDS1

    Keep in mind that that is the code for my monitor, generated using the steps in the tutorial above.

    It seems that lightdm.conf isn’t an appropriate place to put this. It seemed to work fine the first couple of times I restarted, but then it completely froze my system when starting up. I had to log in to the shell and manually edit the file to remove the code just to boot.

    For now, I just put it in a text file and set the permissions to allow it to be executable. When I start up, I double click on the text file, select “Run in Terminal” and it executes the code properly. I’m sure there is a way to set this script up to run on start up automatically, but I don’t know it off the top of my head and haven’t had the time to research it yet.

  6. dan says:

    When I type xrandr i get an error message saying failed to get size of gamma for output default.
    Any tips/suggestions?
    :S
    P.S I’m trying to change the resolution of ubuntu 11.10 to 1024×600 in order to be compatible with my Elonex Webbook and im using Terminal on the Webbook on an external 1024×768 TFT screen at 60 Hz.

    [Reply]

  7. Roger Watson says:

    Newbie, many thanks worked a treat but have a one inch space at right side of screen despite using 1280×1024 (Samsung’s recommended setting) Now have I have to find out how to stretch it that bit.

    [Reply]

  8. Nick Pavel says:

    This is for 11.10 oneiric. It works for me.
    I edited the file /usr/sbin/lightdm-session
    Here is how the first part of that file looks now:
    ——————————————
    #!/bin/sh
    #
    # LightDM wrapper to run around X sessions.

    echo “Running X session wrapper”

    # Load profile
    for file in “/etc/profile” “$HOME/.profile” “/etc/xprofile” “$HOME/.xprofile”; do
    if [ -f "$file" ]; then
    echo “Loading profile from $file”;
    . “$file”
    fi
    done

    xrandr –newmode “1368x768_60.00″ 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
    xrandr –addmode CRT1 1368x768_60.00
    xrandr –output CRT1 –mode 1368x768_60.00

    # Load resources
    ———————————-
    Of course you got to use your own xrandr settings

    [Reply]

    Mario Reply:

    Tried it in Oneiric but did not worked, after adding the lines for my “newmode” unity breaks down, as soon as I hook up the external LCD I can only move the mouse cursor, and the indicator bar just looks blank and without icons, after unplugging the LCD my laptop screen goes black and have to do a manual restart…. Thanks anyway Nick

    [Reply]

  9. Nick Pavel says:

    My box has a mobo with AMD APU E-350, which includes the Radeon HD 6310. The monitor is an Insignia LCD TV 32″ connected by VGA. This is not correctly recognized by Linux. Because of this I have to trick the system to recognize it by inserting those 3 xrandr lines in the file shown above.

    In your case, you should firstly activate (if it’s not already) the proprietary driver for your video (if it needs one), then seconly generate the xrandr lines with the LCD monitor connected(!) to your laptop, figure out which device (VGA0, DVI0, or VGA1, and so on)is the LCD monitor. Use those lines, for that device to insert in the file above.

    My setup works fine. I hope you get yours to work as well.

    [Reply]

    Mario Reply:

    My Dell Inspiron uses intel graphics and I’m using a Panasonic Viera LCD which I connect to the VGA port and xrandr settings that I’m trying to add are (I got them following this page tutorial with my LCD plugged in and tested them before, they used to work in Natty):

    xrandr –newmode “1368x768_60.00″ 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
    xrandr –addmode VGA1 1368x768_60.00
    xrandr –output VGA1 –mode 1368x768_60.00

    yet every time I add them to the lightdm-session file it does what I just describe above.

    [Reply]

  10. Nick Pavel says:

    This is for 11.10 oneiric lubuntu. It works for me.
    I edited the file /etc/lxdm/Xsession
    Here is how the first part of that file looks now:
    ——————————————–
    #!/bin/bash

    # use bash for “exec -l”, howto run login shell by /bin/sh ?

    xrandr –newmode “1368x768_60.00″ 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
    xrandr –addmode CRT1 1368x768_60.00
    xrandr –output CRT1 –mode 1368x768_60.00

    if [ $# -eq 1 -a -n "$1" ]; then
    LXSESSION=$1
    else
    # default session
    LXSESSION=/usr/bin/startlxde
    fi
    ————————————-
    Of course you got to use your own xrandr settings

    [Reply]

    Mario Reply:

    Hey Nick Pavel, I got it to work by removing the last line of the Xrandr (xramdr –output VGA1 –mode 1368x768_60.00) though I have to open the “displays” menu every time I hook up my LCD to set manually that resolution into that LCD :D …now I only have to figure out how to turn off my laptop screen with less steps that downgrading both screens to 800×600, then turning off the laptop screen and then setting the LCD resolution back to 1368×768 :S

    [Reply]

  11. Jakob Rantor says:

    I managed to change the lightdm resolution using xrandr, but it had to be called from a script. The instructions are here…. http://www.sudo-juice.com/lightdm-resolution/

    [Reply]

  12. Rick Beil says:

    Display resolution is broke. Network access is broke. Screens are no longer intuitive, and you can’t find the tools you need any longer. I know it is supposed to be progress, but am I the only one that wishes they would have left things alone when everything ‘just worked’??

    [Reply]

  13. justin says:

    To all you that wrote how to do this thank you so much been staring at half a screen for three days now i think i am sure that microsoft is out of my life.

    [Reply]

  14. renetka says:

    I have lenovo G555 laptop and the resolution to be placed is 1366-768 but the settings only 1024-768 and 800-600 working with original windows home premium 32bt samples and drivers but it did not can be downloaded from somewhere these settings resolution 1366-768 please help me

    [Reply]

  15. Even T says:

    Thanks for this!

    I keep getting the error message “Configure crtc 0 failed” after running the last command (“xrandr –output default –mode 1280×720″ in my case, I have been trying diffrent resolutions with the same result).

    [Reply]

  16. Gregg Aronson says:

    I get the same “Configure crtc 0 failed” My original screen configuration is goofed up differently. 1024 x 768 (4:3) aspect ratio is stretched across a 16:10 aspect ratio screen. The system I am trying to configure is an Asus eeepc 1201 HAB. I know it can be configured to the correct aspect ratio in Linux, because I have done it with Puppy Linux. I sure wish that Ubuntu had stuck to the original xorg.conf setup, or at least make it easy for users to use that option.

    [Reply]

  17. cvlosvdo says:

    Maybe it could be better to put these lines (these are for me):
    xrandr –newmode “1280x1024_60.00″ 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
    xrandr –addmode VGA1 1280x1024_60.00

    in a separate file named for example extraVGAmodes.sh or something else placed in /etc/profile.d directory.

    Of course for determining the right parameters You’ll have to follow the entire procedure in this thread, starting with the xrandr comman.

    [Reply]

  18. fnd_j says:

    I have problem in this step following:

    xrandr –addmode VGA1 1024x768_60.00
    xrandr: cannot find output “VGA1″

    after I use “–newmode” and then to next step I got that problem. So, What I have supposed to do?

    [Reply]

    kosh Reply:

    similar problem :(

    [Reply]

  19. Pawel says:

    I have 24″ 1920×1200 monitor in Pivot mode.
    I use nVidia drivers, so I have
    Option “RandRRotation” “1”
    in Screen section of my xorg.conf
    KDE’s display configuration panel is unable to change resolution when monitor orientation is not “normal” (rotated by xrandr), and is unable to change this orientation. KDE should rotate display to normal, change resolution and rotate back, like you have to do it using xrandr.
    So I use the following commands in xinitrc.common:
    xrandr –output default –mode 1920×1200
    xrandr -d :0.0 -o left # for display 0 or
    xrandr -d :0.1 -o left # for display 1

    [Reply]

  20. kosh says:

    xrandr: cannot find output “VGA1″
    :(
    how to fix that?

    [Reply]

  21. christopher says:

    The last step cannot be tried on Ubuntu 12.04 since /etc/gdm/Init/Default does not exist. In fact the folder /etc/gdm does not exist. Please give a method by which i can make the change permanent.

    [Reply]

  22. Mario says:

    Still same trouble with Precise as in oneiric I can do all the steps yet cant make changes permanent, and also cant change the ratio from 4:3 to 9:6.

    [Reply]

  23. bud says:

    For those who see “cannot find output VGA1″: have a look at YOUR output of the first command in this article.
    The line “xy connected to…” tells you what to write instead of VGA1, on my system it reads “default”.

    (nonetheless not working here because of “Configure crtc 0 failed”)

    [Reply]

  24. Pavel Nichkov says:

    Managed to set right resolution for Supra 32″ TV under Ubuntu 12.04: 1930×768 instead of 1024×768.
    However, could not automate the task. Does is use other configuration files?

    [Reply]

    hykloud Reply:

    You can copy and paste xrandr command lines into user’s ~/.xprofile file, then they’re executed when you log in.

    [Reply]

  25. Mike says:

    Thank you, this worked for me.

    [Reply]

  26. Pavel Nichkov says:

    hykloud, thanks a lot!
    I have edited the hidden .profile file and it worked.

    [Reply]

  27. Edward Coast says:

    This is very helpful! It’s important to add to tell the user to do a ‘xrandr’ command to see the name of their VGA. Mine was not VGA-1, but VGA-0.

    [Reply]

  28. Eduardo says:

    Excellent…

    u r a f…ing genius !

    Thanks.

    [Reply]

  29. RippingMyHairOut says:

    There seems to be a lot of answers for dual screens and monitors but these suggestions have actually now made my web book resort to a 640×480 resolution on which I can’t see a great deal, infact it’s impossible to read certain menu boxes due to there being no scroll bar. I had this problem at 800×600 let alone 640×480 but now I don’t even have the option to change it back. It will only display in 640×480 now. I’m looking for something in the region of 1024×768 plus. Can someone help?

    Gary

    [Reply]

  30. uranus says:

    Gary,
    do this:
    gary@his-terminal:~# xrandr
    To see what xrandr sees. You’ll get some output like this:

    gary@his-terminal:~$ xrandr
    Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 4096 x 4096
    DVI-I-1 disconnected (normal left inverted right x axis y axis)
    VGA-1 connected 1280×1024+0+0 (normal left inverted right x axis y axis) 356mm x 266mm
    1920×1440 60.0
    1856×1392 60.0
    1792×1344 65.0 60.0
    1920×1200 74.9 59.9
    1600×1200 75.0 70.0 65.0 60.0
    1680×1050 84.9 74.9 60.0
    1400×1050 85.0 74.9 60.0
    1280×1024 85.0* 75.0 60.0
    1440×900 84.8 75.0 59.9
    1280×960 85.0 60.0
    1360×768 60.0
    1280×800 84.9 74.9 59.8
    1152×864 75.0
    1280×768 84.8 74.9 59.9
    1024×768 85.0 75.1 75.0 70.1 60.0 43.5
    832×624 74.6
    800×600 85.1 72.2 75.0 60.3 56.2
    848×480 60.0
    640×480 85.0 75.0 72.8 72.8 66.7 60.0 59.9
    720×400 85.0 87.8 70.1
    640×400 85.1
    640×350 85.1
    TV-1 disconnected (normal left inverted right x axis y axis)

    Here my output VGA-1 is “connected”. The “*” asterisk denotes the active resolution and refresh rate.

    Then use “cvt” (or “gft”)

    gary@his-terminal:~# cvt 1024 768 60

    to get a modeline for 1024×768 with 60hz refresh rate

    cvt will spit out something like this:

    # 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

    I’m using openbox wm with no display manager right now so I just put this in a .scripts folder in my ~/ to be called with .config/openbox/autostart.sh

    Replace my lines with YOUR modes or you might blow up your screen!!!

    —shell script—

    #!/bin/bash
    # screenres
    #
    xrandr –newmode “1280x1024_85.00″ 159.50 1280 1376 1512 1744 1024 1027 1034 1078 -hsync +vsync &
    xrandr –addmode VGA-1 1280x1024_85 &
    xrandr –output VGA-1 –mode 1280×1024 –rate 85

    Name the file something like screenres.sh .

    Then:

    gary@his-terminal:~# chmod +x screenres.sh

    Then:

    gary@his-terminal:~# ./screenres.sh

    [Reply]

    amc_oldsarge Reply:

    Uranus,

    I have been messing around with trying to get my headless machine to display a particular resolution upon logon via VNC. It would only show 1024×768. My desire was to view at 1680×1050. Using your description as a template I was able to gain success. Here is what I did:

    I created a file called .xprofile in my home directory (/home/myusername/.xprofile or ~/.xprofile).

    I edited the file with the following text:

    #!/bin/bash
    # screenres
    #

    xrandr –newmode “1680x1050_60.00″ 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync &
    xrandr –addmode VGA-0 1680x1050_60.00 &
    xrandr –output VGA-0 –mode 1680x1050_60.00

    I saved the file and made it executable and rebooted.

    After the reboot, I logged on a my resolution was as I desired.

    Things I was missing in my .zprofile were: the 1st three lines and the ampersand (&) after the 4th and 5th lins.

    Thanks for the final push to success.

    [Reply]

Leave a Reply