Breaking News
Home / Technology / Launch Sublime Text From The Command Line

Launch Sublime Text From The Command Line

OS X Command Line

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.


The first task is to make a symlink to subl. Assuming you’ve placed Sublime Text in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/Sublime" ~/bin/subl


Run subl --help,

Usage: subl [arguments] [files]         edit the given files
   or: subl [arguments] [directories]   open the given directories
   or: subl [arguments] -               edit stdin

  --project <project>: Load the given project
  --command <command>: Run the given command
  -n or --new-window:  Open a new window
  -a or --add:         Add folders to the current window
  -w or --wait:        Wait for the files to be closed before returning
  -b or --background:  Don't activate the application
  -s or --stay:        Keep the application activated after closing the file
  -h or --help:        Show help (this message) and exit
  -v or --version:     Show version and exit

--wait is implied if reading from stdin. Use --stay to not switch back
to the terminal when a file is closed (only relevant if waiting for a file).

Filenames may be given a :line or :line:column suffix to open at a specific


To use Sublime Text as the editor for many commands that prompt for input, set your EDITOR environment variable:

export EDITOR='subl -w'

Specifying -w will cause the subl command to not exit until the file is closed.

Ubuntu Command Line

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

Windows Command Line

I added this to my PowerShell profile:

Set-Alias subl 'C:\Program Files\Sublime Text 3\sublime_text.exe'

To include the Sublime installation folder in windows path,

  1. Open command prompt and type sysdm.cpl
  2. In Advanced tab, select Environment variables
  3. Under system variables, select variable named “Path” and click Edit.
  4. Add “C:\Program Files\Sublime Text 3;” to the end of the existing string.
  5. Save the changes and restart command prompt

About ui39

Check Also


Web Technologies Accounting

Table of Contents ONLINE ACCOUNTING SOFTWARE FOR BUSINESSESRequirementsFrameworkInstallationDockerContributing ONLINE ACCOUNTING SOFTWARE FOR BUSINESSES From invoicing …

Leave a Reply

Your email address will not be published. Required fields are marked *

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

If you agree to these terms, please click here.