How do I find out screen resolution of my Linux desktop?

How do I find the monitor/screen resolution using the command line on Linux? How do I find out screen resolution of my Linux desktop?

It refers to the clarity of an image on the screen. Screen resolution suggests the number of dots or pixels on the entire computer screen. For example, when you say a 640 x 480 screen resolution, all you mean is individual 640 dots on every 480 lines i.e. 307K pixels.

Common display resolutions (width x height in px) for Linux and Unix like systems

  1. SVGA 800 x 600
  2. HD 1360 x 768
  3. HD+ 1600 x 900
  4. FHD 1920 x 1080
  5. QHD 2560 x 1440
  6. 4K UHD 3840 x 2160

Finding out screen resolution of my Linux desktop

Use the xdpyinfo command to find out current screen resolution on your Linux desktop. Open the terminal window and then type:
$ xdpyinfo | grep 'dimensions:'
$ xdpyinfo | awk '/dimensions/ {print $2}'

Here is what I see on my SVGA:

dimensions:    800x600 pixels (283x212 millimeters)

The xdpyinfo is a Linux and Unix utility for displaying information about an X server.

Getting the monitor resolution using the Linux command line

We can also use the xrandr command:
$ xrandr | grep '*'
Another output from my XGA and we used the grep command to filter out default outputs:

*0   1024 x 768    ( 283mm x 212mm )  *61

The xrandr command is used on Linux and Unix-like system such as FreeBSD to set the size, orientation and/or reflection of the outputs for a screen. It can also get or set the screen size.

Finding out my screen resolution from a shell script when using NVidia or Intel or AMD GPU

We can use any one of the following Linux command to find out graphics card (GPU) installed on my desktop or laptop:
$ lspci -v | egrep -i --color 'vga|3d|2d'
$ lshw -short -class display

Now list screen monitor resolution:
$ xrandr | grep '*'
$ my_gpu_screen="$(xdpyinfo | grep 'dimensions:')"
$ echo "${my_gpu_screen}"

The inxi command provides nice outputs too:
$ inxi -G
From my ThinkPad X1E laptop:

Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] driver: nvidia v: 455.38 
           Display: x11 server: X.Org 1.20.8 driver: modesetting,nvidia unloaded: fbdev,nouveau,vesa 
           resolution: 2560x1440~60Hz 
           OpenGL: renderer: GeForce GTX 1650 with Max-Q Design/PCIe/SSE2 v: 4.6.0 NVIDIA 455.38 

How to use desktop GUI tools to get display resolution on Linux

You can also use Desktop tools to find out the current desktop screen resolution:

Gnome Desktop

Click Gnome Desktop menu > Preferences > Screen resolution

Modern Linux distro with GNOME use settings options as follows:

GNOME desktop showing display info

KDE Desktop

  1. Click on K desktop Icon > Select Control Center
  2. Select Peripherals (under Index tab) > Select Display
  3. It will display Screen resolution or size

On modern KDE plasma desktop, try:
SettingsSystem Settings from the Application Menu.
OR type the following command:
systemsettings5 &
Now look for Display configurations:

KDE desktop settings

Changing screen resolution through the Linux CLI

The syntax is:
xrandr --size <size>/<width>x<height>
xrandr -s <size>/<width>x<height>

For example:
$ xrandr --size 1366x768
$ xrandr --size 3840x2160

If you have multiple monitors, list them:
$ xrandr --listmonitors
Now try:
$ xrandr --setmonitor HDMI-0 --size 3840x2160
$ xrandr --setmonitor eDP-1-1 --size 2560x1440


We explained how to find and get the monitor resolution using the Linux command line. Additionally, we demonstrated how to find out your screen resolution from a shell prompt and store it into a shell variable for your scripting needs. See screen resolution at wikipedia and see man the following man pages using the man command:
% man xrandr
$ man xdpyinfo

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • CIP Dec 1, 2007 @ 19:13

    I needed the command to find a wallpaper that best suits my display resolution on Debian and I used xrandr.

  • Benz Apr 12, 2012 @ 16:21

    This cannot be found on the AV LINUX distribution while using it as a LIVE DVD. The resolution setting is at first glance nowhere to be found, at second glance neither.We have to see what happens when used after installation. Will it then be easy to find the screen resolution setting … we’ll see …

  • erm3nda Oct 26, 2015 @ 11:29

    U can also get screen data using “inxi -G | egrep -o 'Resolution:.*hz'

  • Nick Dec 3, 2020 @ 8:42

    Only xrandr is reliable.

    I have a 69.7cm x 39.2cm monitor (that’s a “31.5 inch monitor” measured on the diagonal) with 3840×2160 pixels.
    xrandr reports these correctly (it gives the size in millimeters, 697mm x 392mm).
    But xdpyinfo reports the size incorrectly as “1016×571 millimeters”.

    Strange! I’d expect both of them to get the data from the same place, but they obviously don’t. I’m using Debian Bullseye with the latest updates as of yesterday.

    • brundolf Dec 4, 2020 @ 19:17

      Are you using Wayland?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @