Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed sublime text 2 on Ubuntu 12.10 and would like to be able to run it as its own environment variable. Example $ sublime somefile.js how do I add custom variables?

share|improve this question
up vote 1 down vote accepted

I am not sure this is the most elegant solution but you can create a script in your ~/bin/sublime with the following commands:

echo "/FULL-PATH-TO-YOUR-SUBLIME-FOLDER/sublime_text \$1" > ~/bin/sublime
chmod +x ~/bin/sublime

and then if your ~/bin/ folder is in your $PATH then you will be able to run $ sublime somefile.js

To check your $PATH just run echo $PATH

If you bin is not ther edit your .bashrc file and edit or add a line like the following:

export PATH
share|improve this answer

I think you are confusing the term environment variable, it seems like you want to place the a command to start Sublime Text in your path.

From the Sublime Text installation page:

sudo ln -s /path/to/sublime_text /usr/bin/subl

Note that you must use the full path or this will not work. Suggested place to extract the downloaded file to is /opt.

share|improve this answer

This is the BEST way, I think!

go to your terminal and type:

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

(if your sublime text folder is in /opt/Sublime Text 2)

this command creates a symbolic link in /usr/bin and then you can call sublime command easily in terminal:

sublime .... (some code). That's all! :)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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