LinuxCommandLibrary

xrandr

Configure display resolution and orientation

TLDR

Display the current state of the system (known screens, resolutions, ...)

$ xrandr [[-q|--query]]
copy

Disable disconnected outputs and enable connected ones with default settings
$ xrandr --auto
copy

Change the resolution and update frequency of DisplayPort 1 to 1920x1080, 60Hz
$ xrandr --output [DP1] --mode [1920x1080] --rate [60]
copy

Set the resolution of HDMI2 to 1280x1024 and put it on the right of DP1
$ xrandr --output [HDMI2] --mode [1280x1024] --right-of [DP1]
copy

Disable the VGA1 output
$ xrandr --output [VGA1] --off
copy

Set the brightness for LVDS1 to 50%
$ xrandr --output [LVDS1] --brightness [0.5]
copy

Display the current state of any X server
$ xrandr [[-d|--display]] :[0] [[-q|--query]]
copy

SYNOPSIS

xrandr [options]

PARAMETERS

-v
    Show the xrandr version.

-q
    Query the server for its current state. This is the default action when no other option is specified.

-s or --size
    Sets the screen size to , specified as WIDTHxHEIGHT.

-r or --rate
    Sets the refresh rate of the current screen to .

-o or --orientation
    Sets the orientation of the screen. Valid options are normal, inverted, left, and right.

--output
    Specifies the output (monitor) to configure. Use xrandr -q to list available outputs.

--mode
    Sets the mode (resolution) for the specified output. Use xrandr -q to list available modes.

--pos x
    Sets the position of the specified output to (x, y) relative to the primary output.

--left-of
    Positions the specified output to the left of the .

--right-of
    Positions the specified output to the right of the .

--above
    Positions the specified output above the .

--below
    Positions the specified output below the .

--same-as
    Positions the specified output to overlap the .

--primary
    Sets the specified output as the primary output.

--off
    Disables the specified output.

--reflect
    Specifies the reflection to apply to the output. Valid options are normal, x, y, xy.

--scale x
    Specifies the scaling factors for the output.

--rotate
    Specifies the rotation for the output. Valid options are normal, left, right, inverted.

DESCRIPTION

xrandr is a command-line tool for managing monitor configurations in X Window System environments, commonly used in Linux. It allows users to query the current display setup, add or remove monitors, change screen resolution, refresh rates, orientation (rotation), mirroring, and positioning of displays relative to each other.
xrandr reads the configuration from the X server and provides a comprehensive interface to dynamically adjust the display configuration without requiring restarting the X server.
This tool is particularly useful in multi-monitor setups, laptop docking/undocking situations, and situations where the default display settings need to be overridden. xrandr commands can be scripted for automated configuration changes.

CAVEATS

Changes made with xrandr are often not persistent across reboots unless the commands are added to startup scripts or display manager configuration files.

EXAMPLE USAGE

Example 1: List current display configuration: xrandr
Example 2: Set resolution of VGA1 to 1920x1080: xrandr --output VGA1 --mode 1920x1080
Example 3: Extend the display to the right of HDMI-0 : xrandr --output HDMI-0 --right-of eDP-1

HISTORY

xrandr was developed as part of the X Window System project to provide a dynamic configuration tool for displays. It evolved to handle the increasing complexity of multi-monitor setups and the need for on-the-fly configuration changes. It became a crucial part of desktop linux distributions.

SEE ALSO

xorg.conf(5), xdpyinfo(1)

Copied to clipboard