Skip to content

Instantly share code, notes, and snippets.

@wilhelmberg
Last active November 21, 2021 11:14
Show Gist options
  • Save wilhelmberg/cc0a0c6ed649c8b9961e37e7ff44828c to your computer and use it in GitHub Desktop.
Save wilhelmberg/cc0a0c6ed649c8b9961e37e7ff44828c to your computer and use it in GitHub Desktop.
install and run **LINUX** 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
@jtroussard
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
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
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
Copy link

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

@ThuyBNguyen
Copy link

@jtroussard Thank you so much!

@Ognev1990
Copy link

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
Copy link

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

tthanks this was very useful

@sozakir
Copy link

sozakir commented Aug 19, 2020

@lnfel
Copy link

lnfel commented Aug 31, 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 :-)

@Ognev1990 thanks man

@weeebdev
Copy link

subl() { "/mnt/c/Program Files/Sublime Text 3/subl.exe" wslpath -aw $1 }

I did it in another way. Since I'm using fish and it doesn't support this command, I created the custom subl file in /usr/local/bin. Then added sudo chmod +x subl and in this file I typed:

#!/bin/sh

exec "/mnt/c/Program Files/Sublime Text 3/subl.exe" wslpath -aw $1

@davo417
Copy link

davo417 commented Feb 19, 2021

I just install Sublime on Windows, then create an symlink of wsl2 home on windows like this \\wsl$\<distro>\home\<username> and I'm able to edit files and forders inside of the wsl2 filesystem securely, tihs is the way that Microsoft advise. Hope it helps...

@kamaroly
Copy link

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

@SRIME
Copy link

SRIME commented Nov 21, 2021

If it didnt work try this

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment