Display monitor info via command line
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.
02:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Madison [Mobility Radeon HD 5650/5750 / 6550M]
8 Answers 8
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.
sudo apt-get install read-edid
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?
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 🙂
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.
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
Case where get-edid does not show all monitors
$ 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.
sudo apt-get install read-edid
ls /sys/class/drm/*/edid | xargs -i<> sh -c "echo <>; parse-edid < <>"
Method 2, reading the edid files from sysfs worked for me, thanks! It seems like read-edid probably needs to be updated.
$ 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".
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.
@BorisVerkhovskiy Refer to the Arch wiki for more info. And of course this specific command requires an NVIDIA GPU.
(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)
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
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:
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.
This worked for me on Ubuntu 18.04.
The monitor is connected using HDMI:
grep -i "monitor name" /var/log/syslog
Some window managers provide commands for listing output details. This one works if you are running swaywm :
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
Как узнать марку / модель монитора?
Мой друг недавно купил подержанный автомобиль с автомобильным компьютером, и он подключен к сенсорному монитору на приборной панели (очень впечатляет!).
Теперь я помог ему установить Ubuntu на нем сегодня, но мы не можем установить марку и модель подключенного монитора с сенсорным экраном, чтобы попытаться найти драйверы для работы функции сенсорного экрана.
Существуют ли какие-либо команды Linux для определения марки / модели подключенного монитора? Я пробовал Google, который указал мне на /etc/X11 каталог, но не было радости с этим.
7 ответов
Я могу увидеть марку и модель моего монитора в /var/log/Xorg.0.log , Однако он выводится видеодрайвером, поэтому я не уверен, что он универсален:
[ 26.795] (II) RADEON(0): Monitor name: DELL U2412M
Если это не работает, установите edid-decode и укажите его /sys/class/drm/*/edid поскольку его руководство предлагает:
ls /sys/class/drm/*/edid | xargs -n 1 edid-decode | grep Manufacturer:
lshw или же sudo lshw будет работать лучше чем lspci ,
Сам искал ответ на Fedora. Это даст вам длинный список для всех вопросов, связанных с видео:
Найдите строку EDID и скопируйте / вставьте ее в файл, например, monitor.txt (возможно, есть лучший способ.) Затем используйте:
чтобы получить всю информацию о вашем мониторе из строки EDID.
Если у вас есть только один монитор, вы можете сделать что-то вроде:
xrandr -q --verbose | grep -i EDID -A 8 | grep -v EDID | sed s/\\t//g | edid-decode
Что-то вроде этого должно работать лучше (все остальные ответы здесь не работали на 100%):
for file in `ls -1 /sys/class/drm/*/edid`; do text=$(tr -d '\0' <"$file"); if [ -n "$text" ]; then edid-decode "$file" | grep -e Manufacturer: -e Product; sleep 0.0001; fi done
Я тестировал здесь с двумя мониторами. Мой основной - это встроенный монитор ноутбука, а вторичный - DELL 25". Это был результат:
Manufacturer: DELL Model 53359 Serial Number 809781068 Display Product Serial Number: YKFWP5790DGL Display Product Name: DELL U2515H Manufacturer: LGD Model 1133 Serial Number 0
Вы должны были установить edid-decode в вашем дистрибутиве. Моя установка - DELL Latitude e5450 с Ubuntu 20.04.
Установить пакет read-edid и используйте команду:
В моей системе соответствующий вывод:
This is read-edid version 3.0.2. Prepare for some fun. Attempting to use i2c interface Section "Monitor" Identifier "S22B300" ModelName "S22B300" VendorName "SAM"