How do I list connected displays using the command line?

188,080

Solution 1

Try this:

xrandr --query

This lists the display names and detected available resolutions. You can also reconfigure your displays using xrandr.

Note that this might not work if you're using the NVidia or ATI drivers; I'm not sure.

Solution 2

For most machines with the proprietary driver loaded, /usr/lib/nvidia-current/bin/nvidia-xconfig --query-gpu-info --nvidia-cfg-path=/usr/lib/nvidia-current works. Note that I said "with the proprietary driver loaded". For instance, it does not work if the driver is unloaded or nouveau is loaded. Therefore, when using Bumblebee, run optirun /usr/lib/nvidia-current/bin/nvidia-xconfig --query-gpu-info. The --nvidia-cfg-path part is not needed here as optirun sets the correct library path.

See also the discussion on https://github.com/Bumblebee-Project/Bumblebee/issues/21

/var/log/Xorg.0.log (where 0 is the display number) may also contain valuable information about available screens. For Optimus laptops, this log contains only details on the Intel screen, so replace 0 by 8 to find out the log from the X server started by Bumblebee.

Share:
188,080

Related videos on Youtube

Erland
Author by

Erland

I'm a climate & energy campaigner with Greenpeace. By night, I'm also a professional photographer, graphic & web designer and open source software enthusiast. I live in the World Heritage Blue Mountains, west of Sydney. I believe in ecological sustainability, social justice, peace & participatory democracy. I love nature, cycling (especially recumbents) and working with inspiring activists and community groups to make the world a better place.

Updated on September 18, 2022

Comments

  • Erland
    Erland over 1 year

    Is there a command that will list displays connected to the computer?

    Specifically, I'm looking to find out how my external monitor is being detected by the system when connected by HDMI cable and what it's (not sure of the correct term here) hardware address is (eg. "CRT-0" or "DFP-1").

    This is just a general question, but for reference, I'm using:

    • Asus UL30JT laptop - running Ubuntu 12.04 beta and 11.10
    • Asus PA238 23" monitor
    • HDMI 1.4 cable
    • Optimus graphics (Intel + nVidia GeForce 310M) - running with Bumblebee
  • Doughnut Jimmy
    Doughnut Jimmy about 12 years
    I gave the xrandr ++query command and it says "Can't open display" What to do ?
  • ams
    ams about 12 years
    xrandr only works when you run it under X-windows. After all, it is X that handles all but the most basic video drivers. If you are in a terminal inside X and it still doesn't work, then you've most likely lost your $DISPLAY environment variable, somehow.
  • Sanjay Manohar
    Sanjay Manohar over 9 years
    +1, This works when there are multiple graphics cards, whereas the xrandr answer does not.
  • Nikola Malešević
    Nikola Malešević about 9 years
    Don't forget to add -display :0.0 if trying this from remote log-in (putty?).
  • mpen
    mpen over 8 years
    xrandr --query | grep '\bconnected\b' if you just wanted to see the connected monitors and their resolutions.
  • Nonny Moose
    Nonny Moose over 7 years
    @bmbaker I think the OP just forgot to hold down the shift key.
  • endolith
    endolith over 5 years
    @NikolaMalešević Now it's changed from Can't open display to Can't open display :0.0 :|
  • Rich
    Rich over 4 years
    @mpen xrandr --listconnectedmonitors surely?