I'd like to schedule a weekly backup with Crontab but I've never used it before so I wanted to start with a simple command to test it, like open a text file with gedit.

I followed this guide:

sudo crontab -e

I get my file in the terminal and I add this:

m h  dom mon dow  command
34 12    * * *    /usr/bin/gedit /home/KEN/Desktop/ImaTXT

It was 12: 32 when I saved and installed this new crontab:

crontab: installing new crontab

I checked that it was saved:

sudo crontab -l

Two minutes pass and nothing gets opened.

What am I doing wrong?

Thanks Kevy, it worked.


1 Answer 1


You should have specified $DISPLAY environmental variable and user (may be ken in your case).

$ sudo crontab -e -u user

m h dom mon dow command
34 12 * * * export DISPLAY=:0 && /usr/bin/gedit /home/KEN/Desktop/ImaTXT
  • It is to start GUI application using cron.
    – kevy
    Sep 11, 2017 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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