EDIT I thought of a better way to phrase the question.

How can I find the alias that Ubuntu is using for a different text editor? Rather than using nano by typing nano file.txt, i'd like to be able to type sublime file.txt to open sublime editor. I don't know where to look to find these aliases.

sudo update-alternatives --config editor does not show it as a choice, I only see the 'default' editors, like Nano and vim.tiny.


If your file is identifiable as a text file then passing it to xdg-open will open it in your text editor. If it identifies as some other type though, it will open the file in the appropriate application instead.


xdg-mime query default <mimetype> will give you the .desktop file for the application associated with a MIME type. From there you need to parse the file to get the executable name from it.


you can use

export EDITOR=vim or nano or any editor name

or copy this line and write in .bashrc or .profile file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.