I edit my crontab using vim (opened via crontab -e command).

How can I update the effective cron table without leaving vim?

For safety reasons crontab -e opens a temporary file (check path by pressing 1 followed by CTRL+G). When you leave your editor of choice your cron table is checked and if it is valid it will be installed showing the familiar

crontab: installing new crontab

1 Answer 1


While within vim you can run shell commands. Do the following to install the current buffer as your cron table.


This will save the current buffer to its file.

:!crontab %

This will open a shell and call crontab giving the current buffer's file (known to vim as % by its relative path) as the new cron table to install.

If you don't trust the shell command, maybe try the following commands first:

:!echo foo to see the shell and the output foo.

:!echo % to see the relative path to the buffer's file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .