I tried using crontab -l from my terminal as root, it showed no crontab for root. So I tried crontab -e, it returns the following

no crontab for root - using an empty one 888

and then the cursor starts blinking. I am not able to quit or save the file.

  • What do you mean by “am not able to quit or save the file” — do you mean that you don't know how to, or that you tried and nothing happen? What did you try? You're in an editor, which may be in vi by default, it depends on your distribution. – Gilles 'SO- stop being evil' May 21 '14 at 11:32
  • @Gilles I am using Ubuntu 14.04. ctrl+z stops but I am not able to save the file. What does 888 there indicate? – Joker May 21 '14 at 11:37
  • On ubuntu the default editor is nano, which is very recognizable (it would say GNU nano … on the top line). It looks like the file is being edited in some GUI editor in another window. – Gilles 'SO- stop being evil' May 21 '14 at 18:35
  • @Gilles Only those two lines appear when I give crontab -e nothing else. Be it at the top or at the bottom. – Joker May 22 '14 at 4:38

When you run the command crontab -e it typically defaults to the vi or vim editors. If you type the command Shift+Z+Z you can save any changes in this editor and exit.

To add entries to your crontab using this method you'll need to learn how to use this editor more extensively, which is beyond the scope of this question, and should be easy to find many tutorials on the internet.

If vi/vim is too much of a learning curve you can instruct crontab to use a different editor. Another console based editor that's easier for new people to Linux is nano, it's typically installed on most distros that I'm familiar with.

$ EDITOR=nano crontab -e

NOTE: To use nano's menu all the carets (aka ^X) commands at the bottom require the use of the Ctrl key. So to exit, Ctrl+X, for example.

You can of course use any editor here. A easy GUI based editor, if you're using a GNOME based desktop, would be gedit:

$ EDITOR=gedit crontab -e

This last one might be a challenge to use, for a different set of reasons, if your primary desktop is being run by a user other than root, which it likely is, so I would go with nano for starters.

  • “Cursor starts blinking” doesn't look like a description of any version of vi. There should be something like /tmp/crontab.wibble: … at the bottom of the screen. Nano is the default editor on Ubuntu, but it maintains 5 lines of screen estate. It looks like some X11 editor was launched. – Gilles 'SO- stop being evil' May 21 '14 at 18:32
  • @Gilles - total guess on my part. – slm May 21 '14 at 19:25
  • The OP's description sounds more like ed - typing q then ENTER should quit. The 888 is the character count of the template /var/spool/cron/$USER file I think. – steeldriver May 21 '14 at 20:07
  • @slm EDITOR=nano crontab -e brought up the editor. I typed @reboot sh -c /path/to/netbeans/netbeans. But on reboot, netbeans did not start. I entered the command as root – Joker May 22 '14 at 5:54
  • The same lines occur when i just give crontab -e – Joker May 22 '14 at 6:15

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.