Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script that I want to be run every X minutes. I already have the cron sentence I need to paste to the cron, but can't find it anywhere.

The terminal command 'crontab -e' works, but it opens it in vim! No way I'm using that yet. How can I edit this file using gedit?

I don't even know the path to the file.

Here's the script:

*/3 * * * * /home/sergio/myscript.sh

How can I use gedit to manually add this line? Thanks!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You shouldn't edit the crontab file directly anyway, so you don't need to know the path to it. That said, you should be able to find the location on your system from man cron.

If you would rather use gedit than vim as your default editor, then add this to your ~/.profile:

EDITOR=gedit

In the short term (before logging out and back in), you can do as suggested above, i.e., from the command line:

EDITOR=gedit crontab -e
share|improve this answer
1  
You should set EDITOR to a full path, as a few applications depend on that. Also set VISUAL to the same value (the two variables used to have a different meaning; nowadays most applications try both but a few only use one or the other). –  Gilles Oct 23 '10 at 22:45

You can find out the path using:

`which crontab`

But you'd probably better off by setting your default editor. Try:

EDITOR=`which gedit` crontab -e
share|improve this answer
1  
which crontab will display the path to the crontab program. I believe the OP was asking for the path to his crontab file. –  garyjohn Oct 23 '10 at 17:29

Your Answer

 
discard

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