After following this tutorial, I cannot launch Sublime Text from command line. How can I fix this?

up vote 44 down vote accepted

After following this tutorial and facing the reported problem, I googled it and realised that I had forgot to create a symbolic link.

sudo ln -s /opt/sublime/sublime_text /usr/bin/subl

Now the problem is solved :)

  • 3
    I think it would be better to use /usr/local/bin instead of /usr/bin. – lev Jan 26 '15 at 9:17
  • 5
    Do not do this with current versions of ST3 ... its already baked in – Scott Stensland Oct 17 '15 at 5:10
  • 2
    Did not occur for me using ST3, had to manually link. No command line options were available otherwise. – gnomed Apr 28 '16 at 18:01
  • To launch sublime you need to run subl from the Terminal. – E235 Jan 9 at 10:53

For recent versions of Ubuntu and Sublime Text 3, I'm adding a symlink like this:

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

Then I can execute it from terminal like subl myFile.php.

  • 6
    +1 for using /usr/local/bin instead of /usr/bin. – lev Jan 26 '15 at 9:09
  • I was trying to open sublime text 3 using sublime file.php. Thanks to point that the correct command is subl. It worked without creating the symlink. – campsjos Mar 22 '17 at 12:50

Personally I prefer creating an alias in ~/.bashrc, to avoid having to keep track of symbolic links:

alias subl=/opt/sublime_text/sublime_text

For anyone who is struggling for sublime text 3.

After creating symlink for opening ST3 use :

subl .

dont use:

sublime .

for those who install sublime in Ubuntu Software, just type

sudo ln -s /snap/sublime-text/38/opt/sublime_text/sublime_text /usr/local/bin/subl

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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