Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I am writing a sh file to take screen short and want to schedule in crontab but when i run the .sh file it run OK no problem happens but when try to schedule it in crontab i got an error like

import: unable to open X server `' @ error/import.c/ImportImageCommand/366.

my .sh file is like

import -window root $HOME/Desktop/$filename.png

any idea how to solve it i tried with

which import

it is showing

share|improve this question
up vote 5 down vote accepted

You could probably add this line before the import line

export DISPLAY=':0'
share|improve this answer
Thank you very much it really work. Thank once again – smn_onrocks Feb 18 '14 at 11:10
You can what existing 'displays' you are running on using w. – Wilf Feb 18 '14 at 11:32

There is also a small software that can be useful for this task, allowing you some extra options, like delay between the screenshot and your command. It is called scrot.

I understand this is not your point here, but still can be a useful information for someone that google to here.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.