If you have administrator access on your machine, the easiest way is to put a symlink in the
/usr/bin directory, as it already exists, and is already in your
PATH, or the list of places the shell looks for commands to run. All you need to do is enter the following in a Terminal session:
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
If you've never run this before, you'll likely get a short warning that essentially says "Make sure you know what you're doing, and even then think about it twice before doing it. You can really screw stuff up bad with this." Type in your password at the prompt, and you should be all set.
sudo command, which stands for "SuperUser DO", allows you to run commands with elevated privileges, in this case allowing you to create a file in the
/usr/bin directory, which normally doesn't allow the creation of new files in it. This is exactly the same as entering your password when installing a new program.
Once you've run the above command, quit your Terminal session completely (using ⌘Q, not just shutting the window) and restart it, and you should now be able to run
subl filename.txt at the command line and open any file you want in Sublime.