How to Open Sublime Text via Terminal

Updated Jul 17, 2020・1 minute read Post By Tony Lea
How to Open Sublime Text via Terminal

Back when I was using TextMate I was easily able to navigate to a directory in terminal and type 'mate .' and open up a specific file or directory in TextMate. Well with Sublime Text 2 you can do this as well. Here's how to do it using a Bash Shell. If you are using a different shell you'll just have to figure out which file you need to add a global alias. If you are using the Bash Shell you can navigate to your '~/.bash_profile'

and enter the following (If you are using a different version of Sublime Text you may have to modify the directory a little bit.

alias subl='/Applications/Sublime\ Text\'

Now you can open a new terminal window, navigate to a specific directory and type in 'subl .' and your be able to open a specific directory or file directly from your terminal window. Hope that helps out someone else ;)

© 2020 DevDojo LLC. All rights reserved.