Set Default Editor to nano

Ubuntu 20.04

เมื่อสั่ง crontab -e บน Ubuntu เป็นครั้งแรก จะมีให้เลือกว่าจะเปิดด้วย editor อะไร (และจะกำหนดเป็น default editor)

ถ้าต้องการเปลี่ยน default editor ใหม่ใช้คำสั่ง

$ select-editor

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.tiny
  3. /bin/ed

Choose 1-3 [1]:

CentOS 7

เมื่อสั่ง crontab -e บน CentOS จะเปิดด้วย vi

ถ้าต้องการเปลี่ยน default editor (เฉพาะ user) ให้แก้ไขไฟล์ ~/.bash_profile

export EDITOR="nano"

จากนั้นใช้คำสั่ง source

$ source .bash_profile

สั่ง crontab -e ก็จะเปิดด้วย nano ละ