Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Windows, there is an option to click on a button in the display properties called like "Identify Displays", it then shows a number over each monitor for a few seconds so that you know which display is which. Is there something similar in Linux?

I am running Arch, and have six (6) identical LCD flat panels, 3 dual head NVidia cards. So you can imagine why I ask :P

share|improve this question

Note that (as pointed out by Wieland H., this answer assumes a well-behaving video driver. Nvidia's proprietary driver (which used to be required for dual-head operation, I don't know if this is still the case with Nouveau) doesn't use the standard RandR extension, so if you use it most of my answer will be useless and you need to look for an answer that's specific to the nvidia driver.

Under KDE, the “Multiple Monitors” tab in the “Display” panel in the Control Center (kcontrol, KDE 3) or System Settings (systemsettings, KDE 4) has just this (click on “Identify all displays”). You don't have to be running KDE as a desktop environment to use this, you just have to have the right component installed.

If you prefer to do things by hand, the following snippet parses the output from xrandr. It specifically looks for lines like DVI-0 connected 1600x1200+3200+0 …, which gives the position (3200 pixels from the left, 0 pixels from the top), size (width 1600, height 1200), and name (DVI-0) of a monitor. It displays a pop-up with this information using kdialog. The script kills all kdialog instances as soon as one of them returns, which happens when you click on any pop-up.

Any other program similar to kdialog would do, as long as you can specify the position of the pop-up (this isn't the case with the better-known zenity). The shell has to be ksh (it can be pdksh or ATT ksh), because other shells (at least, bash and zsh) don't behave well enough in the presence of multiple jobs (specifically, their wait built-in isn't interrupted by a SIGCHLD).

LC_ALL=C xrandr |
sed -ne 's/^\([^ ][^ ]*\)  *connected  *\([0-9][0-9]*\)x\([0-9][0-9]*\)+\([0-9][0-9]*\)+\([0-9][0-9]*\) .*$/\1 \2 \3 \4 \5/p' |
ksh -c '
  trap "trap - CHLD" CHLD
  trap : INT
  while read -r name w h x y; do
    kdialog --geometry +$(($x+2*$w/5))+$(($y+2*$h/5)) \
            --passivepopup "$i $name ${w}x${h} +$x+$y" &
  sleep 10 &  # Time out after 10 seconds
  wait  # Wait until any of the kdialog instances or sleep returns
  while [ $i -ne 0 ]; do
    kill %$i 2>/dev/null
  [ $first -eq 0 ] || echo You clicked on monitor $first
share|improve this answer
xrandr does not work correctly with NVidias TwinView, all it sees is one big screen. – Wieland Feb 11 '11 at 20:05
@Wieland Ah, right. I'd phrase it as “Nvidia's TwinView does not work correctly with xrandr” though. I've edited my answer. – Gilles Feb 11 '11 at 20:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.