Changing the crontab editor in Home Assistant SSH terminal

Here is how to change the default editor on an Home Assistant OS installation.

When you SSH to a Linux machine and want to edit crontab, there is an environmental variable which decided which text editor to use. I personally like to use nano as the editor.

On my Home Assistant I have set up the SSH Web Terminal for terminal access to the system. After connecting with an SSH client (such as PuTTY) one can edit crontab with the command:

crontab -e 

The default editor for HA OS seems to be vim(?). In order to quit editing the crontab with vim, press ESC and then :q and press enter.

Now to change the editor. Edit the .zshrc file:

nano ~/.zshrc

Add the following line to .zshrc:

export EDITOR='nano'

Exit nano by pressing Ctrl-X and then selecting Yes to save modified file.

You can then try which editor opens when you again type:

crontab -e

Comments

Popular posts from this blog

Home Assistant on a Raspberry Pi 4 with an SSD

Adding the system monitor sensors to Home Assistant