Ubuntu – How to find out what the default terminal text editor is?

command lineenvironment-variablestext-editor

While reading the git introductory material, I read a piece that brought this question to mind.

How do I use the Terminal to find out what my Default Text Editor is?

Are there a General Commands that I can use to find this out?

Best Answer

The default editor is as defined by the EDITOR, or VISUAL, environment variable(s).

The default editor is vi if neither were defined. Add

export EDITOR="/bin/nano" 

to your ~/.bashrc file to set, for example, nano as your default editor.

To see if the environment variable is set, you can use

printenv | grep EDITOR


set | grep EDITOR

One can dereference the value of the named environment variable by prefixing it with a "$"

$ echo $EDITOR


$ echo $VISUAL