How to save and exit crontab -e?

Solution 1:

As others have pointed out, the first thing is to make sure you're using an editor you like.

We're all admins here, so we all like vi (ducks, runs).

export VISUAL=vi
crontab -e

(do some edits, finishing with ESCAPE)

:wq

And crontab -l should now show you your new crontab. If you prefer some other editor, set that in the VISUAL environment variable, and exit it as appropriate.

Solution 2:

Ctrl+x, answer by pressing y to save changes and Enter to confirm.


Solution 3:

To exit vi editor:

Usually the new or modified file is saved when you leave vi. However, it is also possible to quit vi without saving the file. The cursor moves to bottom of screen whenever a colon (:) is typed.

:x<Enter>   quit vi, writing out modified file to file named in original invocation
:wq<Enter>  quit vi, writing out modified file to file named in original invocation
:q<Enter>   quit (or exit) vi
:q!<Enter>  quit vi even though latest changes have not been saved for this vi call

Solution 4:

esc-esc-:wq? Are you saying vi is the default editor, and you want nano instead?

Saving and quitting vi is outlined here: http://www.helpdesk.umd.edu/documents/4/4793/#a13

Tags:

Cron

Centos5

Vps