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


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

121 thoughts on “How change display resolution settings using xrandr

  1. 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,

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

  3. 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 :-(

  4. 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).

  5. 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.

  6. 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?

  7. 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)

  8. 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.

  9. When I type xrandr i get an error message saying failed to get size of gamma for output default.
    Any tips/suggestions?
    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.

  10. 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.

  11. 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:
    # 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”

    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

  12. 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

  13. 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.

  14. 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.

  15. 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:

    # 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
    # default session
    Of course you got to use your own xrandr settings

  16. 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 😀 …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

  17. 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’??

  18. 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.

  19. 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

  20. 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).

  21. 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.

  22. 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 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.

  23. 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?

  24. 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

  25. 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.

  26. 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.

Leave a comment

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