Fixing Crontab-e "No Such File Or Directory" Error


by AndrzejL

I was trying to run crontab -e on one of my machines, to add a few cron jobs, and I found myself looking at this error:

/bin/sh: /usr/bin/vi: No such file or directory

What the ...? I have vi installed, I thought, and I started to investigate. Crontab is looking for the vi file in the wrong place. To fix it, run these commands:

su

Provide the root password when prompted.

ln -s /bin/vi /usr/bin/vi

exit

crontab -e

Now, you will be able to add entries.

If crontab -e ever gives you a “no such file or directory” error, check to be sure that the application you are running is where it should be. If it isn’t, either create a soft link in the /usr/bin directory, as we did here, or provide the full path to the location of the application.