Ubuntu: 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?


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


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  


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  


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  


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 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


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.


sudo apt-get install vim  

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

vim /path/to.file.txt  


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:

sudo update-alternatives --config editor  


~$ sudo 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



xdg-open some_file  


$EDITOR some_file  

is foolproof, unless you DEFINE "default" as whatever they invoke, which is not the sense in which it is commonly used.

For example, on my xenial systems:

I don't have a global EDITOR variable defined:

$ env | grep EDITOR  $ echo $EDITOR    $  

So $EDITOR some_file fails completely in either a gui environment (x & openbox, in lxterminal), or in a tty.

In a gui environment xdg-open some_file opens the file in vi. In a plain tty, it ATTEMPTS to do the same, but fails. But vi is not my "default" editor in the sense the word is most commonly used. All the file managers I have installed agree that my default editor is ed (no, not THAT ed - if I were that masochistic I'd use vi, my ed is a script I wrote).

There may be a justification for defining "default" in terms of one or the other of those commands, but in the general usage of the great majority of users, "default" is an adjective applied to whatever program opens a file when you double or single click on it in a gui file browser (like Nautilus, Pcmanfm, Thunar, etc.), (double or single depending on the settings in that PARTICULAR file browser). Or, alternately, whatever program opens the file when you highlight it and press enter in an orthodox file browser like Midnight Commander.

So, in the most common usage of "default", you can have a different default for each file browser, and when you speak of default without qualification it means whatever is the default in the default file browser. And the default file browser in a graphical environment would be the one that opens if you double click on a directory (aka "folder") or a symlink to a directory on the desktop, or if you don't use the desktop metaphor, maybe the one most featured in a menu. As far as I know, in this sense, which is the normal real world usage, Sumeet Deshmukh's answer is totally correct and totally complete. It may be in the more abstract senses as well.

In a non-graphical environment, outside of an orthodox file manager, the common sense of the word "default", applied to an editor, has no normal application. Nobody working in tty invokes an editor with xdg-open some_file or $EDITOR some_file unless they are working on somebody else's machine, don't want to install anything, and have gotten desperate. They open an editor by directly invoking the one they want to open, BY NAME. If they get bash: gedit: command not found they try their second favorite, etc. What the default is, is irrelevant. All that matters is their preferences and what's installed or can be installed.

The Main Point:

. . . gksu gedit /path/file.txt which wont work because gedit isn't the default text editor . . . .

Wrong. And that's why I posted, to explain why that statement is wrong and why that command failed. What the default editor is, however you define it, is irrelevant.

For that command to work, you need 2 things:

  • Both programs, gksu and gedit, must be installed on the system.

  • You must have suitable permissions for the file and it's ancestral directories. You have to have x on all directories in the path, at least r on the file itself, and probably at least r on the parent directory. Some editors might require w on the file or even on the parent directory, although they shouldn't.

You should be able to tell why the command failed by reading the error message. If you like gedit, install it.

But gksu is dangerous. Use gksudo if you need it. But don't use any of the su/sudo/gksu/gksudo/pkexec type commands unless the command that follows fails without it. And even then, only if it SHOULD have failed. If it should have worked, using some sudo-ish command to MAKE it work is like "If it don't fit, get a bigger hammer". It will create more problems down the road. In that case, correct the permissions , and try to figure why they were wrong in the first place.

Nor are any of the sudo type commands omnipotent. Sometimes, you MUST change permissions before you can edit the file even WITH gksudo.

Regarding the dangers of gksu listen to Paddy who commented on Sumeet's answer. He is wise chap who has been around a while. Repeating his 3 links:

https://askubuntu.com/a/288506/2088  https://bugs.launchpad.net/ubuntu/+source/gksu/+bug/1186676  http://ubuntuforums.org/showthread.php?t=1819589  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »