How can I get the monitor resolution using the command line?From a remote SSH session, how can I get the screen resolution of the physically connected monitor?Command line archive manager / extracterWhere can I find the command line?How can I change my monitor resolution to a higher one?(Xubuntu) How to set the wallpaper using the command line?How do I get randomness in command-line?

Has my MacBook been hacked?

Late 1970's and 6502 chip facilities for operating systems

How to ask a man to not take up more than one seat on public transport while avoiding conflict?

Why is there not an optimal solution for a MIP?

Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?

To what extent is it worthwhile to report check fraud / refund scams?

Hilbert's hotel, why can't I repeat it infinitely many times?

Writing a letter of recommendation for a mediocre student

Wrong result by FindRoot

What is the meaning of "heutig" in this sentence?

How does IBM's 53-bit quantum computer compare to classical ones for cryptanalytic tasks?

Do all creatures have souls?

Who created the Lightning Web Component?

Can Northern Ireland's border issue be solved by repartition?

Performance for simple code that converts a RGB tuple to hex string

What happens if nobody can form a government in Israel?

How do I deal with too many NPCs in my campaign?

Way of the bicycle

How can I repair this gas leak on my new range? Teflon tape isn't working

How to manage expenditure when billing cycles and paycheck cycles are not aligned?

If the EU does not offer an extension to UK's Article 50 invocation, is the Benn Bill irrelevant?

Does a GFCI-protected bath light/fan unit need separate neutrals?

Are there non JavaScript ways to hide HTML source code?

Norwegian refuses EU delay (4.7 hours) compensation because it turned out there was nothing wrong with the aircraft



How can I get the monitor resolution using the command line?


From a remote SSH session, how can I get the screen resolution of the physically connected monitor?Command line archive manager / extracterWhere can I find the command line?How can I change my monitor resolution to a higher one?(Xubuntu) How to set the wallpaper using the command line?How do I get randomness in command-line?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








47















I would like to find a wallpaper that best suits my resolution. How can I get the resolution just by writing commands in the command line?










