Opening Sublime Text from Bash on Ubuntu on Windows

It's now possible to launch Windows executables (like Sublime Text) from the Bash on Ubuntu command line.

You should also be able to set an alias to use it from the command line (as you were trying to do). Mine is as follows (and works fine):

alias subl='"/mnt/c/Program Files/Sublime Text 3/subl.exe"'

Note the second set of quotes: this is necessary because of the spaces in the file path. Alternatively you can escape the spaces (as you did in your example).


Nick F's answer is correct, but there is an important caveat.

If your intent is to edit Linux files using Sublime Text, then you should reconsider. Doing so can cause data corruption, as I've discovered first hand.

See here for more details on why: https://blogs.msdn.microsoft.com/commandline/2016/11/17/do-not-change-linux-files-using-windows-apps-and-tools/

I realize this is an old post, but I'm hoping this will serve as a warning to other users attempting to set up Sublime Text to edit Linux files.


Creating alias will not let you use

subl path_to_file

instead, you can just link the subl application to your /bin folder

 sudo ln -s /mnt/c/Program\ Files/Sublime\ Text\ 3/subl.exe /bin/subl

Done!!

If there is not /bin folder do whereis ls and replace /bin with the output directory

ps- /bin is a standard directory in Unix-like OS that contains the executable(short form of binaries)