Last Updated on 2021-09-03 by Clay
In the Linux operating system, it is sometimes difficult to find the interface for setting the second screen (after all, it depends on different distributions...). But sometimes, perhaps for the purpose of reporting, we may need to connect the computer to second screen.
So, how should we do? the answer is so easy. We open the terminal and use xrandr
command!
xrandr
is the official screen setting expansion tool, which can set the screen mode, adjust the resolution, rotation angle and so on. Of course, the most important thing for me is that it can be used to set the functions of the second screen.
The following is a simple record of how to use the xrandr
command!
xrandr introduction
Get screen information
In any case, the screen information must be obtained in the first step. Enter the following command:
xrandr
Output:
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
1920x1080 60.05*+ 60.01 59.97 59.96 59.93
1680x1050 59.95 59.88
1600x1024 60.17
1400x1050 59.98
1600x900 59.99 59.94 59.95 59.82
1280x1024 60.02
1440x900 59.89
1400x900 59.96 59.88
1280x960 60.00
1440x810 60.00 59.97
1368x768 59.88 59.85
1360x768 59.80 59.96
1280x800 59.99 59.97 59.81 59.91
1152x864 60.00
1280x720 60.00 59.99 59.86 59.74
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
1024x576 59.95 59.96 59.90 59.82
960x600 59.93 60.00
960x540 59.96 59.99 59.63 59.82
800x600 60.00 60.32 56.25
840x525 60.01 59.88
864x486 59.92 59.57
800x512 60.17
700x525 59.98
800x450 59.95 59.82
640x512 60.02
720x450 59.89
700x450 59.96 59.88
640x480 60.00 59.94
720x405 59.51 58.99
684x384 59.88 59.85
680x384 59.80 59.96
640x400 59.88 59.98
576x432 60.06
640x360 59.86 59.83 59.84 59.32
512x384 60.00
512x288 60.00 59.92
480x270 59.63 59.82
400x300 60.32 56.34
432x243 59.92 59.57
320x240 60.05
360x202 59.51 59.13
320x180 59.84 59.32
HDMI-1 connected (normal left inverted right x axis y axis)
1920x1080 60.00 + 50.00 59.94 30.00 25.00 24.00 29.97 23.98
1920x1080i 60.00 50.00 59.94
1600x1200 60.00
1680x1050 59.88
1280x1024 75.02
1440x900 59.90
1280x960 60.00
1360x768 59.95
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
720x576i 50.00
720x480 60.00 59.94
720x480i 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
What is returned is the current screen information.
In the returned result, eDP-1 and HDMI-1 are my screen devices, eDP-1 is the screen of my laptop, and HDMI-1 is my external screen. By the way, the resolution below the device can be adjusted.
After confirming that they are all connected, you can start setting. Of course, what I got is my own device name, you need to change it to yours.
Make sure the screen device is displayed normally (recommended first)
Before adjusting the screen, I recommend that both screens be set to --auto
mode. This is because when I first wanted to set up the extended screen, there was no response to any adjustments made to xrandr
, which made me think that my HDMI output screen was broken.
But it's not. It's just that the second screen is closed by default. After adjusting the two screens with the following commands, it returns to normal.
xrandr --output eDP-1 --auto --output HDMI-1 --auto
Turn off one of the screens
If you want to turn off a screen, you can use --off
to cancel the screen output.
xrandr --output eDP-1 --auto --output HDMI-1 --off
In this way, my HDMI output screen is disconnected from my laptop, and no signal will be received. To restore, just use the --auto
setting.
Set up extended screen
For example, if I want to use the screen that HDMI connected to be extended screen, put it on my right side:
xrandr --output eDP-1 --left-of HDMI-1
If you want to place the HDMI screen on the left:
xrandr --output eDP-1 --right-of HDMI-1
Set up screen sync
If you want the two screens to display the same screen (the report is easy to use), you can use the following command:
xrandr --output eDP-1 --same-as HDMI-1
Set screen rotation
It can be set to rotate 90 degrees to the left, 90 degrees to the right, 180 degrees to return to normal.
xrandr -o left
xrandr -o right
xrandr -o inverted
xrandr -o normal
Set screen resolution
Remember the resolution of the device you just saw? Simply put, we can enter any resolution supported by the device to modify the current screen resolution.
For example:
xrandr --output eDP-1 --mode 1920x1080
References
- https://wiki.archlinux.org/index.php/Xrandr
- https://linuxconfig.org/how-to-configure-your-monitors-with-xrandr-in-linux
- https://xorg-team.pages.debian.net/xorg/howto/use-xrandr.html
I would like to change the my Linux ElemOs desktop screen resolution via commands console. My case: After locate the identifier of the two screens included this one of my labtop, and to launch the xrandr command, i have been getting so: “than@than-pc:~$ sudo xrandr –output –primary HDMI_1 –mode 1680×1050 –output LVDS_1 –mode 1366×768
[sudo] contraseña para than:
xrandr: unrecognized option ‘HDMI_1’
Try ‘xrandr –help’ for more information.”
Furthermore, the for getting the display device utilized command and and the result that it’is got so:
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
LVDS-1 connected 1024×768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
1366×768 60.04 +
1360×768 59.80 59.96
1280×720 60.00 59.99 59.86 59.74
1024×768 60.04* 60.00
960×720 60.00
928×696 60.05
896×672 60.01
1024×576 59.95 59.96 59.90 59.82
960×600 59.93 60.00
960×540 59.96 59.99 59.63 59.82
800×600 60.00 60.32 56.25
840×525 60.01 59.88
864×486 59.92 59.57
800×512 60.17
700×525 59.98
800×450 59.95 59.82
640×512 60.02
720×450 59.89
700×450 59.96 59.88
640×480 60.00 59.94
720×405 59.51 58.99
684×384 59.88 59.85
680×384 59.80 59.96
640×400 59.88 59.98
576×432 60.06
640×360 59.86 59.83 59.84 59.32
512×384 60.00
512×288 60.00 59.92
480×270 59.63 59.82
400×300 60.32 56.34
432×243 59.92 59.57
320×240 60.05
360×202 59.51 59.13
320×180 59.84 59.32
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1024×768+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
1680×1050 59.88 +
1280×1024 75.02 60.02
1280×960 60.00
1152×864 75.00
1024×768 75.03* 70.07 60.00
832×624 74.55
800×600 72.19 75.00 60.32 56.25
640×480 75.00 72.81 66.67 59.94
720×400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
Deseo cmbiar la resolución de pantalla del esccritorio de mi Elem OS linux distro desde consola de comandos y tras localizar el identificador de las dos pantallas que incluída la de mi portátil, y lanzar el comando xrandr, obtengo este mensaje: “than@than-pc:~$ sudo xrandr –output –primary HDMI_1 –mode 1680×1050 –output LVDS_1 –mode 1366×768
[sudo] contraseña para than:
xrandr: unrecognized option ‘HDMI_1’
Try ‘xrandr –help’ for more information.”
El comando para consultar los identificadores de los dispositivos de visualización y su resultado es:
“than@than-pc:~$ xrandr -q
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
LVDS-1 connected 1024×768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
1366×768 60.04 +
1360×768 59.80 59.96
1280×720 60.00 59.99 59.86 59.74
1024×768 60.04* 60.00
960×720 60.00
928×696 60.05
896×672 60.01
1024×576 59.95 59.96 59.90 59.82
960×600 59.93 60.00
960×540 59.96 59.99 59.63 59.82
800×600 60.00 60.32 56.25
840×525 60.01 59.88
864×486 59.92 59.57
800×512 60.17
700×525 59.98
800×450 59.95 59.82
640×512 60.02
720×450 59.89
700×450 59.96 59.88
640×480 60.00 59.94
720×405 59.51 58.99
684×384 59.88 59.85
680×384 59.80 59.96
640×400 59.88 59.98
576×432 60.06
640×360 59.86 59.83 59.84 59.32
512×384 60.00
512×288 60.00 59.92
480×270 59.63 59.82
400×300 60.32 56.34
432×243 59.92 59.57
320×240 60.05
360×202 59.51 59.13
320×180 59.84 59.32
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1024×768+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
1680×1050 59.88 +
1280×1024 75.02 60.02
1280×960 60.00
1152×864 75.00
1024×768 75.03* 70.07 60.00
832×624 74.55
800×600 72.19 75.00 60.32 56.25
640×480 75.00 72.81 66.67 59.94
720×400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
http://www.redspots.es
xrandr –output HDMI-1 –below DVI-D-0 –mode 1920×1080 –rate 120.00
this is my example, it also sets refresh rate. i had a problem where it automatically set a non supported refresh rate and it set it to mirror, this solves both problems with the –rate and –below keywords
also if u want a hotkey u can use the hotkey graphical interface under keyboard preferences
Thank you for the elaboration! I’ve learned a lot from it.