Bobcares

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*Get up to $4000, Offer valid till November 30th, 2024

For every $500 you spend, we will provide you with a $500 credit on your account*

BLACK FRIDAY SPECIAL

*Get up to $4000, Offer valid till November 30th, 2024

Change Crontab Editor to Vim | In Ubuntu & CentOS

by | Nov 13, 2023

We can easily change the crontab editor to vim from the default editor using the steps in this article. Bobcares, as a part of our Server Management Service offers solutions to every query that comes our way.

How to Change the Crontab Editor to Vim?

We must specify the VISUAL or EDITOR environment variable to point to the Vim editor in order to change the default text editor for modifying the crontab to that of Vim, a well-liked text editor in Linux. This will guarantee that Vim opens as the default editor when we edit the crontab.

In this article, we’ll look into the steps to change the editor on Ubuntu and CentOS.

How to Change in Ubuntu?

We must try to run: select-editor, which interactively creates ~/.selected_editor:

# Generated by /usr/bin/select-editor

SELECTED_EDITOR="/usr/bin/vim.basic"

How to Change in CentOS?

1. In a Linux or CentOS system, open a terminal window.

2. We can confirm if the VISUAL and EDITOR environment variables aren’t already set using the below commands:

change crontab editor to vim

These commands indicate that the environment variables are already configured if they yield an output (such as another text editor like “nano” or “vi”).

4. If no result is returned, we can set either VISUAL or EDITOR, or both, to Vim. Choose one or both of the following commands to set the environment variable:

i. Use the below code to set Visual to Vim:

change crontab editor to vim

ii. Use the below code to set Editor to Vim:

change crontab editor to vim

iii. In order to set both, use the code below:

change crontab editor to vim

We can add these export commands to the shell’s profile configuration file if we wish to make the change permanent for the user. So, now to make sure the environment variable(s) are set correctly to Vim, we can use the code:

change crontab editor to vim

This will display “vim”. Then, we can use the crontab -e command to edit the crontab, and it should open in the Vim text editor. We can make the changes in Vim and save them as we would with any text file in Vim.

[Want to learn more? Reach out to us if you have any further questions.]

Conclusion

We have successfully switched to Vim as the crontab editor by doing these steps from our Experts. Now, every time we run the crontab -e command, the crontab will be edited and saved using the Vim text editor.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.