Best editor for crontab change? Compare these 3 popular tools

To modify the default editor for crontab, set the EDITOR or VISUAL environment variable. The preferred method is permanent configuration via shell profiles.

Check Current Editor

Run this command to identify the active editor:

echo $EDITOR

Temporary Change (Current Session Only)

Specify an editor before editing crontab:

Best editor for crontab change? Compare these 3 popular tools
EDITOR=nano crontab -e

Replace nano with vim, code, or your preferred editor executable.

Permanent System-Wide Configuration

Add these lines to /etc/environment (requires root):

EDITOR=/usr/bin/vim

VISUAL=/usr/bin/vim

Replace paths with your editor's absolute path (find with which editor-name).

Best editor for crontab change? Compare these 3 popular tools

Permanent User-Specific Configuration

Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):

export EDITOR=/usr/bin/nano

export VISUAL=$EDITOR

Reload with source ~/.bashrc or restart the terminal.

Verification

Confirm changes after implementation:

Best editor for crontab change? Compare these 3 popular tools
crontab -e

The specified editor should launch automatically.

Notes

  • VISUAL takes precedence over EDITOR if both exist.
  • System-wide changes affect all users. User-specific settings override system defaults.
  • For graphical editors (e.g., VSCode), ensure DISPLAY is configured if editing remotely.

Related News