How to recover deleted crontab

You can find your cron jobs from the log if once it has executed before. Check /var/log/cron.

You do not have any recovery option other than third party recovery tools.


I am not sure, it is possible to recover crontab file without backup. But, I am pretty sure you can restore your crontab file from cron logs. As far as I remember, fast every command is listed there with user.


If you remember a specific line, you can grep the whole device to find your data back, at the condition that no other data overwrote it. This works for any file.

grep -a -B100 -A100 "command/you remember" /dev/sda1 > /tmp/cron.ressurected

Adjust -B(efore) and -A(fter) to your file size, but 100 lines around should be enough for a cron file. The -a parameter is needed to force grep to consider your device as text.

You will then have to clean the binary mess before and after your data in the resulting file.

And it takes a lot of time. Good luck.

You could also refer to this answer : Undelete / recover deleted files | Unix & Linux Stack Exchange