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

  • 4
    Comments are not for extended discussion; this conversation has been moved to chat. Please post any further discussion there. Comments will be deleted from this post with no warning.
    – terdon
    May 10, 2017 at 15:13

4 Answers 4


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 Desktop
  2. Ubuntu Kylin
  3. Ubuntu Budgie
  4. Ubuntu Unity

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

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Thomas Ward
    May 12, 2017 at 13:46
  • 1
    "if you want to edit files with root privileges, add gksu in front of a command" — Please use gksudo not gksu. They have a subtle but vital difference that can, in rare circumstances, lead to data loss. Documented on the forums,on this site, and as a bug. May 16, 2017 at 17:12
  • I don't know if I'd describe gvim as a user interface for vim as much as a way to run same old vim in a desktop window, so it basically just emulates a terminal window with vim in it. It does add an optional menu whose options translate to key commands, as well as mouse support with context menu, true colour support, etc, but essentially the interface is the same as in text-mode. Note that the version of vi installed by default is actually vim but may run vim in a "vi-compatible" mode. You can't really get the "original vi" anymore in a Linux distro. Dec 20, 2017 at 1:30
  • vi wasn't installed on my Google Cloud instance, a minimized Ubuntu 19.04 (disco dingo). It surprised me too.
    – mazunki
    Jul 29, 2019 at 16:13

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


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

  • kwrite for a while as default text editor for Kubuntu
    – Anwar
    May 12, 2017 at 12:00


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:

  • 1
    Could you justify your assertion that gksu is evil?
    – Zanna
    May 23, 2017 at 5:23
  • @Zanna Paddy already did, in his comment after Sumeet's answer. Check out all 3 of his links. The middle one askubuntu.com/a/288506/2088 is probably the clearest. May 23, 2017 at 7:22
  • 1
    at least put a link in your answer then. You cannot assume everyone is reading the whole page or even that other answers will remain static. Anyway, gksu and gksudo are unnecessary imho
    – Zanna
    May 23, 2017 at 7:25
  • 1
    we are "meant to" use sudo -i and then launch the program, or you can just use sudo -H. I don't use GUI text editors. I don't use the GUI for much, but I use sudo -i for anything I can't use sudo for
    – Zanna
    May 23, 2017 at 7:34
  • 2
    @SumeetDeshmukh that's up to you, but gksu is not installed by default, while sudo is of course. Sometimes you need root permissions to fix an APT problem, so installing a package is not practicable. Many people who are used to gksu still install it and use it, but it's the "old fashioned way" I guess :) I would use sudo -H gedit for example (I go around editing that -H into posts!) because really you need extra steps with sudo -i: some programs don't start in one step like that, and you have to remind people to exit the root shell, so sudo -H is the easiest way
    – Zanna
    May 23, 2017 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .