Blog → Post


(TIP) xrandr: Changing screen resolution
...tips to ease the move to Linux
by @News, june 11, 2019, 12:10am utc

Something that can be a pain on Windows is programmatically altering the screen resolution. Not through GUI tools, but running a script or simple utility to do so.

On Linux, xrandr is the answer to this. xrandr allows for live (re)configuration of the X server without restarting it.


You can start off with what what your current setup is by running xrandr:

$ xrandr Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192 DP-1 connected primary 1680x1050+0+0 (normal left inverted right x axis y axis) 531mm x 299mm 1920x1080 60.00 + 50.00 59.94 59.99 1920x1080i 60.00 50.00 59.94 1680x1050 59.88* 1280x1024 75.02 60.02 1440x900 59.90 1280x960 60.00 1366x768 59.79 1280x800 59.91 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 75.03 70.07 60.00 832x624 74.55 800x600 72.19 75.00 60.32 56.25 720x576 50.00 720x480 60.00 59.94 640x480 75.00 66.67 60.00 59.94 720x400 70.08 HDMI-1 disconnected (normal left inverted right x axis y axis) DP-2 disconnected (normal left inverted right x axis y axis) HDMI-2 disconnected (normal left inverted right x axis y axis)

$ # To just list out your current monitor(s) $ # (in BASH, '#' on a line is a comment -- and will not execute what follows.) $ xrandr --listmonitors Monitors: 1 0: +*DP-1 1680/531x1050/299+0+0 DP-1

Then you can move on to make changes.

$ # IMPORTANT! --dryrun gives you a way out of your change. $ # dryrun will just list out what the changes *would* be. $ # $ # To TEST switching this monitor from 1680x1050 to 1440x900 $ # $ xrandr --output DP-1 --mode 1440x900 --dryrun crtc 0: disable screen 0: 1440x900 381x238 mm 95.94dpi crtc 0: 1440x900 59.90 +0+0 "DP-1"

$ # ... and then, to actually go forth to make the change: $ # $ xrandr --output DP-1 --mode 1440x900 $ $ # Like most CLI commands, if it works, there will be no output.


Using other xrandr parameters, you can alter the screen's refresh rate, the orientation of the monitor, which of multiple monitors is the preferred one, and a number of other settings.

See xrandr --help for more options.

read more.

tags: All users, Tips
Footer done in Inkscape