How do I change the screen resolution using Ubuntu command line?

I installed Ubuntu and the resolution of the desktop is so big that it only shows about 50% of the screen, but is shows up normal while using command line.

What should I type in the command line to change the desktop screen resolution?


This worked for me:

Enumerate the names of all your video outputs, and the possible resolutions for those currently connected to a monitor:

xrandr -q

Choose the name of the output you wish to change the resolution of, and:

xrandr --output <OUTPUT> --mode 1024x768

Note: If running from a text terminal, that is not running in gfx environment, you'll have to add a -d :0 parameter, i.e:

xrandr -d :0 -q
xrandr -d :0 --output <OUTPUT> --mode 1024x768

Change screen resolution:

Create a new resolution using cvt

$> cvt 1600 900 75
1600x900 74.89 Hz (CVT 1.44M9) hsync: 70.55 kHz; pclk: 151.25 MHz
Modeline "1600x900_75.00"  151.25  1600 1704 1872 2144  900 903 908     942 -hsync +vsync

Add a new mode to the existing list (newmode is the name and remaining portion is)

$ sudo xrandr --newmode "1600x900_75.00"  151.25  1600 1704 1872 2144  900 903 908 942 -hsync +vsync

Find the current display

$ xrandr | grep -e " connected [^(]" | sed -e "s/\([A-Z0-9]\+\) connected.*/\1/"
Virtual1

Add new display mode where <Virtual1> is the output from the previous command

$ sudo xrandr --addmode <Virtual1> 1600x900_75.00

This will add the new resolution to your existing list of supported resolutions. You can then choose the right option from the "display settings" or the following command

$ xrandr --output Virtual1 --mode "1600x900_75.00"

To make this change permanent,

$ cat> ~/.xprofile
sudo xrandr --newmode "1600x900_75.00"  151.25  1600 1704 1872 2144      900 903 908 942 -hsync +vsync
sudo xrandr --addmode Virtual1 1600x900_75.00
xrandr --output Virtual1 --mode "1600x900_75.00"

I know it is an old question but, for me, the simple stuff was to do:

$ xrandr -q

SZ: Pixels Physical Refresh
0 1024 x 768 ( 271mm x 201mm ) 75 70 60
1 800 x 600 ( 271mm x 201mm ) 85 75 72 60 56
2 640 x 480 ( 271mm x 201mm ) 85 75 72 60
*3 832 x 624 ( 271mm x 201mm ) *74
4 720 x 400 ( 271mm x 201mm ) 85
5 640 x 400 ( 271mm x 201mm ) 85
6 640 x 350 ( 271mm x 201mm ) 85

Or something equivalent. The * marks the screen resolution currently used. To change it to one of the supported resolutions from the list above simply run the command:

xrandr -s 800x600

and the resolution is changed.

Tested on Ubuntu 14.04

Update

Sometimes when there are a lot of refresh rates (the numbers to the right in the above sample results from xrandr -q), you need to specify the refresh rate. In that case, you should run the command:

xrandr -s 800x600 -r 85

Finally

If you have multiple outputs on your board, or the device is not reacting, then you can extend the above line with output. The value for the output is still found with xrandr -q, in my case HDMI-0. The command therefore becomes:

xrandr -s 800x600 -r 85 --output HDMI-0