Home » 2015 » June » 13 » XRANDR command : a command line interface to RandR extension, set screen size and orientation

6:27 PM
XRANDR command : a command line interface to RandR extension, set screen size and orientation

       xrandr [-help]  [-display display] [-q] [-v] [--verbose] [--dryrun] [--screen snum] [--q1] [--q12]

Per-output options
       [--output  output] [--auto] [--mode mode] [--preferred] [--pos xxy] [--rate rate] [--reflect reflection] [--rotate orientation] [--left-of output] [--right-of output] [--above output] [--below output] [--same-as output] [--set property value] [--off] [--crtc crtc] [--gamma red:green:blue]



       Xrandr is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size.

       If no option supplied, it will dump the state of the outputs, showing the existing modes for each of them, with a '+' after the  preferred mode and a '*' after the current mode.

"xrandr -q" and "xrandr --current" is same as "xrandr", they will display the current status of the system.


Commom usages:

1. Change the screen size and resolution of the system

Lets say I want to change the screen size/resolution of my Linux system, we can use --output and --mode options as below:

 --output output
              Selects an output to reconfigure. Use either the name of the output eg. default or the XID.


For  connected  but  disabled  outputs, this will enable them using their preferred mode (or, something close to 96dpi if they have no preferred mode).

For disconnected but enabled outputs, this will disable them.

--mode mode
              This selects a mode. Use either the name or the XID for mode. Choose any of the modes in the size list of xrandr command output.

 #>xrandr --output default --mode 1280x800

Here the mode given should be one of the modes in the output od xrandr without any options or else it will throw below error. 

shankar-desktop shankar # xrandr --output default --mode 1268x800
xrandr: cannot find mode 1268x800

Although you can change screen resolution and rotation of your system using GUI.  Go to Control Center--> Hardware --> Monitors



screen resolution



Set the rotation and reflection of screen

--reflect reflection
              Reflection can be one of 'normal' 'x', 'y' or 'xy'. This causes the output contents to be reflected across the specified axes.

--rotate rotation
              Rotation can be one of 'normal', 'left', 'right' or 'inverted'. This causes the output contents to be rotated in the  specified  direction.    'right' specifies a clockwise rotation of the picture and 'left' specifies a counter-clockwise rotation.

xrandr --output LVDS1 --rotate left
xrandr --output LVDS1 --rotate right
xrandr --output LVDS1 --rotate normal
xrandr --output LVDS1 --rotate inverted

Here LVDS1 is the monitor name.



--scale <x>x<y>

              Changes  the  dimensions  of  the  output  picture.

Values superior to 1 will lead to a compressed screen (screen dimension bigger than the dimension of the output mode),

and values below 1 leads to a zoom in on the output. This option is  actually  a  shortcut  version  of  the --transform option. Eg.

shankar-desktop-shankar#> xrandr --output LVDS1 --scale 0.8x0.8




Category: Open System-Linux | Views: 1312 | Added by: shanky | Tags: linux system display setting, screen scale and orientation, screen resolution, linux, xrandr | Rating: 5.0/1

Related blogs

You may also like to see:

[2015-04-23][Open System-Linux]
15 Great DATE command examples
[2015-06-03][Open System-Linux]
STAT command : check file or filesystem statistics
[2016-05-11][Open System-Linux]
An example to understand bash exit code $? in linux.
[2014-04-10][Open System-Linux]
SED command for filtering and transforming texts of a file using regular expression
[2014-02-19][Open System-Linux]
Some unique and special commands in Linux

Total comments: 0