How to Change the Default Terminal Editor from Nano to Micro in Ubuntu

When you run commands in the Ubuntu terminal that require opening a text file (such as using visudo, editing a crontab, or making a Git commit), the system automatically launches the default text editor. In most modern Ubuntu installations, this default is Nano.

While Nano is beginner-friendly, it lacks advanced features like mouse support, proper syntax highlighting, and modern keyboard shortcuts (like Ctrl+C to copy and Ctrl+S to save). If you want a more modern terminal editing experience without the steep learning curve of Vim, Micro is the perfect alternative. However, simply installing Micro isn’t enough; you must explicitly tell Ubuntu to use it as the system-wide default.

How to Install the Micro Editor

First, you need to ensure Micro is installed on your system.

  1. Open your Ubuntu Terminal.
  2. Update your package list: sudo apt update
  3. Install the Micro editor: sudo apt install micro

How to Set Micro as the Default Editor

Ubuntu uses a system called update-alternatives to manage default applications. You will use this tool to swap Nano for Micro.

  1. Type the following command into your terminal and press Enter: sudo update-alternatives --config editor
  2. The terminal will output a list of all installed text editors. Each editor will have a number assigned to it in the far-left column (e.g., 1 for Nano, 2 for Vim, 3 for Micro).
  3. Look at the list, find the number corresponding to /usr/bin/micro, and type that number into the prompt at the bottom of the screen.
  4. Press Enter.

The change is instantaneous and applies system-wide. The next time you run a command like crontab -e, Ubuntu will automatically launch the Micro editor, allowing you to use your mouse to highlight text and standard Windows/Mac keyboard shortcuts to navigate your configuration files.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.