Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install and run sublime text 3 on Windows 10 Linux Subsystem "Ubuntu bash"
sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

run /opt/sublime_text/sublime_text or sudo ln -s /opt/sublime_text/sublime_text /usr/local/bin/subl

with ubuntu bash on Windows 10 and Xming:

DISPLAY=:0 /opt/sublime_text/sublime_text

remove:

sudo apt-get remove sublime-text-installer

file manager:

sudo apt-get install PCManFM
DISPLAY=:0 pcmanfm
@jpanuncialman

This comment has been minimized.

Copy link

jpanuncialman commented Apr 24, 2017

I tried running subl but nothing opens. Anything else I can do?

@devCarlosZ

This comment has been minimized.

Copy link

devCarlosZ commented Apr 28, 2017

@HassanAkbar

This comment has been minimized.

Copy link

HassanAkbar commented Jan 5, 2018

It's now possible to launch Windows executables (like Sublime Text) from the Bash on Ubuntu command line - at least, on the Insider Preview (slow ring) version of Windows that I'm using (OS Build 14986.1001). It's fairly easy to sign up for the Insider Preview, and I've had no problems since switching (with either Bash on Ubuntu or Windows generally).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.

@jtroussard

This comment has been minimized.

Copy link

jtroussard commented May 1, 2018

@HassanAkbar Thanks for you suggestion to launch windows exe directly. Worked perfectly for me. Also, you can avoid using double quotes by escaping the spaces with backslashes...

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

@Matt45D

This comment has been minimized.

Copy link

Matt45D commented Jul 13, 2018

Hi thanks for this nice little tutorial on how to setup sublime text to work for those using the Ubuntu Distro on Windows. I was wondering if anyone is getting an error where when they execute the "subl fileName.txt" that the file will be opened in Sublime Text but blank with all the original content not there?

@tali1974

This comment has been minimized.

Copy link

tali1974 commented Jan 8, 2019

Hi.. I also are able to run "subl fileName.txt" but the file is blank .. as Matt45D. Any idea ?
the file is on the "linux file structure" /home/username/fileName.txt and iam running "subl fileName.txt"

@aboustayyef

This comment has been minimized.

Copy link

aboustayyef commented Feb 13, 2019

Same as Matt45D & tali1974 ... Seems the subl.exe executable doesn't accept parameters?

@ThuyBNguyen

This comment has been minimized.

Copy link

ThuyBNguyen commented May 10, 2019

@jtroussard Thank you so much!

@Ognev1990

This comment has been minimized.

Copy link

Ognev1990 commented Mar 18, 2020

For the correct work with Linux path need to add transform path by wslpath -aw
I just added this code to ~/.bashrc
subl() { "/mnt/c/Program Files/Sublime Text 3/subl.exe" wslpath -aw $1 }
hope it will be useful for somebody :-)

@danielkpodo

This comment has been minimized.

Copy link

danielkpodo commented Jul 26, 2020

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

tthanks this was very useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.