share|improve this question
































    47















    I would like to find a wallpaper that best suits my resolution. How can I get the resolution just by writing commands in the command line?










    share|improve this question




























      47












      47








      47


      16






      I would like to find a wallpaper that best suits my resolution. How can I get the resolution just by writing commands in the command line?










      share|improve this question
















      I would like to find a wallpaper that best suits my resolution. How can I get the resolution just by writing commands in the command line?







      command-line resolution xfce wallpaper






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 12 '15 at 16:44









      TRiG

      1,4591 gold badge14 silver badges34 bronze badges




      1,4591 gold badge14 silver badges34 bronze badges










      asked Feb 12 '15 at 14:17









      Abdul Al HazredAbdul Al Hazred

      3991 gold badge5 silver badges12 bronze badges




      3991 gold badge5 silver badges12 bronze badges























          5 Answers
          5






          active

          oldest

          votes


















          67
















          Taken from this answer:



          xdpyinfo | grep dimensions


          Or to get just the resolution:



          xdpyinfo | awk '/dimensions/print $2'


          OR



          xdpyinfo | grep -oP 'dimensions:s+KS+'





          share|improve this answer






















          • 7





            It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

            – Sylvain Pineau
            Feb 12 '15 at 14:31






          • 2





            Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

            – aguslr
            Feb 12 '15 at 14:36











          • Indeed you're right, +1 ;)

            – Sylvain Pineau
            Feb 12 '15 at 14:38











          • @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

            – Jos
            Feb 12 '15 at 15:01






          • 1





            @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

            – aguslr
            Feb 12 '15 at 15:06


















          29
















          I would just use xrandr:



          $ xrandr 
          Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
          LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
          1600x900 60.0*+
          1440x900 59.9
          1360x768 59.8 60.0
          1152x864 60.0
          1024x768 60.0
          800x600 60.3 56.2
          640x480 59.9
          VGA1 disconnected (normal left inverted right x axis y axis)
          HDMI1 disconnected (normal left inverted right x axis y axis)
          DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
          1920x1200 60.0*+
          1920x1080 60.0 50.0 59.9 24.0 24.0
          1920x1080i 60.1 50.0 60.0
          1600x1200 60.0
          1280x1024 75.0 60.0
          1152x864 75.0
          1280x720 60.0 50.0 59.9
          1024x768 75.1 60.0
          800x600 75.0 60.3
          720x576 50.0
          720x480 60.0 59.9
          640x480 75.0 60.0 59.9
          720x400 70.1
          HDMI2 disconnected (normal left inverted right x axis y axis)
          HDMI3 disconnected (normal left inverted right x axis y axis)
          DP2 disconnected (normal left inverted right x axis y axis)
          DP3 disconnected (normal left inverted right x axis y axis)
          VIRTUAL1 disconnected (normal left inverted right x axis y axis)


          Here I have two screens, the resolution are:



          • 1600x900 (laptop)

          • 1920x1200 (monitor)

          To get only the resolution of your primary monitor, you can also use this python oneliner:



          $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
          geo = screen.get_monitor_geometry(screen.get_primary_monitor());
          print(geo.width, "x", geo.height)'
          1920 x 1200


          To get the resolution of your extanded desktop (for a multi monitor setup):



          $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
          print(screen.get_width(), "x", screen.get_height())'
          3520 x 1200





          share|improve this answer



























          • xrandr + vesa = no workee.

            – Joshua
            Feb 12 '15 at 20:50











          • Just the resolution of in-use displays: xrandr | grep " connected|*"

            – Pablo A
            Apr 15 at 15:54


















          10
















          The request was for the resolution. That is given by



          xdpyinfo | grep resolution





          share|improve this answer






















          • 4





            Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

            – muru
            Feb 19 '15 at 4:04


















          3
















          You can also use:



           xrandr | grep ' connected'


          Example of output on one of my machines:



          LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm





          share|improve this answer
































            1
















            For what it's worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:



            Option "MetaModes" "DP-1: 1440x900 +0+0, DP-3: 1440x900 +1568+0, DP-5: 1440x900 +3136+0"


            The xrandr output looks like this:



            DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
            HDMI-0 disconnected (normal left inverted right x axis y axis)
            DP-0 disconnected (normal left inverted right x axis y axis)
            DP-1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
            1440x900 59.89*+
            1280x1024 60.02
            1280x960 60.00
            1280x800 59.81
            1280x720 60.00
            1152x864 75.00
            1024x768 70.07 60.00
            800x600 75.00 60.32 56.25
            640x480 75.00 72.81 59.94
            DP-2 disconnected (normal left inverted right x axis y axis)
            DP-3 connected (normal left inverted right x axis y axis)
            1440x900 59.89 + 74.98
            1280x1024 60.02
            1280x960 60.00
            1280x800 59.81
            1280x720 60.00
            1152x864 75.00
            1024x768 70.07 60.00
            800x600 75.00 60.32 56.25
            640x480 75.00 72.81 59.94
            DP-4 disconnected (normal left inverted right x axis y axis)
            DP-5 connected 1440x900+1568+0 (normal left inverted right x axis y axis) 410mm x 256mm
            1440x900 59.89*+
            1280x1024 60.02
            1280x960 60.00
            1280x800 59.81
            1280x720 60.00
            1152x864 75.00
            1024x768 70.07 60.00
            800x600 75.00 60.32 56.25
            640x480 75.00 72.81 59.94


            You can see that DP-3 isn't showing a resolution on the line that a grep for "connected" would show. So the best, most consistent, and reliable command I've found for identifying the resolution of any individual connected display is:



            /usr/bin/xrandr --query|/usr/bin/grep -A 1 connected|grep -v connected


            which produces this:



             1440x900 59.89*+
            --
            1440x900 59.89*+ 74.98
            --
            1440x900 59.89*+


            At that point, it's pretty trivial to pick out the different resolutions or grep for only one port.






            share|improve this answer



























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "89"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );














              draft saved

              draft discarded
















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f584688%2fhow-can-i-get-the-monitor-resolution-using-the-command-line%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              67
















              Taken from this answer:



              xdpyinfo | grep dimensions


              Or to get just the resolution:



              xdpyinfo | awk '/dimensions/print $2'


              OR



              xdpyinfo | grep -oP 'dimensions:s+KS+'





              share|improve this answer






















              • 7





                It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

                – Sylvain Pineau
                Feb 12 '15 at 14:31






              • 2





                Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

                – aguslr
                Feb 12 '15 at 14:36











              • Indeed you're right, +1 ;)

                – Sylvain Pineau
                Feb 12 '15 at 14:38











              • @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

                – Jos
                Feb 12 '15 at 15:01






              • 1





                @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

                – aguslr
                Feb 12 '15 at 15:06















              67
















              Taken from this answer:



              xdpyinfo | grep dimensions


              Or to get just the resolution:



              xdpyinfo | awk '/dimensions/print $2'


              OR



              xdpyinfo | grep -oP 'dimensions:s+KS+'





              share|improve this answer






















              • 7





                It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

                – Sylvain Pineau
                Feb 12 '15 at 14:31






              • 2





                Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

                – aguslr
                Feb 12 '15 at 14:36











              • Indeed you're right, +1 ;)

                – Sylvain Pineau
                Feb 12 '15 at 14:38











              • @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

                – Jos
                Feb 12 '15 at 15:01






              • 1





                @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

                – aguslr
                Feb 12 '15 at 15:06













              67














              67










              67









              Taken from this answer:



              xdpyinfo | grep dimensions


              Or to get just the resolution:



              xdpyinfo | awk '/dimensions/print $2'


              OR



              xdpyinfo | grep -oP 'dimensions:s+KS+'





              share|improve this answer















              Taken from this answer:



              xdpyinfo | grep dimensions


              Or to get just the resolution:



              xdpyinfo | awk '/dimensions/print $2'


              OR



              xdpyinfo | grep -oP 'dimensions:s+KS+'






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Aug 23 '17 at 9:12

























              answered Feb 12 '15 at 14:25









              aguslraguslr

              1,1766 silver badges6 bronze badges




              1,1766 silver badges6 bronze badges










              • 7





                It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

                – Sylvain Pineau
                Feb 12 '15 at 14:31






              • 2





                Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

                – aguslr
                Feb 12 '15 at 14:36











              • Indeed you're right, +1 ;)

                – Sylvain Pineau
                Feb 12 '15 at 14:38











              • @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

                – Jos
                Feb 12 '15 at 15:01






              • 1





                @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

                – aguslr
                Feb 12 '15 at 15:06












              • 7





                It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

                – Sylvain Pineau
                Feb 12 '15 at 14:31






              • 2





                Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

                – aguslr
                Feb 12 '15 at 14:36











              • Indeed you're right, +1 ;)

                – Sylvain Pineau
                Feb 12 '15 at 14:38











              • @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

                – Jos
                Feb 12 '15 at 15:01






              • 1





                @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

                – aguslr
                Feb 12 '15 at 15:06







              7




              7





              It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

              – Sylvain Pineau
              Feb 12 '15 at 14:31





              It works for a single monitor setup but with two monitors it sums both dimensions, for me my two screens return: 3520x1200 pixels

              – Sylvain Pineau
              Feb 12 '15 at 14:31




              2




              2





              Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

              – aguslr
              Feb 12 '15 at 14:36





              Good point. On the other hand, this is still useful if he's searching for a single wallpaper to be spanned over all monitors.

              – aguslr
              Feb 12 '15 at 14:36













              Indeed you're right, +1 ;)

              – Sylvain Pineau
              Feb 12 '15 at 14:38





              Indeed you're right, +1 ;)

              – Sylvain Pineau
              Feb 12 '15 at 14:38













              @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

              – Jos
              Feb 12 '15 at 15:01





              @aguslr What would be the point of that? Having two 2000x1000 monitors, what use would be a 4000x2000 wallpaper image?

              – Jos
              Feb 12 '15 at 15:01




              1




              1





              @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

              – aguslr
              Feb 12 '15 at 15:06





              @Jos, I get it this command would return 4000x1000, that is, it puts both monitors next to each other. For example, Sylvain has two monitors (1600x900 and 1920x1200) and he gets 3520x1200.

              – aguslr
              Feb 12 '15 at 15:06













              29
















              I would just use xrandr:



              $ xrandr 
              Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
              LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
              1600x900 60.0*+
              1440x900 59.9
              1360x768 59.8 60.0
              1152x864 60.0
              1024x768 60.0
              800x600 60.3 56.2
              640x480 59.9
              VGA1 disconnected (normal left inverted right x axis y axis)
              HDMI1 disconnected (normal left inverted right x axis y axis)
              DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
              1920x1200 60.0*+
              1920x1080 60.0 50.0 59.9 24.0 24.0
              1920x1080i 60.1 50.0 60.0
              1600x1200 60.0
              1280x1024 75.0 60.0
              1152x864 75.0
              1280x720 60.0 50.0 59.9
              1024x768 75.1 60.0
              800x600 75.0 60.3
              720x576 50.0
              720x480 60.0 59.9
              640x480 75.0 60.0 59.9
              720x400 70.1
              HDMI2 disconnected (normal left inverted right x axis y axis)
              HDMI3 disconnected (normal left inverted right x axis y axis)
              DP2 disconnected (normal left inverted right x axis y axis)
              DP3 disconnected (normal left inverted right x axis y axis)
              VIRTUAL1 disconnected (normal left inverted right x axis y axis)


              Here I have two screens, the resolution are:



              • 1600x900 (laptop)

              • 1920x1200 (monitor)

              To get only the resolution of your primary monitor, you can also use this python oneliner:



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              geo = screen.get_monitor_geometry(screen.get_primary_monitor());
              print(geo.width, "x", geo.height)'
              1920 x 1200


              To get the resolution of your extanded desktop (for a multi monitor setup):



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              print(screen.get_width(), "x", screen.get_height())'
              3520 x 1200





              share|improve this answer



























              • xrandr + vesa = no workee.

                – Joshua
                Feb 12 '15 at 20:50











              • Just the resolution of in-use displays: xrandr | grep " connected|*"

                – Pablo A
                Apr 15 at 15:54















              29
















              I would just use xrandr:



              $ xrandr 
              Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
              LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
              1600x900 60.0*+
              1440x900 59.9
              1360x768 59.8 60.0
              1152x864 60.0
              1024x768 60.0
              800x600 60.3 56.2
              640x480 59.9
              VGA1 disconnected (normal left inverted right x axis y axis)
              HDMI1 disconnected (normal left inverted right x axis y axis)
              DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
              1920x1200 60.0*+
              1920x1080 60.0 50.0 59.9 24.0 24.0
              1920x1080i 60.1 50.0 60.0
              1600x1200 60.0
              1280x1024 75.0 60.0
              1152x864 75.0
              1280x720 60.0 50.0 59.9
              1024x768 75.1 60.0
              800x600 75.0 60.3
              720x576 50.0
              720x480 60.0 59.9
              640x480 75.0 60.0 59.9
              720x400 70.1
              HDMI2 disconnected (normal left inverted right x axis y axis)
              HDMI3 disconnected (normal left inverted right x axis y axis)
              DP2 disconnected (normal left inverted right x axis y axis)
              DP3 disconnected (normal left inverted right x axis y axis)
              VIRTUAL1 disconnected (normal left inverted right x axis y axis)


              Here I have two screens, the resolution are:



              • 1600x900 (laptop)

              • 1920x1200 (monitor)

              To get only the resolution of your primary monitor, you can also use this python oneliner:



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              geo = screen.get_monitor_geometry(screen.get_primary_monitor());
              print(geo.width, "x", geo.height)'
              1920 x 1200


              To get the resolution of your extanded desktop (for a multi monitor setup):



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              print(screen.get_width(), "x", screen.get_height())'
              3520 x 1200





              share|improve this answer



























              • xrandr + vesa = no workee.

                – Joshua
                Feb 12 '15 at 20:50











              • Just the resolution of in-use displays: xrandr | grep " connected|*"

                – Pablo A
                Apr 15 at 15:54













              29














              29










              29









              I would just use xrandr:



              $ xrandr 
              Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
              LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
              1600x900 60.0*+
              1440x900 59.9
              1360x768 59.8 60.0
              1152x864 60.0
              1024x768 60.0
              800x600 60.3 56.2
              640x480 59.9
              VGA1 disconnected (normal left inverted right x axis y axis)
              HDMI1 disconnected (normal left inverted right x axis y axis)
              DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
              1920x1200 60.0*+
              1920x1080 60.0 50.0 59.9 24.0 24.0
              1920x1080i 60.1 50.0 60.0
              1600x1200 60.0
              1280x1024 75.0 60.0
              1152x864 75.0
              1280x720 60.0 50.0 59.9
              1024x768 75.1 60.0
              800x600 75.0 60.3
              720x576 50.0
              720x480 60.0 59.9
              640x480 75.0 60.0 59.9
              720x400 70.1
              HDMI2 disconnected (normal left inverted right x axis y axis)
              HDMI3 disconnected (normal left inverted right x axis y axis)
              DP2 disconnected (normal left inverted right x axis y axis)
              DP3 disconnected (normal left inverted right x axis y axis)
              VIRTUAL1 disconnected (normal left inverted right x axis y axis)


              Here I have two screens, the resolution are:



              • 1600x900 (laptop)

              • 1920x1200 (monitor)

              To get only the resolution of your primary monitor, you can also use this python oneliner:



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              geo = screen.get_monitor_geometry(screen.get_primary_monitor());
              print(geo.width, "x", geo.height)'
              1920 x 1200


              To get the resolution of your extanded desktop (for a multi monitor setup):



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              print(screen.get_width(), "x", screen.get_height())'
              3520 x 1200





              share|improve this answer















              I would just use xrandr:



              $ xrandr 
              Screen 0: minimum 320 x 200, current 3520 x 1200, maximum 32767 x 32767
              LVDS1 connected 1600x900+1920+0 (normal left inverted right x axis y axis) 310mm x 174mm
              1600x900 60.0*+
              1440x900 59.9
              1360x768 59.8 60.0
              1152x864 60.0
              1024x768 60.0
              800x600 60.3 56.2
              640x480 59.9
              VGA1 disconnected (normal left inverted right x axis y axis)
              HDMI1 disconnected (normal left inverted right x axis y axis)
              DP1 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
              1920x1200 60.0*+
              1920x1080 60.0 50.0 59.9 24.0 24.0
              1920x1080i 60.1 50.0 60.0
              1600x1200 60.0
              1280x1024 75.0 60.0
              1152x864 75.0
              1280x720 60.0 50.0 59.9
              1024x768 75.1 60.0
              800x600 75.0 60.3
              720x576 50.0
              720x480 60.0 59.9
              640x480 75.0 60.0 59.9
              720x400 70.1
              HDMI2 disconnected (normal left inverted right x axis y axis)
              HDMI3 disconnected (normal left inverted right x axis y axis)
              DP2 disconnected (normal left inverted right x axis y axis)
              DP3 disconnected (normal left inverted right x axis y axis)
              VIRTUAL1 disconnected (normal left inverted right x axis y axis)


              Here I have two screens, the resolution are:



              • 1600x900 (laptop)

              • 1920x1200 (monitor)

              To get only the resolution of your primary monitor, you can also use this python oneliner:



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              geo = screen.get_monitor_geometry(screen.get_primary_monitor());
              print(geo.width, "x", geo.height)'
              1920 x 1200


              To get the resolution of your extanded desktop (for a multi monitor setup):



              $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); 
              print(screen.get_width(), "x", screen.get_height())'
              3520 x 1200






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Feb 12 '15 at 14:59

























              answered Feb 12 '15 at 14:23









              Sylvain PineauSylvain Pineau

              51.2k16 gold badges114 silver badges158 bronze badges




              51.2k16 gold badges114 silver badges158 bronze badges















              • xrandr + vesa = no workee.

                – Joshua
                Feb 12 '15 at 20:50











              • Just the resolution of in-use displays: xrandr | grep " connected|*"

                – Pablo A
                Apr 15 at 15:54

















              • xrandr + vesa = no workee.

                – Joshua
                Feb 12 '15 at 20:50











              • Just the resolution of in-use displays: xrandr | grep " connected|*"

                – Pablo A
                Apr 15 at 15:54
















              xrandr + vesa = no workee.

              – Joshua
              Feb 12 '15 at 20:50





              xrandr + vesa = no workee.

              – Joshua
              Feb 12 '15 at 20:50













              Just the resolution of in-use displays: xrandr | grep " connected|*"

              – Pablo A
              Apr 15 at 15:54





              Just the resolution of in-use displays: xrandr | grep " connected|*"

              – Pablo A
              Apr 15 at 15:54











              10
















              The request was for the resolution. That is given by



              xdpyinfo | grep resolution





              share|improve this answer






















              • 4





                Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

                – muru
                Feb 19 '15 at 4:04















              10
















              The request was for the resolution. That is given by



              xdpyinfo | grep resolution





              share|improve this answer






















              • 4





                Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

                – muru
                Feb 19 '15 at 4:04













              10














              10










              10









              The request was for the resolution. That is given by



              xdpyinfo | grep resolution





              share|improve this answer















              The request was for the resolution. That is given by



              xdpyinfo | grep resolution






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Feb 19 '15 at 4:03









              muru

              1




              1










              answered Feb 19 '15 at 3:49









              Bob RBob R

              1013 bronze badges




              1013 bronze badges










              • 4





                Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

                – muru
                Feb 19 '15 at 4:04












              • 4





                Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

                – muru
                Feb 19 '15 at 4:04







              4




              4





              Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

              – muru
              Feb 19 '15 at 4:04





              Typically, people use resolution to mean the dimensions. The DPI is not of as much concern as the dimensions are.

              – muru
              Feb 19 '15 at 4:04











              3
















              You can also use:



               xrandr | grep ' connected'


              Example of output on one of my machines:



              LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm





              share|improve this answer





























                3
















                You can also use:



                 xrandr | grep ' connected'


                Example of output on one of my machines:



                LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm





                share|improve this answer



























                  3














                  3










                  3









                  You can also use:



                   xrandr | grep ' connected'


                  Example of output on one of my machines:



                  LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm





                  share|improve this answer













                  You can also use:



                   xrandr | grep ' connected'


                  Example of output on one of my machines:



                  LVDS connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 18 '17 at 17:58









                  Billal BegueradjBillal Begueradj

                  1,0494 gold badges17 silver badges37 bronze badges




                  1,0494 gold badges17 silver badges37 bronze badges
























                      1
















                      For what it's worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:



                      Option "MetaModes" "DP-1: 1440x900 +0+0, DP-3: 1440x900 +1568+0, DP-5: 1440x900 +3136+0"


                      The xrandr output looks like this:



                      DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
                      HDMI-0 disconnected (normal left inverted right x axis y axis)
                      DP-0 disconnected (normal left inverted right x axis y axis)
                      DP-1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
                      1440x900 59.89*+
                      1280x1024 60.02
                      1280x960 60.00
                      1280x800 59.81
                      1280x720 60.00
                      1152x864 75.00
                      1024x768 70.07 60.00
                      800x600 75.00 60.32 56.25
                      640x480 75.00 72.81 59.94
                      DP-2 disconnected (normal left inverted right x axis y axis)
                      DP-3 connected (normal left inverted right x axis y axis)
                      1440x900 59.89 + 74.98
                      1280x1024 60.02
                      1280x960 60.00
                      1280x800 59.81
                      1280x720 60.00
                      1152x864 75.00
                      1024x768 70.07 60.00
                      800x600 75.00 60.32 56.25
                      640x480 75.00 72.81 59.94
                      DP-4 disconnected (normal left inverted right x axis y axis)
                      DP-5 connected 1440x900+1568+0 (normal left inverted right x axis y axis) 410mm x 256mm
                      1440x900 59.89*+
                      1280x1024 60.02
                      1280x960 60.00
                      1280x800 59.81
                      1280x720 60.00
                      1152x864 75.00
                      1024x768 70.07 60.00
                      800x600 75.00 60.32 56.25
                      640x480 75.00 72.81 59.94


                      You can see that DP-3 isn't showing a resolution on the line that a grep for "connected" would show. So the best, most consistent, and reliable command I've found for identifying the resolution of any individual connected display is:



                      /usr/bin/xrandr --query|/usr/bin/grep -A 1 connected|grep -v connected


                      which produces this:



                       1440x900 59.89*+
                      --
                      1440x900 59.89*+ 74.98
                      --
                      1440x900 59.89*+


                      At that point, it's pretty trivial to pick out the different resolutions or grep for only one port.






                      share|improve this answer





























                        1
















                        For what it's worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:



                        Option "MetaModes" "DP-1: 1440x900 +0+0, DP-3: 1440x900 +1568+0, DP-5: 1440x900 +3136+0"


                        The xrandr output looks like this:



                        DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
                        HDMI-0 disconnected (normal left inverted right x axis y axis)
                        DP-0 disconnected (normal left inverted right x axis y axis)
                        DP-1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
                        1440x900 59.89*+
                        1280x1024 60.02
                        1280x960 60.00
                        1280x800 59.81
                        1280x720 60.00
                        1152x864 75.00
                        1024x768 70.07 60.00
                        800x600 75.00 60.32 56.25
                        640x480 75.00 72.81 59.94
                        DP-2 disconnected (normal left inverted right x axis y axis)
                        DP-3 connected (normal left inverted right x axis y axis)
                        1440x900 59.89 + 74.98
                        1280x1024 60.02
                        1280x960 60.00
                        1280x800 59.81
                        1280x720 60.00
                        1152x864 75.00
                        1024x768 70.07 60.00
                        800x600 75.00 60.32 56.25
                        640x480 75.00 72.81 59.94
                        DP-4 disconnected (normal left inverted right x axis y axis)
                        DP-5 connected 1440x900+1568+0 (normal left inverted right x axis y axis) 410mm x 256mm
                        1440x900 59.89*+
                        1280x1024 60.02
                        1280x960 60.00
                        1280x800 59.81
                        1280x720 60.00
                        1152x864 75.00
                        1024x768 70.07 60.00
                        800x600 75.00 60.32 56.25
                        640x480 75.00 72.81 59.94


                        You can see that DP-3 isn't showing a resolution on the line that a grep for "connected" would show. So the best, most consistent, and reliable command I've found for identifying the resolution of any individual connected display is:



                        /usr/bin/xrandr --query|/usr/bin/grep -A 1 connected|grep -v connected


                        which produces this:



                         1440x900 59.89*+
                        --
                        1440x900 59.89*+ 74.98
                        --
                        1440x900 59.89*+


                        At that point, it's pretty trivial to pick out the different resolutions or grep for only one port.






                        share|improve this answer



























                          1














                          1










                          1









                          For what it's worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:



                          Option "MetaModes" "DP-1: 1440x900 +0+0, DP-3: 1440x900 +1568+0, DP-5: 1440x900 +3136+0"


                          The xrandr output looks like this:



                          DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
                          HDMI-0 disconnected (normal left inverted right x axis y axis)
                          DP-0 disconnected (normal left inverted right x axis y axis)
                          DP-1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
                          1440x900 59.89*+
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94
                          DP-2 disconnected (normal left inverted right x axis y axis)
                          DP-3 connected (normal left inverted right x axis y axis)
                          1440x900 59.89 + 74.98
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94
                          DP-4 disconnected (normal left inverted right x axis y axis)
                          DP-5 connected 1440x900+1568+0 (normal left inverted right x axis y axis) 410mm x 256mm
                          1440x900 59.89*+
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94


                          You can see that DP-3 isn't showing a resolution on the line that a grep for "connected" would show. So the best, most consistent, and reliable command I've found for identifying the resolution of any individual connected display is:



                          /usr/bin/xrandr --query|/usr/bin/grep -A 1 connected|grep -v connected


                          which produces this:



                           1440x900 59.89*+
                          --
                          1440x900 59.89*+ 74.98
                          --
                          1440x900 59.89*+


                          At that point, it's pretty trivial to pick out the different resolutions or grep for only one port.






                          share|improve this answer













                          For what it's worth, when using multiple connected displays and/or offsets with TwinView then xdpyinfo will give you the resolution of the entire set of displays the way they are configured. If you require the resolution of a single monitor or a monitor connected to one of the display ports you need to use xrandr. However, even in that configuration xrandr can be unreliable and not show the resolution. See this example entry from my X windows config file:



                          Option "MetaModes" "DP-1: 1440x900 +0+0, DP-3: 1440x900 +1568+0, DP-5: 1440x900 +3136+0"


                          The xrandr output looks like this:



                          DVI-D-0 disconnected primary (normal left inverted right x axis y axis)
                          HDMI-0 disconnected (normal left inverted right x axis y axis)
                          DP-0 disconnected (normal left inverted right x axis y axis)
                          DP-1 connected 1440x900+0+0 (normal left inverted right x axis y axis) 410mm x 256mm
                          1440x900 59.89*+
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94
                          DP-2 disconnected (normal left inverted right x axis y axis)
                          DP-3 connected (normal left inverted right x axis y axis)
                          1440x900 59.89 + 74.98
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94
                          DP-4 disconnected (normal left inverted right x axis y axis)
                          DP-5 connected 1440x900+1568+0 (normal left inverted right x axis y axis) 410mm x 256mm
                          1440x900 59.89*+
                          1280x1024 60.02
                          1280x960 60.00
                          1280x800 59.81
                          1280x720 60.00
                          1152x864 75.00
                          1024x768 70.07 60.00
                          800x600 75.00 60.32 56.25
                          640x480 75.00 72.81 59.94


                          You can see that DP-3 isn't showing a resolution on the line that a grep for "connected" would show. So the best, most consistent, and reliable command I've found for identifying the resolution of any individual connected display is:



                          /usr/bin/xrandr --query|/usr/bin/grep -A 1 connected|grep -v connected


                          which produces this:



                           1440x900 59.89*+
                          --
                          1440x900 59.89*+ 74.98
                          --
                          1440x900 59.89*+


                          At that point, it's pretty trivial to pick out the different resolutions or grep for only one port.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 2 at 22:47









                          user930364user930364

                          111 bronze badge




                          111 bronze badge































                              draft saved

                              draft discarded















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f584688%2fhow-can-i-get-the-monitor-resolution-using-the-command-line%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Tamil (spriik) Luke uk diar | Nawigatjuun

                              Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                              Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?