72

Is there a way to query monitor information from command line? For example, get monitor model, similar to e.g. what lspci does for graphic card info, or whether it's currently on or off, things like that.

If possible, what kinds of basic information such as the above can be easily gathered? For example, is it possible to determine if monitor is in portrait or landscape position? Or if it has built-in speakers or not?

Command line is the preference, but if there's a GUI method, I'd like to hear about it, too.

5

8 Answers 8

61

Yes there is, read-edid hardware information-gathering tool for VESA PnP monitors. This tool have two commands: get-edid and parse-edid: tools to retrieve and interpret monitor specifications using the VESA VBE DDC protocol. EDID (Extended Display Identification Data) is a metadata format for display devices to describe their capabilities to a video source.

First:

sudo apt-get install read-edid

Then try:

sudo get-edid | parse-edid
6
  • 1
    Thanks thom - can you clarify how can I get monitor model using get-edid / parse-edid? When I ran the above, it did not print anything (not even in Section "Monitor") that would be similar to my monitor manufacturer / model. If that's OK with you, can you paste what you get on your machine and the monitor model you have, just for comparison? Nov 7, 2013 at 2:25
  • 1
    Identifier "\QX:2d40" VendorName "\QX" ModelName "\QX:2d40" I have to say that the EDID of my monitor is buggy as hell. So that is not really representative :-)
    – thom
    Nov 7, 2013 at 2:57
  • Thanks thom - looks similar on my end: ModelName "LGD:8902", so looks like it is representative after all :) Also, it only displays my laptop monitor, but not the external one. Nov 7, 2013 at 3:10
  • 1
    A lot of EDIDs are buggy. Manufacturers don't care and driverdevelopers are doing mostly workarounds. Best info is coming from closed source videodrivers. I extract it like this: grep "Display" /var/log/Xorg.0.log |tail -1 for extensive info I use grep "NVIDIA(GPU-0)" /var/log/Xorg.0.log
    – thom
    Nov 7, 2013 at 3:21
  • This did not work for me. I get open /dev/mem: Operation not permitted Sep 20, 2022 at 14:58
36

Case where get-edid does not show all monitors

Like mine, I have:

$ lshw -c display
  *-display               
       description: VGA compatible controller
       product: 3rd Gen Core processor Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 09
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:27 memory:f6400000-f67fffff memory:e0000000-efffffff ioport:f000(size=64)

get-edid shows only the external monitor which is plugged to VGA port.

  1. Install read-edid

     sudo apt-get install read-edid
    
  2. Read EDID info directly from SYSFS tree, it should show all detected monitors

     ls /sys/class/drm/*/edid | xargs -i{} sh -c "echo {}; parse-edid < {}"
    
3
  • 1
    Method 2, reading the edid files from sysfs worked for me, thanks! It seems like read-edid probably needs to be updated. Apr 12, 2022 at 17:52
  • 1
    mine showed this: This is read-edid version 3.0.2. Prepare for some fun. Attempting to use i2c interface Problem requesting slave address: Device or resource busy No EDID on bus 1 No EDID on bus 2 No EDID on bus 3 No EDID on bus 5 1 potential busses found: 4 128-byte EDID successfully retrieved from i2c bus 4 ������ ����"x $�YT�'PT�eP(00 DX���V�Q\0ddDX�� G� Looks like i2c was successful. Have a good day. <n Oct 27, 2023 at 22:34
  • 1
    I used your method, and this helped me identify which edid I was reading from: for edid in $(ls /sys/class/drm/*/edid); do echo $edid; edid-decode $edid | grep 'Display Product Name' ; done
    – rupert160
    Feb 7 at 1:41
27
$ grep "NVIDIA(GPU-0)" /var/log/Xorg.0.log |head -17| cut -d\: -f2
 Display (Samsung SA300/SA350 (DFP-0)) does not support NVIDIA
     3D Vision stereo.
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "1920x1080" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "1920x1080".
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "1280x720" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "1280x720".
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "720x576" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "720x576".
5
  • first line is the command. Note that this is not de official way to get vendor/model info from the monitor (but tragically it is often the only way), also it is GPU-vendor dependent.
    – thom
    Nov 7, 2013 at 3:32
  • 2
    Thanks - looking into /var/log/Xorg.0.log actually helps - it's a pity this is the only way. Nov 7, 2013 at 3:52
  • I Found a howto: wiki.xbmc.org/…
    – thom
    Nov 7, 2013 at 4:07
  • 7
    /var/log/Xorg.0.log: No such file or directory
    – user677955
    Dec 9, 2019 at 17:21
  • @BorisVerkhovskiy Refer to the Arch wiki for more info. And of course this specific command requires an NVIDIA GPU. Nov 27, 2022 at 7:59
18

Try

xrandr

(I used the program once when I was playing with dual monitor setup on Archlinux .)

