Menu

How to find ID of the display connected to your Linux machine

Normally, we see only a single display connected to computer systems. However, that's not always the case as you can have multiple displays connected to a system.

While working with more than one displays, sometimes you might find yourself in situation where-in you need to perform a display-specific task. For example, taking a screenshot. In these scenarios, you need to know the ID of the display you want to perform the action on.

In this tutorial, we will learn how you can find the ID corresponding to a particular display. Please note that all the commands and instructions mentioned in this article have been tested on Ubuntu 16.04 LTS.

Find Linux display ID

For this, you need to use the Xrandr command. According to the tool's man page, it "is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size."

This command provides a --query (or -q) command line option that displays the current state of the system. The information produced in this case contains IDs of the displays connected to the computer.

All the IDs are highlighted in bold. As the output reveals, only one display is currently connected to my system.

As for usage, one example could be the command line screenshot taking tool gnome-screenshot (PLEASE LINK TO OUR GNOME_SCREENSHOT ARTICLE ON HTF) that requires display ID to know which screen the user wants to grab.