Share your love
Best 2 Steps to Open Crontab in Nano Editor
This guide intends to teach you to Open Crontab in Nano Editor in Linux Terminal. As you may know, the default crontab editor is Vi editor. If you want to change its default, you can follow the rest of the article.
Crontab which stands for Cron table, is a list of commands that you can use to run them on a schedule. In simple words, it is a job scheduler. To get more information about Crontab, you can visit this guide on Cron in Linux.
When you want to open the Crontab file, it opens with the Vi editor. But if you are interested in using the Nano editor instead, you can make a simple change to the bash profile and start using it.
Table of Contents
Steps To Open Crontab in Nano Editor on Linux Terminal
To Open Crontab in Nano Editor, you must have SSH access to your Linux server as a root or non-root user with sudo privileges. For this purpose, you can visit the Orcacore website and search for the Linux server’s initial guides.
When you start crontab for the first time, you’ll see a prompt asking you to choose the default text editor for editing crontab files. But if you want to change the editor later on, you can follow the steps below.
Step 1 – How to open crontab with a specific editor?
At this point, you can use the select-editor command to choose your default editor in your Linux distribution. To see how it works, run the command below in your Linux terminal:
select-editor
In your output, you will see:
Output
Select an editor.
1. /bin/nano <---- easiest
2. /usr/bin/vim.basic
3. /usr/bin/vim.tiny
4. /bin/ed
Choose 1-4 [1]:
From there, you can choose your desired editor and the next time you run the crontab -e command it will open in your chosen editor.
Step 2 – How to edit crontab in nano editor?
Another way that you can change your default editor is to use the environment variables. If you want to open crontab with nano, you need to make sure that you have installed it on your server. To see how you can install it on your Linux server, you can visit this guide on Work with Nano editor.
Then, you need to open your bashrc profile with the following command:
nano ~/.bashrc
Add the following line at the end of the file:
export VISUAL="nano"
When you are done, save and close the file.
Next, reload the bashrc profile to apply the changes:
source ~/.bashrc
At this point, you have learned to Open Crontab in Nano Editor:
crontab -e
Note: Any time you want to change it to the Vi editor, you can edit the file and use vim:
export VISUAL="vim"
Conclusion
At this point, you have learned to Open Crontab in Nano Editor in a Linux command line terminal. Hope you enjoy it. If you need any help or have an idea, please comment for us. Also, you may like to read the following articles:
4 Linux Commands to Get Public IP Address
12 Commands to Check Linux System and Hardware Information
10 Useful ncat Commands on AlmaLinux
Using Find and Locate commands on Linux
FAQs
What is a Crontab?
A crontab is a file used by the cron job scheduler in Linux to automate repetitive tasks. It contains a list of commands or scripts to run at specified times.
How Do I Verify If My Cron Jobs Are Saved?
After saving and exiting Nano, run the command below:crontab -l