unable to open X server

soniccool picture soniccool · Nov 3, 2011 · Viewed 20.6k times · Source

I am trying to generate a screenshot of a firefox window in my terminal, but I keep getting an error:

root@host [~]# DISPLAY=:1 firefox http://www.cnn.com & sleep 5 && DISPLAY=:1 import -window root -crop 1264x948+0+25 -quality 90 /usr/local/apache/htdocs/screenshot1.jpg && pkill firefox
[1] 30200
import: unable to open X server `:1' @ import.c/ImportImageCommand/364.

Why is this happening? How can I fix it?

Answer

Michael Krelin - hacker picture Michael Krelin - hacker · Nov 3, 2011

Maybe try DISPLAY=:0, for example?