Sublime Forum

Set as Default text editior from Terminal [Linux]


I’m using Kali Linux with sublime,
and i would like to find a way to set sublime as my default text editor from the Terminal!.
I know how to do it the GUI way(Right click -> open with), but i want to make it default to multiple computers at once.
So i want to find a way to set it as default Text editior from the command line of linux!
Thank you! Waiting for your help…



On Unix-like operating systems, there are two environment variables used for editors: EDITOR and VISUAL. I’ve oftentimes observed confusion about these and in reality, they are often used interchangeably.

You can set either like you would normally set an environment variable. That usually depends on your shell, but most commonly it’s using set command.


set EDITOR /path/to/your/editor
set VISUAL /path/to/your/editor

You might want to set these in your shell config for persistency. For the most popular shells, bash and zsh, you would use the export command in your .bashrc / .zshrc:

export EDITOR=/path/to/your/editor
export VISUAL=/path/to/your/editor