Install micro Text Editor on Ubuntu 20.04

Install micro Text Editor on Ubuntu 20.04

The micro is a text editor for creating and modifying text files via command line. It supports syntax highlighting, line numbers, common keybindings (CTRL+C, CTRL+V, …), undo/redo, text selection with mouse and other features. The micro is written in Go programming language.

This tutorial explains how to install micro text editor on Ubuntu 20.04.

Install micro

Retrieve the latest version tag of micro release from GitHub and assign version tag to variable.

MICRO_VERSION=$(curl -s "https://api.github.com/repos/zyedidia/micro/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Download the tar.gz file from releases page of the micro repository.

curl -Lo micro.tar.gz "https://github.com/zyedidia/micro/releases/latest/download/micro-${MICRO_VERSION}-linux64.tar.gz"

Create temporary directory and extract a tar.gz file:

mkdir micro-temp
tar xf micro.tar.gz --strip-components=1 -C micro-temp

Move binary file to the /usr/local/bin directory:

sudo mv micro-temp/micro /usr/local/bin

Now micro command will be available for all users as system-wide command. We can check version:

micro -version

Remove tar.gz file and temporary directory:

rm -rf micro.tar.gz
rm -rf micro-temp

Testing micro

If you want to create a new file or edit an existing file, execute micro command and provide a filename as argument:

micro test.txt

File can be saved by pressing CTRL+S. Press CTRL+Q if you want to exit micro.

If you don't have required permissions to edit a file, run the command as superuser:

sudo micro /etc/profile
Edit file using micro on Ubuntu

Uninstall micro

If you want remove micro, simply delete related binary file:

sudo rm -rf /usr/local/bin/micro

You can also remove configuration directory:

rm -rf ~/.config/micro

Leave a Comment

Cancel reply

Your email address will not be published.