Read more

How to look at hidden X screens

Arne Hartherz
July 25, 2011Software engineer at makandra GmbH

When you have a program running in a hidden X screen (like with Xvfb for Selenium tests) you may want to look at that hidden screen occasionally.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

First, find out what X displays are currently active:

netstat -nlp | grep X11

This should give you some results like these:

unix  2      [ ACC ]     STREAM     LISTENING     8029600  4086/Xvfb           /tmp/.X11-unix/X99
unix  2      [ ACC ]     STREAM     LISTENING     8616     -                   /tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     8615     -                   @/tmp/.X11-unix/X0
unix  2      [ ACC ]     STREAM     LISTENING     8029599  4086/Xvfb           @/tmp/.X11-unix/X99

In that case displays 0 and 99 are active and you can see that 99 is provided by Xvfb.

Next, simply make a screenshot from that display, e.g. with scrot:

DISPLAY=:99 scrot

This will create a timestamped PNG file in your current directory. You may also pass a custom filename to scrot.
Look at the screenshot with your favorite tool.

Posted by Arne Hartherz to makandra dev (2011-07-25 16:01)