What are the default text editors in different flavours of Ubuntu?

What are the default text editors (GUI and CLI) in different flavors of Ubuntu. what commands should we use to edit files with them?

screensho


Behind the question

I tried Kubuntu and want to try more Ubuntu flavors and other distros, but when I was in Kubuntu I tried so hard to run gksu gedit /path/file.txt which wont work because gedit isn't the default text editor in Kubuntu, it's kate. I'm glad nano was available. but if I want to try more flavors I must know what are the default text editors in various Ubuntu flavors


I think Answers by Muzaffar and Terrance serves your need. One thing to note is that you can install any of these text editors in any flavors.


GUI Text Editors

Gedit

Default in:

  1. Ubuntu Unity
  2. Ubuntu Gnome
  3. Ubuntu Kylin
  4. Ubuntu Budgie

Gedit is certainly the most famous text editor in the Ubuntu world. Gedit is also available for Windows and MacOS. To install Gedit on any Ubuntu flavor use the following command:

sudo apt-get install gedit

To open a file with gedit:

gedit /path/to.file.txt

Kate

Default in:

  1. Kubuntu
  2. KDE Neon (not an official Ubuntu flavor)

it is also available for Windows. Like many KDE apps it has a load of features. To install, run:

sudo apt-get install kate

If you want the latest version of Kate, you'll need to add a PPA:

sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get update
sudo apt-get install kate

To open a file with kate:

kate /path/to.file.txt

Leafpad

Unlike Kate, emphasis of Leafpad is on simplicity and lightness, which is whole agenda of the LXDE project. It comes pre-installed on Lubuntu. To install:

sudo apt-get install leafpad

To open a file with leafpad:

leafpad /path/to.file.txt

Mousepad

Default in:

  1. Xubuntu
  2. Ubuntu Studio

In philosophy, Mousepad is pretty similar to Leafpad. To install:

sudo apt-get install mousepad

To open a file with mousepad:

mousepad /path/to.file.txt

Pluma

Pluma is a fork of Gedit which comes preinstalled in Ubuntu Mate. To install:

sudo apt-get install pluma

To open a file with pluma:

pluma /path/to.file.txt

*Note: if you want to edit files with root privileges, add gksu in front of a command, like this:

gksudo gedit path/to/file.txt

It's best to avoid using it with kate


CLI Text Editors

Nano

sudo apt-get install nano

I don't know if Nano is installed on all the Ubuntu flavors, but it's installed on Ubuntu Unity, Ubuntu Gnome and Kubuntu as per my knowledge. To open a file with nano use following command:

nano /path/to.file.txt

For more information about Nano, see The Beginner’s Guide to Nano, the Linux Command-Line Text Editor.

Vim

sudo apt-get install vim

To open a file with Vim, type either of these two commands:

vim /path/to.file.txt

or

vi /path/to.file.txt

Vim (or at least vi) is installed by default on all Ubuntu (or any other Linux) flavor. If you start to like Vim and want it to have a user interface try Gvim. Also note that on some systems, vi is aliased to vim, so both commands do identical things. (which launching vim)

For more knowledge about vim, see A Beginner's Guide to Vim or run vimtutor in the terminal.


Keep in mind that QT apps don't look good on Gtk based desktop and vice versa. but if you want them to feel at home, try this question How to make KDE applications look native in GNOME?


More Linux Text Editors


Flavors of Ubuntu can change all the time and so can the default GUI editors. Instead of trying to remember all the default GUI editors of each distro, as long as the xdg-utils are installed you can run a simple command of xdg-open so you know what the default editor is and can launch it editing a text file:

xdg-open /path/to/textfile

xdg-open can also launch what the default audio player is when you open a .MP3 file. Or if you want to quickly open a webpage you can use xdg-open www.somewebsite.com and it will launch your default web browser.


For the command line, vi/vim & nano seem to be the most common across Ubuntu flavors as being the default installed editors. vi/vim should be in all flavors of Linux.

You can change the default command line editor with the following command then you can choose which one you want as your default:

For sudo or root:

sudo update-alternatives --config editor

For your login:

update-alternatives --config editor

Example:

~$ update-alternatives --config editor
There are 9 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /usr/bin/vim.gnome   60        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/emacs24     0         manual mode
  4            /usr/bin/mcedit      25        manual mode
  5            /usr/bin/nvi         19        manual mode
  6            /usr/bin/nvim        30        manual mode
* 7            /usr/bin/vim.basic   30        manual mode
  8            /usr/bin/vim.gnome   60        manual mode
  9            /usr/bin/vim.tiny    10        manual mode

Press <enter> to keep the current choice[*], or type selection number:

Then since the command /usr/bin/editor should be in your path, to edit a file you can just run the following to edit your file:

editor /path/to/file

Or if you need elevated:

sudo editor /path/to/file

Hope this helps!


Kubuntu - kate

Lubuntu - leafpad

Xubuntu - mousepad

Ubuntu Gnome - gedit

Ubuntu MATE - pluma

Ubuntu Budgie -gedit

Ubuntu Kylin - gedit

Ubuntu Studio - mousepad