Ubuntu - Change Default Editor

Your terminal should have a default editor. This is what is used whenever you run commands like

crontab -e
. It may not be set to what you like, or your preferences may have changed. To change it, simply run the following command:
sudo update-alternatives --config editor
# You may also need to run this one for crontab

Now enter the number representing the editor you would like to default to

Now that is set, you can use the editor command in substitute for

. This is great for people who write tutorials because now we don't have to assume what you like to use. For example, I will try to make sure my tutorial steps are like below:

editor my-config-file.txt

Instead of:

vim my-config-file.txt


No comments:

Post a Comment