{"id":1421,"date":"2011-10-18T23:07:33","date_gmt":"2011-10-18T15:07:33","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=1421"},"modified":"2023-04-28T09:50:01","modified_gmt":"2023-04-28T09:50:01","slug":"how-to-fix-bash-crontab-command-not-found-error","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-fix-bash-crontab-command-not-found-error\/","title":{"rendered":"How to Fix &#8220;-bash: crontab: command not found&#8221; Error"},"content":{"rendered":"<p>Cron is a popular tool used in Unix-like operating systems to schedule jobs or commands to run automatically at specific intervals. The crontab command is used to create, edit, and delete cron jobs. However, if you get an error message that says &#8220;-bash: crontab: command not found&#8221;, it means that the crontab command is not installed or not in the system&#8217;s PATH.<\/p>\n<pre>\r\n[root@server ~]# crontab -l\r\n-bash: crontab: command not found\r\n\r\n[root@server ~]# crontab -e\r\n-bash: crontab: command not found\r\n<\/pre>\n<p>In this guide, we will show you how to fix this error.<\/p>\n<h2>Step 1: Check crontab installation<\/h2>\n<p>The first step is to check if the crontab command is installed on your system. You can do this by running the following command:<\/p>\n<pre>\r\nwhich crontab\r\n<\/pre>\n<p>If the crontab command is installed, you will see the path to the crontab executable. If the command is not installed, you will see no output.<\/p>\n<h2>Step 2: Install cronie<\/h2>\n<p>If the crontab command is not installed, you need to install the cronie package. You can do this by running the following command as root:<\/p>\n<pre>\r\nyum install cronie\r\n<\/pre>\n<p>This will download and install the cronie package and its dependencies.<\/p>\n<h2>Step 3: Verify crontab installation<\/h2>\n<p>After installing cronie, you need to verify that the crontab command is now available. You can do this by running the which command again:<\/p>\n<pre>\r\nwhich crontab\r\n<\/pre>\n<p>If the installation was successful, you will see the path to the crontab executable.<\/p>\n<h2>Step 4: Add crontab to PATH<\/h2>\n<p>If the crontab command is still not available, you need to add the directory containing the crontab executable to the system&#8217;s PATH environment variable. You can do this by adding the following line to the \/etc\/profile file:<\/p>\n<pre>\r\nexport PATH=$PATH:\/usr\/sbin\r\n<\/pre>\n<p>Save the file and exit the text editor.<\/p>\n<h2>Step 5: Reload profile<\/h2>\n<p>After adding the PATH variable, you need to reload the \/etc\/profile file to apply the changes. You can do this by running the following command:<\/p>\n<pre>\r\nsource \/etc\/profile\r\n<\/pre>\n<h2>Step 6: Verify crontab availability<\/h2>\n<p>Finally, you can verify that the crontab command is now available by running the which command again:<\/p>\n<pre>\r\nwhich crontab\r\n<\/pre>\n<p>If the command is available, you will see the path to the crontab executable.<\/p>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">which<\/span> &#8211; locates the executable file of a command<\/li>\n<li><span class=\"fw-bold\">yum install<\/span> &#8211; installs packages<\/li>\n<li><span class=\"fw-bold\">source<\/span> &#8211; reloads shell environment<\/li>\n<\/ul>\n<h2>Conclusion:<\/h2>\n<p>In this guide, we have shown you how to fix the &#8220;-bash: crontab: command not found&#8221; error by installing the cronie package or adding the crontab directory to the system&#8217;s PATH environment variable. By fixing this error, you can now use the crontab command to schedule jobs or commands to run automatically.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cron is a popular tool used in Unix-like operating systems to schedule jobs or commands to run automatically at specific intervals. The crontab command is used to create, edit, and&#8230;<\/p>\n","protected":false},"author":6,"featured_media":349,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1136],"tags":[1996,1536,1736],"class_list":["post-1421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cronjob","tag-cron","tag-linux","tag-schedule-task"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=1421"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/1421\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/349"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=1421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=1421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=1421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}