Most people edit files with nano editor in the terminal but it is very handy to edit files using external tools when we have to edit long files. For many people is not common to do it but it is very simple.
Most common commands would be:
open -a TextEdit filename -> Opens filename in specified (TextEdit) app
open -t filename -> Opens filename in the default editor
open -e filename -> Specifically opens filename in TextEdit
If we want to open the file in the “Sublime” app. I recommend switching the name of the file from “Sublime Text 2” to “Sublime”. Then the command would be
open -a /Applications/Sublime.app filename -> Opens filename in Sublime app.
For example if we want to edit our httpd.conf file with Sublime, the command would be:
sudo open -a /Applications/Sublime /etc/apache2/httpd.conf