You can find it in the x11-server-utils package. That package contains other stuff to play with like:

  • iceauth, a tool for manipulating ICE protocol authorization records;
  • rgb;
  • sessreg, a simple program for managing utmp/wtmp entries;
  • xcmsdb, a device color characteristic utility for the X Color Management System;
  • xgamma, a tool for querying and setting a monitor's gamma correction;
  • xhost, a very dangerous program that you should never use;
  • xmodmap, a utility for modifying keymaps and pointer button mappings in X;
  • xrandr, a command-line interface to the RandR extension;
  • xrdb, a tool to manage the X server resource database;
  • xrefresh, a tool that forces a redraw of the X screen;
  • xset, a tool for setting miscellaneous X server parameters;
  • xsetmode and xsetpointer, tools for handling X Input devices;
  • xsetroot, a tool for tailoring the appearance of the root window;
  • xstdcmap, a utility to selectively define standard colormap properties;
  • xvidtune, a tool for customizing X server modelines for your monitor. (information found in synaptic package manager)
2
  • 3
    Thanks Frank - can you clarify how do I get monitor model using xrandr? Nov 7, 2013 at 2:24
  • ahah never use xhost? why
    – Jack
    Nov 24, 2016 at 22:02
10

xrandr, xrandr --prop and xrandr --verbose will give you some information with different level of detail.

Manufacturer-provided information can be found in the EDID format.

To get and decode EDID, first check xrandr output to find out the used interface (e.g. eDP-1) and apt install edid-decode, then:

edid-decode </sys/class/drm/card0-eDP-1/edid

Example output you can find here. Replace eDP-1 with your interface if needed.

Alternatively, xrandr --prop outputs EDID in hex format that you can feed to this online EDID decoder.

I don't recommend using read-edid package because I had negative experiences with it (version 3.0.2). In my case, get-edid outputs additional characters after the end that lead to a warning from edid-decode and parse-edid outputs random garbage in ModelName and Identifier fields.

9

This gives you all the information you need:

dbus-send --session --print-reply --dest=org.gnome.Mutter.DisplayConfig /org/gnome/Mutter/DisplayConfig org.gnome.Mutter.DisplayConfig.GetCurrentState

2
  • 3
    Maybe so, if you use Mutter window manager.
    – jarno
    Dec 25, 2020 at 22:02
  • 1
    Excellent, a solution that doesn't need additional tools on a standard linux desktop
    – dan carter
    Apr 2, 2023 at 3:43
7

This worked for me on Ubuntu 18.04.
The monitor is connected using HDMI:

grep -i "monitor name" /var/log/syslog
0

Some window managers provide commands for listing output details. This one works if you are running swaywm:

$ swaymsg -t get_outputs

It generates the following output

Output eDP-1 'Unknown 0x408D 0x00000000'
  Current mode: 1920x1080 @ 60.049000 Hz
  Position: 0,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 10
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    640x480 @ 60.049000 Hz
    800x600 @ 60.049000 Hz
    1024x768 @ 60.049000 Hz
    1280x720 @ 60.049000 Hz
    1280x800 @ 60.049000 Hz
    1440x900 @ 60.049000 Hz
    1280x1024 @ 60.049000 Hz
    1680x1050 @ 60.049000 Hz
    1920x1080 @ 60.049000 Hz

Output HDMI-A-1 'Samsung Electric Company C24F390 SRNABC123' (focused)
  Current mode: 1920x1080 @ 60.000000 Hz
  Position: 1920,0
  Scale factor: 1.000000
  Scale filter: nearest
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 1
  Max render time: off
  Adaptive sync: disabled
  Available modes:
    720x400 @ 70.082001 Hz
    640x480 @ 59.939999 Hz
    640x480 @ 60.000000 Hz
    640x480 @ 66.667000 Hz
    640x480 @ 72.808998 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 59.939999 Hz
    720x480 @ 60.000000 Hz
    720x480 @ 60.000000 Hz
    720x576 @ 50.000000 Hz
    720x576 @ 50.000000 Hz
    800x600 @ 56.250000 Hz
    800x600 @ 60.317001 Hz
    800x600 @ 72.188004 Hz
    1024x768 @ 60.004002 Hz
    1024x768 @ 70.069000 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 50.000000 Hz
    1280x720 @ 59.939999 Hz
    1280x720 @ 60.000000 Hz
    1280x720 @ 60.000000 Hz
    1280x800 @ 59.910000 Hz
    1440x900 @ 59.901001 Hz
    1280x1024 @ 60.020000 Hz
    1600x900 @ 60.000000 Hz
    1680x1050 @ 59.882999 Hz
    1920x1080 @ 50.000000 Hz
    1920x1080 @ 59.939999 Hz
    1920x1080 @ 60.000000 Hz
    1920x1080 @ 60.000000 Hz

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .