---
title: 'How to change display resolution from Linux command line'
url: 'https://ra1ahq.blog/en/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux'
markdown: 'https://ra1ahq.blog/en/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux.md'
lang: en
date: '2021-06-07'
description: 'If the image resolution on the screen does not match the display resolution, you can change the resolution using the command line. At wor'
taxonomy:
  category:
    - blog
  tag:
    - Linux
  archives_month:
    - jun_2021
  archives_year:
    - '2021'
---

# How to change display resolution from Linux command line

7 

 June 

 2021 

 11:52

### How to change display resolution from Linux command line

 [Linux](https://ra1ahq.blog/en/tag:Linux) 

7 June 2021 11:52

If the image resolution on the screen does not match the display resolution, you can change the resolution using the command line.

At work, I have a computer running Linux Mint 19.3 and a widescreen display with a resolution of 1366 by 768 pixels. One day I booted the computer with the display turned off and the OS was set to 1024 by 768 resolution. Somehow, this resolution was remembered and the image became stretched.

Running diagnostics of the *main* display (displaying resolutions supported by the display):

```
xrandr -d :0 -q
```

`Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767`
`VGA1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm`
`1024x768      60.00*`
`800x600       60.32    56.25`
`848x480       60.00`
`640x480       59.94`

as you can see, the resolution of 1024x768 is selected by the system and is marked with an asterisk\*.

### Solving the problem

1. Find out the display model (sticker on the back cover) - using the model from the specification, find out the maximum resolution supported by the monitor.
    In this case, 1366 by 768 px at a refresh rate of 60 Hz.

Connect to the Internet and install the xcvt package.
`<pre>sudo apt install xcvt</pre>`

2. Run command **cvt** with parameters corresponding to resolution and refresh rate:
    `<pre>cvt 1366 768 60</pre>`

In my case the following was output:

`# 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz`
`Modeline "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync`

3. You need to take the line and feed it to the xrandr input to create a new video mode:

`<pre>xrandr --newmode "1368x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync</pre>`

4. Find out the name of the display - displayed by the xrandr command:

    `<pre>xrandr -d :0 -q</pre>`

in my case there is only one display and its name **VGA1**

5. Add a new, previously created mode to the display:

`<pre>xrandr --addmode VGA1 1368x768_60.00</pre>`

6. Finally, I ran the command to change the image resolution (switching the display to the new mode "1368x768\_60.00"):

`<pre>sudo xrandr --output VGA1 --mode 1368x768_60.00</pre>`

The display may flash on or off. If everything went well, the image will become the selected resolution.

If necessary, restore the resolution to 1024x768:
Press Enter several times and enter the following command into the command line

```
sudo xrandr --output VGA1 --mode 1024x768
```

If necessary, repeat changing the display mode:

```
xrandr --output VGA1 --mode 1368x768_60.00
```

press "Enter"

You don't need to enter the sudo password every time.

---

Addition for monitor with 1280x1024 resolution:

```
cvt 1280 1024 60
xrandr --newmode "1280x1024_60.00"   109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA-1 1280x1024_60.00
sudo xrandr --output VGA-1 --mode 1280x1024_60.00
```

Addition from 12/29/2023: To set the display resolution and save a ready-to-run shell script to change the screen resolution, you can use the program `arandr`:
**`sudo apt install arandr`**
**`arandr`**

Update from 01/27/2026: some video card drivers respond to the command to set the xrandr --output mode with the errors "xrandr: Failed to get size of gamma for output default", "xrandr: Configure crtc 0 failed" and "xrandr: Gamma size is 0". You can try to press “e” or “Tab” in the Grub menu when loading and add something like this to the GRUB\_CMDLINE\_LINUX\_DEFAULT line parameter `nvidia_drm.fbdev=1 nvidia_drm.modeset=1`. Or, for an ATI Rage 128 graphics card: `fb.fbdev=1 fb.modeset=1`, depending on the contents of the /var/log/Xorg.0.log file. Continue booting by pressing F10, Ctrl+X, or Enter. An example of a complex command that still doesn't work with an older graphics card: `sudo xrandr --output default --panning 1368x768 --crtc 0 --brightness 1.0 --scale 1x1 --gamma 1:1:1`, the error is the same: "xrandr: Gamma size is 0". Then the easiest way is to replace the video card. ;-\[

### Permanently setting display resolution when logging into Linux

I wrote the following three commands into the executable file.

First I created an empty file in my home folder

```
nano resolution.sh
```

And inserted 4 lines of text into it:
**`#!/bin/bash`**
**`xrandr --newmode "1368x768_60" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync`**
**`xrandr --addmode VGA1 1368x768_60`**
**`xrandr --output VGA1 --mode 1368x768_60`**

saved the file.

The same file, but for a 1280x1024 monitor, I attach:
[resolution.sh.zip](https://ra1ahq.blog/en/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux/resolution.sh.zip)

Gave permissions - execution only from the current user (owner).

```
sudo chmod 700 resolution.sh
```

Added to startup (I have the LXQT shell):
**Start - Options - LXQT Settings - Session Settings - Autostart - Add**
**sh /home/vladimir/resolution.sh**.
Confirmed and closed the window.

Another option is to add the commands to a file in the user's home directory **.xinitrc**:

`export GNOME_SHELL_SESSION_MODE=ubuntu`
`export XDG_CURRENT_DESKTOP=ubuntu:GNOME`
`export XDG_DATA_DIRS=/usr/share/openbox:/usr/local/share/:/usr/share/`

`xrandr --newmode "1280x1024_60.00"   109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync`
`xrandr --addmode VGA-1 1280x1024_60.00`
`xrandr --output VGA-1 --mode 1280x1024_60.00`

logged out and logged in to check. Upon entry, the display blinked and the correct display resolution was applied.
Also, the command file *resolution.sh* can be run from the window **terminal**.

### The case of HDMI connection and multiple monitors

Unlike the connection via a VGA cable discussed above, when using multiple monitors connected via HDMI interfaces, the command syntax is different:
`xrandr --newmode DVI-I-1 mode_name1 ...`
`xrandr --newmode DVI-I-2 mode_name2 ...`
`xrandr --addmode DVI-I-1 mode_name1`
`xrandr --addmode DVI-I-2 mode_name2`
`xrandr --output DVI-I-1 --mode mode_name1`
`xrandr --output DVI-I-2 --mode mode_name1`

the monitor interface names can be obtained using the same command

```
xrandr -q
```

**Addition:** shell command files for changing resolution, for several monitors at once, can be prepared using a graphics utility **Arandr**(installation:`sudo apt install arandr`). The name arandr stands for “Another XRandR GUI” (GUI utility for installing XRandR).

**Addition: for desktop environment[LXQT](https://ru.wikipedia.org/wiki/LXQt)**(in Lubuntu OS, back of Fedora Linux or in a self-installed shell) - there is a graphical utility **`lxqt-config-monitor`** Available in the "Options" menu, "LXQT Settings," and "Monitor Settings." It allows you to change the resolution and refresh rate of your monitors and save the settings to a "profile" (settings file). However, resolution profiles in LXQT cannot be edited from the command line. The utility `**lxqt-config-monitor`\*\* modifies text files:
`~/.config/autostart/lxqt-config-monitor-autostart.desktop<br></br>~/.config/lxqt/lxqt-config-monitor.conf<br></br>`
The settings files listed here are used when starting an LxQT session from the file `~/.xinitrc` , from which the script `exec startlxqt` is called.

---

**Sources:**

- [https://askubuntu.com/...change-the-screen-resolution-using-ubuntu-command-line](https://askubuntu.com/questions/281509/how-do-i-change-the-screen-resolution-using-ubuntu-command-line)
- [linuxmint.com forum](https://forums.linuxmint.com/viewtopic.php?t=274540)

### Related publications

 [ ![](https://ra1ahq.blog/images/6/8/1/3/3/68133cc0ab7ddf32ba1a9c7eaeef3a6fa562e88f-msg.png) Tox Messenger ](https://ra1ahq.blog/en/tox-messenger) 

 [ ![](https://ra1ahq.blog/images/f/3/a/2/c/f3a2c07ef5b32c0308ab703405a5a5ca87b75283-archer-ac600-728.webp) Installing the kernel driver for the TP-Link Wi-Fi adapter after updating the Debian OS ](https://ra1ahq.blog/en/ustanovka-draivera-yadra-dlya-wi-fi-adaptera-tp-link-posle-obnovleniya-os-debian) 

 [ ![](https://ra1ahq.blog/images/d/2/5/c/7/d25c7282750b398f71041fb8b90640b692e7e4b8-decibelfmtitle.png) Linux Cinnamon Desktop Applets for Listening to Internet Radio Stations ](https://ra1ahq.blog/en/applety-dlya-rabochego-stola-linux-cinnamon-dlya-proslushivaniya-internet-radiostancii) 

 [ ![No picture](https://ra1ahq.blog/user/themes/mytheme/images/no-image.png) Passing a parameter to a Linux module/driver ](https://ra1ahq.blog/en/peredacha-parametra-modulyu-draiveru-linux) 

 [ ![](https://ra1ahq.blog/images/5/c/4/e/a/5c4ea9c8c3f0b4dd890116d8fe7cbadfdb9814ba-archer-ac600.webp) Installing the TP-Link Archer T600U Nano Wi-Fi adapter driver in Debian 13 "Trixie" ](https://ra1ahq.blog/en/ustanovka-draivera-wi-fi-adaptera-tp-link-archer-t600u-nano-v-debian-13-trixie) 

[ Backward](https://ra1ahq.blog/en/prioratskii-park-chast-2 "Previuous page")

[ Forward ](https://ra1ahq.blog/en/sozdanie-zvukovykh-mp3-failov-dlya-izucheniya-cw-na-osnove-slovarya "Next page")

## Languages

- [Русский](https://ra1ahq.blog/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux)
- [English](https://ra1ahq.blog/en/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux)
- [Deutsch](https://ra1ahq.blog/de/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux)
- [Français](https://ra1ahq.blog/fr/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux)
- [中文 (简体) (cn)](https://ra1ahq.blog/zh-cn/kak-smenit-razreshenie-displeya-iz-komandnoi-stroki-linux)

## Theme

## RSS feeds

 [ Atom 1.0](https://ra1ahq.blog/en/.atom) [ RSS](https://ra1ahq.blog/en/.rss) 

## Popular tags

 [APRS](https://ra1ahq.blog/en/tag:APRS) [CW](https://ra1ahq.blog/en/tag:CW) [DX](https://ra1ahq.blog/en/tag:DX) [FM](https://ra1ahq.blog/en/tag:FM) [Linux](https://ra1ahq.blog/en/tag:Linux) [VHF](https://ra1ahq.blog/en/tag:VHF) [antennas](https://ra1ahq.blog/en/tag:antennas) [firefox](https://ra1ahq.blog/en/tag:firefox) [morse](https://ra1ahq.blog/en/tag:morse) [soundtrack](https://ra1ahq.blog/en/tag:soundtrack) [video](https://ra1ahq.blog/en/tag:video) [windows](https://ra1ahq.blog/en/tag:windows) [youtube](https://ra1ahq.blog/en/tag:youtube) [КВ](https://ra1ahq.blog/en/tag:%D0%9A%D0%92) [ТВ](https://ra1ahq.blog/en/tag:%D0%A2%D0%92) [УКВ](https://ra1ahq.blog/en/tag:%D0%A3%D0%9A%D0%92) [антенны](https://ra1ahq.blog/en/tag:%D0%B0%D0%BD%D1%82%D0%B5%D0%BD%D0%BD%D1%8B) [безопасность](https://ra1ahq.blog/en/tag:%D0%B1%D0%B5%D0%B7%D0%BE%D0%BF%D0%B0%D1%81%D0%BD%D0%BE%D1%81%D1%82%D1%8C) [длинные волны](https://ra1ahq.blog/en/tag:%D0%B4%D0%BB%D0%B8%D0%BD%D0%BD%D1%8B%D0%B5%20%D0%B2%D0%BE%D0%BB%D0%BD%D1%8B) [путешествия](https://ra1ahq.blog/en/tag:%D0%BF%D1%83%D1%82%D0%B5%D1%88%D0%B5%D1%81%D1%82%D0%B2%D0%B8%D1%8F) [религия](https://ra1ahq.blog/en/tag:%D1%80%D0%B5%D0%BB%D0%B8%D0%B3%D0%B8%D1%8F) [соревнования](https://ra1ahq.blog/en/tag:%D1%81%D0%BE%D1%80%D0%B5%D0%B2%D0%BD%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F) [спутники](https://ra1ahq.blog/en/tag:%D1%81%D0%BF%D1%83%D1%82%D0%BD%D0%B8%D0%BA%D0%B8) [средние волны](https://ra1ahq.blog/en/tag:%D1%81%D1%80%D0%B5%D0%B4%D0%BD%D0%B8%D0%B5%20%D0%B2%D0%BE%D0%BB%D0%BD%D1%8B) [схемы](https://ra1ahq.blog/en/tag:%D1%81%D1%85%D0%B5%D0%BC%D1%8B) [тесты](https://ra1ahq.blog/en/tag:%D1%82%D0%B5%D1%81%D1%82%D1%8B) [трансивер](https://ra1ahq.blog/en/tag:%D1%82%D1%80%D0%B0%D0%BD%D1%81%D0%B8%D0%B2%D0%B5%D1%80) [управление](https://ra1ahq.blog/en/tag:%D1%83%D0%BF%D1%80%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5) [фотографии](https://ra1ahq.blog/en/tag:%D1%84%D0%BE%D1%82%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D0%B8) 

## Random post

 [ I'll be lucky!](https://ra1ahq.blog/en/random) 

## Archive of posts

- [ October 2026 ✒ 6 ](https://ra1ahq.blog/en/archives_month:oct_2026)
- [ September 2026 ✒ 9 ](https://ra1ahq.blog/en/archives_month:sep_2026)
- [ August 2026 ✒ 6 ](https://ra1ahq.blog/en/archives_month:aug_2026)
- [ July 2026 ✒ 13 ](https://ra1ahq.blog/en/archives_month:jul_2026)
- [ June 2026 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jun_2026)
- [ May 2026 ✒ 2 ](https://ra1ahq.blog/en/archives_month:may_2026)
- [ April 2026 ✒ 6 ](https://ra1ahq.blog/en/archives_month:apr_2026)
- [ March 2026 ✒ 3 ](https://ra1ahq.blog/en/archives_month:mar_2026)
- [ February 2026 ✒ 7 ](https://ra1ahq.blog/en/archives_month:feb_2026)
- [ January 2026 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jan_2026)
- [ December 2025 ✒ 12 ](https://ra1ahq.blog/en/archives_month:dec_2025)
- [ November 2025 ✒ 9 ](https://ra1ahq.blog/en/archives_month:nov_2025)
- [ October 2025 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2025)
- [ September 2025 ✒ 5 ](https://ra1ahq.blog/en/archives_month:sep_2025)
- [ August 2025 ✒ 8 ](https://ra1ahq.blog/en/archives_month:aug_2025)
- [ July 2025 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jul_2025)
- [ June 2025 ✒ 10 ](https://ra1ahq.blog/en/archives_month:jun_2025)
- [ May 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:may_2025)
- [ April 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2025)
- [ March 2025 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2025)
- [ February 2025 ✒ 11 ](https://ra1ahq.blog/en/archives_month:feb_2025)
- [ December 2024 ✒ 8 ](https://ra1ahq.blog/en/archives_month:dec_2024)
- [ November 2024 ✒ 2 ](https://ra1ahq.blog/en/archives_month:nov_2024)
- [ October 2024 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2024)
- [ September 2024 ✒ 3 ](https://ra1ahq.blog/en/archives_month:sep_2024)
- [ August 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:aug_2024)
- [ July 2024 ✒ 9 ](https://ra1ahq.blog/en/archives_month:jul_2024)
- [ June 2024 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jun_2024)
- [ May 2024 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2024)
- [ April 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:apr_2024)
- [ March 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:mar_2024)
- [ February 2024 ✒ 5 ](https://ra1ahq.blog/en/archives_month:feb_2024)
- [ January 2024 ✒ 6 ](https://ra1ahq.blog/en/archives_month:jan_2024)
- [ December 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2023)
- [ November 2023 ✒ 4 ](https://ra1ahq.blog/en/archives_month:nov_2023)
- [ October 2023 ✒ 8 ](https://ra1ahq.blog/en/archives_month:oct_2023)
- [ September 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:sep_2023)
- [ August 2023 ✒ 4 ](https://ra1ahq.blog/en/archives_month:aug_2023)
- [ July 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jul_2023)
- [ June 2023 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jun_2023)
- [ May 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:may_2023)
- [ April 2023 ✒ 6 ](https://ra1ahq.blog/en/archives_month:apr_2023)
- [ March 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:mar_2023)
- [ February 2023 ✒ 2 ](https://ra1ahq.blog/en/archives_month:feb_2023)
- [ January 2023 ✒ 5 ](https://ra1ahq.blog/en/archives_month:jan_2023)
- [ December 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2022)
- [ November 2022 ✒ 8 ](https://ra1ahq.blog/en/archives_month:nov_2022)
- [ October 2022 ✒ 6 ](https://ra1ahq.blog/en/archives_month:oct_2022)
- [ September 2022 ✒ 9 ](https://ra1ahq.blog/en/archives_month:sep_2022)
- [ August 2022 ✒ 8 ](https://ra1ahq.blog/en/archives_month:aug_2022)
- [ July 2022 ✒ 4 ](https://ra1ahq.blog/en/archives_month:jul_2022)
- [ June 2022 ✒ 9 ](https://ra1ahq.blog/en/archives_month:jun_2022)
- [ May 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2022)
- [ April 2022 ✒ 3 ](https://ra1ahq.blog/en/archives_month:apr_2022)
- [ March 2022 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2022)
- [ February 2022 ✒ 6 ](https://ra1ahq.blog/en/archives_month:feb_2022)
- [ January 2022 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jan_2022)
- [ December 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:dec_2021)
- [ November 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:nov_2021)
- [ October 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:oct_2021)
- [ September 2021 ✒ 10 ](https://ra1ahq.blog/en/archives_month:sep_2021)
- [ August 2021 ✒ 6 ](https://ra1ahq.blog/en/archives_month:aug_2021)
- [ July 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jul_2021)
- [ June 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:jun_2021)
- [ May 2021 ✒ 7 ](https://ra1ahq.blog/en/archives_month:may_2021)
- [ April 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2021)
- [ March 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:mar_2021)
- [ February 2021 ✒ 3 ](https://ra1ahq.blog/en/archives_month:feb_2021)
- [ January 2021 ✒ 4 ](https://ra1ahq.blog/en/archives_month:jan_2021)
- [ December 2020 ✒ 8 ](https://ra1ahq.blog/en/archives_month:dec_2020)
- [ November 2020 ✒ 2 ](https://ra1ahq.blog/en/archives_month:nov_2020)
- [ October 2020 ✒ 3 ](https://ra1ahq.blog/en/archives_month:oct_2020)
- [ September 2020 ✒ 3 ](https://ra1ahq.blog/en/archives_month:sep_2020)
- [ August 2020 ✒ 5 ](https://ra1ahq.blog/en/archives_month:aug_2020)
- [ July 2020 ✒ 5 ](https://ra1ahq.blog/en/archives_month:jul_2020)
- [ June 2020 ✒ 8 ](https://ra1ahq.blog/en/archives_month:jun_2020)
- [ May 2020 ✒ 10 ](https://ra1ahq.blog/en/archives_month:may_2020)
- [ April 2020 ✒ 4 ](https://ra1ahq.blog/en/archives_month:apr_2020)
- [ March 2020 ✒ 2 ](https://ra1ahq.blog/en/archives_month:mar_2020)
- [ January 2020 ✒ 1 ](https://ra1ahq.blog/en/archives_month:jan_2020)
- [ December 2019 ✒ 2 ](https://ra1ahq.blog/en/archives_month:dec_2019)

## Search

## Weather forecast

[На 14 дней](https://world-weather.ru/pogoda/russia/saint_petersburg/14days/)
[world-weather.ru](https://world-weather.ru/)

---

## Navigation

- Parent: [RA1AHQ](https://ra1ahq.blog/en/index.md)
- Previous: [Creating MP3 audio files for learning CW based on a dictionary](https://ra1ahq.blog/en/sozdanie-zvukovykh-mp3-failov-dlya-izucheniya-cw-na-osnove-slovarya.md)
- Next: [Priory Park - part 2](https://ra1ahq.blog/en/prioratskii-park-chast-2.md)
